diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp index 3c1c62a0f6b55dd2c318b32d6edb1fa7ded9374f..a5b20effa2db5b62d988dc387ba110b4b46dd3d7 100644 --- a/src/callbackshandler.cpp +++ b/src/callbackshandler.cpp @@ -182,9 +182,9 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) Qt::QueuedConnection); connect(&ConfigurationManager::instance(), - &ConfigurationManagerInterface::accountAvatarReceived, + &ConfigurationManagerInterface::accountProfileReceived, this, - &CallbacksHandler::slotAccountAvatarReceived, + &CallbacksHandler::slotAccountProfileReceived, Qt::QueuedConnection); connect(&ConfigurationManager::instance(), @@ -498,10 +498,11 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId, } void -CallbacksHandler::slotAccountAvatarReceived(const QString& accountId, - const QString& userPhoto) +CallbacksHandler::slotAccountProfileReceived(const QString& accountId, + const QString& displayName, + const QString& userPhoto) { - emit accountAvatarReceived(accountId, userPhoto); + emit accountProfileReceived(accountId, displayName, userPhoto); } void diff --git a/src/callbackshandler.h b/src/callbackshandler.h index 116adde22649d01008f6e8fcf1b2639d0f0a09e4..0b0d56875ac81e2ba788a6dd2153d895d62b4f50 100644 --- a/src/callbackshandler.h +++ b/src/callbackshandler.h @@ -209,11 +209,12 @@ Q_SIGNALS: const int status); /** - * Account avatar has been received + * Account profile has been received * @param accountId + * @param displayName * @param userPhoto */ - void accountAvatarReceived(const QString& accountId, const QString& userPhoto); + void accountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto); /** * Emit exportOnRingEnded @@ -446,9 +447,10 @@ private Q_SLOTS: /** * Emit account avatar has been received * @param accountId + * @param displayName * @param userPhoto */ - void slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto); + void slotAccountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto); /** * Emit exportOnRingEnded diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index 43bb45e30192aed86cbb05c3cffc8a678f0495aa..c511a844ad173cc4c14607f8e6ca8816e4ade859 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -163,11 +163,12 @@ public Q_SLOTS: void slotMigrationEnded(const QString& accountId, bool ok); /** - * Emit accountAvatarReceived + * Emit accountProfileReceived * @param accountId + * @param displayName * @param userPhoto */ - void slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto); + void slotAccountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto); }; NewAccountModel::NewAccountModel(Lrc& lrc, @@ -393,7 +394,7 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked, connect(&callbacksHandler, &CallbacksHandler::nameRegistrationEnded, this, &NewAccountModelPimpl::slotNameRegistrationEnded); connect(&callbacksHandler, &CallbacksHandler::registeredNameFound, this, &NewAccountModelPimpl::slotRegisteredNameFound); connect(&callbacksHandler, &CallbacksHandler::migrationEnded, this, &NewAccountModelPimpl::slotMigrationEnded); - connect(&callbacksHandler, &CallbacksHandler::accountAvatarReceived, this, &NewAccountModelPimpl::slotAccountAvatarReceived); + connect(&callbacksHandler, &CallbacksHandler::accountProfileReceived, this, &NewAccountModelPimpl::slotAccountProfileReceived); } NewAccountModelPimpl::~NewAccountModelPimpl() @@ -638,9 +639,17 @@ NewAccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok) } void -NewAccountModelPimpl::slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto) +NewAccountModelPimpl::slotAccountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto) { - linked.setAvatar(accountId, userPhoto); + auto account = accounts.find(accountId); + if (account == accounts.end()) return; + auto& accountInfo = account->second.first; + accountInfo.profileInfo.avatar = userPhoto; + accountInfo.profileInfo.alias = displayName; + + authority::storage::createOrUpdateProfile(accountInfo.id, accountInfo.profileInfo); + + emit linked.profileUpdated(accountId); } void diff --git a/src/qtwrapper/configurationmanager_wrap.h b/src/qtwrapper/configurationmanager_wrap.h index c8b8551203abf2dcc387573d6e378ecf9cbbc210..3d2730468db8c2f1fcc8e4d357bec080af42e81b 100644 --- a/src/qtwrapper/configurationmanager_wrap.h +++ b/src/qtwrapper/configurationmanager_wrap.h @@ -127,9 +127,9 @@ public: [this] (const std::string &accountId, const std::string &device, int status) { Q_EMIT this->deviceRevocationEnded(QString(accountId.c_str()), QString(device.c_str()), status); }), - exportable_callback<ConfigurationSignal::AccountAvatarReceived>( - [this](const std::string& accountId, const std::string& userPhoto) { - Q_EMIT this->accountAvatarReceived(QString(accountId.c_str()), QString(userPhoto.c_str())); + exportable_callback<ConfigurationSignal::AccountProfileReceived>( + [this](const std::string& accountId, const std::string& displayName, const std::string& userPhoto) { + Q_EMIT this->accountProfileReceived(QString(accountId.c_str()), QString(displayName.c_str()), QString(userPhoto.c_str())); }), exportable_callback<ConfigurationSignal::ExportOnRingEnded>( [this] (const std::string &accountId, int status, const std::string &pin) { @@ -755,7 +755,7 @@ Q_SIGNALS: // SIGNALS void profileReceived(const QString &accountID, const QString &peer, const QString &vCard); void dataTransferEvent(qulonglong transfer_id, uint code); void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status); - void accountAvatarReceived(const QString& accountId, const QString& userPhoto); + void accountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto); void debugMessageReceived(const QString& message); void composingStatusChanged(const QString& accountId, const QString& contactId, bool isComposing); };