diff --git a/src/libclient/accountmodel.cpp b/src/libclient/accountmodel.cpp index 955650c4f2ef4151db4c06ac5f32f9de2fc442ed..ac8229b55ef16e637966c2c72930f4ac4763ba69 100644 --- a/src/libclient/accountmodel.cpp +++ b/src/libclient/accountmodel.cpp @@ -166,17 +166,6 @@ public Q_SLOTS: * @param ok */ void slotMigrationEnded(const QString& accountId, bool ok); - - /** - * Emit accountProfileReceived - * @param accountId - * @param displayName - * @param userPhoto - */ - void slotAccountProfileReceived(const QString& accountId, - const QString& displayName, - const QString& userPhoto); - /** * Emit new position * @param accountId @@ -415,10 +404,6 @@ AccountModelPimpl::AccountModelPimpl(AccountModel& linked, &CallbacksHandler::migrationEnded, this, &AccountModelPimpl::slotMigrationEnded); - connect(&callbacksHandler, - &CallbacksHandler::accountProfileReceived, - this, - &AccountModelPimpl::slotAccountProfileReceived); connect(&callbacksHandler, &CallbacksHandler::newPosition, this, @@ -691,25 +676,6 @@ AccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok) Q_EMIT linked.migrationEnded(accountId, ok); } -void -AccountModelPimpl::slotAccountProfileReceived(const QString& accountId, - const QString& displayName, - const QString& userPhoto) -{ - LC_WARN << accountId << displayName; - - auto account = accounts.find(accountId); - if (account == accounts.end()) - return; - auto& accountInfo = account->second.first; - accountInfo.profileInfo.avatar = userPhoto; - accountInfo.profileInfo.alias = displayName; - - storage::vcard::setProfile(accountInfo.id, accountInfo.profileInfo); - - Q_EMIT linked.profileUpdated(accountId); -} - void AccountModelPimpl::slotNewPosition(const QString& accountId, const QString& peerId, diff --git a/src/libclient/callbackshandler.cpp b/src/libclient/callbackshandler.cpp index 51acb43c803b606ebfcad9f0b17c71220bd4d261..d1b16c294e96e5c6ba2b302f0dfbd2f1ecfc5f23 100644 --- a/src/libclient/callbackshandler.cpp +++ b/src/libclient/callbackshandler.cpp @@ -236,13 +236,6 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) this, &CallbacksHandler::slotDeviceRevokationEnded, Qt::QueuedConnection); - - connect(&ConfigurationManager::instance(), - &ConfigurationManagerInterface::accountProfileReceived, - this, - &CallbacksHandler::slotAccountProfileReceived, - Qt::QueuedConnection); - connect(&ConfigurationManager::instance(), &ConfigurationManagerInterface::exportOnRingEnded, this, @@ -671,14 +664,6 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId, Q_EMIT deviceRevocationEnded(accountId, deviceId, status); } -void -CallbacksHandler::slotAccountProfileReceived(const QString& accountId, - const QString& displayName, - const QString& userPhoto) -{ - Q_EMIT accountProfileReceived(accountId, displayName, userPhoto); -} - void CallbacksHandler::slotExportOnRingEnded(const QString& accountId, int status, const QString& pin) { diff --git a/src/libclient/callbackshandler.h b/src/libclient/callbackshandler.h index d96c1393662bbb057359ac30b1f627959257c431..bef4114e0ce06c54443b0df68e9b85d2a4f2ffc8 100644 --- a/src/libclient/callbackshandler.h +++ b/src/libclient/callbackshandler.h @@ -562,16 +562,6 @@ private Q_SLOTS: const QString& deviceId, const int status); - /** - * Emit account avatar has been received - * @param accountId - * @param displayName - * @param userPhoto - */ - void slotAccountProfileReceived(const QString& accountId, - const QString& displayName, - const QString& userPhoto); - /** * Emit exportOnRingEnded * @param accountId diff --git a/src/libclient/contactmodel.cpp b/src/libclient/contactmodel.cpp index 5655b6c10c2f7047a9f0cd03c1e23bbe844d6f21..05dd5ee65e6db0b53d7e580051996e94ca6ee30a 100644 --- a/src/libclient/contactmodel.cpp +++ b/src/libclient/contactmodel.cpp @@ -1175,6 +1175,15 @@ ContactModelPimpl::slotProfileReceived(const QString& accountId, if (accountId != linked.owner.id) return; + if (linked.owner.profileInfo.uri == peer) { + const auto newProfileInfo = storage::getProfileData(accountId, ""); + linked.owner.accountModel->setAlias(accountId, newProfileInfo["alias"], false); + linked.owner.accountModel->setAvatar(accountId, newProfileInfo["avatar"], false); + + Q_EMIT linked.owner.accountModel->profileUpdated(accountId); + return; + } + // Make sure this is for a contact and not the linked account, // then just remove the URI from the cache list and notify. std::lock_guard<std::mutex> lk(contactsMtx_);