diff --git a/src/jamidht/account_manager.cpp b/src/jamidht/account_manager.cpp index 6c08d7769335eab7ec27ee6f983ff3b1511924b9..50d4a44582d5008400cb6accf74e12f442d8e1c5 100644 --- a/src/jamidht/account_manager.cpp +++ b/src/jamidht/account_manager.cpp @@ -259,6 +259,14 @@ AccountManager::useIdentity(const std::string& accountId, return info_.get(); } +void +AccountManager::reloadContacts() +{ + if (info_) { + info_->contacts->load(); + } +} + Json::Value AccountManager::announceFromReceipt(const std::string& receipt) { diff --git a/src/jamidht/account_manager.h b/src/jamidht/account_manager.h index c784d19d52eff8c609191e7d85fa0ff8e6e470a2..9037969a031d9f844f2a0b6a3f0ec8e2440f2d74 100644 --- a/src/jamidht/account_manager.h +++ b/src/jamidht/account_manager.h @@ -146,6 +146,8 @@ public: const AccountInfo* getInfo() const { return info_.get(); } + void reloadContacts(); + // Device management enum class AddDeviceResult { diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index cb1b3a5639f371b7813afec181098512c1951769..b984c07c845cdc85a70f487550a19b0ff2411ad4 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2411,6 +2411,11 @@ JamiAccount::setRegistrationState(RegistrationState state, Account::setRegistrationState(state, detail_code, detail_str); } +void +JamiAccount::reloadContacts() { + accountManager_->reloadContacts(); +} + void JamiAccount::connectivityChanged() { diff --git a/src/jamidht/jamiaccount.h b/src/jamidht/jamiaccount.h index 09d72334b4c4d7b7dfe02cc9730a1029e9804e36..0edfe3582177c41043bb7137fa5e11306aa1faa6 100644 --- a/src/jamidht/jamiaccount.h +++ b/src/jamidht/jamiaccount.h @@ -549,6 +549,8 @@ public: */ void forceReloadAccount(); + void reloadContacts(); + /** * Make sure appdata/contacts.yml contains correct informations * @param removedConv The current removed conversations diff --git a/src/manager.cpp b/src/manager.cpp index cda27ada8d10b2f005452ad64825b690f52b3809..32f927903c4371747b664243ba05727216d2d000 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -3086,6 +3086,7 @@ Manager::loadAccountAndConversation(const std::string& accountId, } if (auto jamiAcc = std::dynamic_pointer_cast<JamiAccount>(account)) { jamiAcc->setActive(true); + jamiAcc->reloadContacts(); if (jamiAcc->isUsable()) jamiAcc->doRegister(); if (auto convModule = jamiAcc->convModule()) { diff --git a/src/manager.h b/src/manager.h index 53a1987588bf2f8fbcccbc04973c2ae169c5bd9e..59f9270248135dd8e604c910fb15449daf39e83f 100644 --- a/src/manager.h +++ b/src/manager.h @@ -442,9 +442,11 @@ public: * @param details The account parameters */ void setAccountDetails(const std::string& accountID, - const std::map<std::string, ::std::string>& details); + const std::map<std::string, std::string>& details); - void setAccountActive(const std::string& accountID, bool active, bool shutdownConnections); + void setAccountActive(const std::string& accountID, + bool active, + bool shutdownConnections); void loadAccountAndConversation(const std::string& accountId, bool loadAll, const std::string& convId);