Commit 49f5f63e authored by Sébastien Blin's avatar Sébastien Blin

api: follow daemon changes on accountAvatarReceived (breaking change)

Change-Id: I78a515e6135eb68e85fe14a52c9f64795511e5c9
parent c51772f9
...@@ -182,9 +182,9 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) ...@@ -182,9 +182,9 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
Qt::QueuedConnection); Qt::QueuedConnection);
connect(&ConfigurationManager::instance(), connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::accountAvatarReceived, &ConfigurationManagerInterface::accountProfileReceived,
this, this,
&CallbacksHandler::slotAccountAvatarReceived, &CallbacksHandler::slotAccountProfileReceived,
Qt::QueuedConnection); Qt::QueuedConnection);
connect(&ConfigurationManager::instance(), connect(&ConfigurationManager::instance(),
...@@ -498,10 +498,11 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId, ...@@ -498,10 +498,11 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId,
} }
void void
CallbacksHandler::slotAccountAvatarReceived(const QString& accountId, CallbacksHandler::slotAccountProfileReceived(const QString& accountId,
const QString& userPhoto) const QString& displayName,
const QString& userPhoto)
{ {
emit accountAvatarReceived(accountId, userPhoto); emit accountProfileReceived(accountId, displayName, userPhoto);
} }
void void
......
...@@ -209,11 +209,12 @@ Q_SIGNALS: ...@@ -209,11 +209,12 @@ Q_SIGNALS:
const int status); const int status);
/** /**
* Account avatar has been received * Account profile has been received
* @param accountId * @param accountId
* @param displayName
* @param userPhoto * @param userPhoto
*/ */
void accountAvatarReceived(const QString& accountId, const QString& userPhoto); void accountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto);
/** /**
* Emit exportOnRingEnded * Emit exportOnRingEnded
...@@ -446,9 +447,10 @@ private Q_SLOTS: ...@@ -446,9 +447,10 @@ private Q_SLOTS:
/** /**
* Emit account avatar has been received * Emit account avatar has been received
* @param accountId * @param accountId
* @param displayName
* @param userPhoto * @param userPhoto
*/ */
void slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto); void slotAccountProfileReceived(const QString& accountId, const QString& displayName, const QString& userPhoto);
/** /**
* Emit exportOnRingEnded * Emit exportOnRingEnded
......
...@@ -163,11 +163,12 @@ public Q_SLOTS: ...@@ -163,11 +163,12 @@ public Q_SLOTS:
void slotMigrationEnded(const QString& accountId, bool ok); void slotMigrationEnded(const QString& accountId, bool ok);
/** /**
* Emit accountAvatarReceived * Emit accountProfileReceived
* @param accountId * @param accountId
* @param displayName
* @param userPhoto * @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, NewAccountModel::NewAccountModel(Lrc& lrc,
...@@ -393,7 +394,7 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked, ...@@ -393,7 +394,7 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked,
connect(&callbacksHandler, &CallbacksHandler::nameRegistrationEnded, this, &NewAccountModelPimpl::slotNameRegistrationEnded); connect(&callbacksHandler, &CallbacksHandler::nameRegistrationEnded, this, &NewAccountModelPimpl::slotNameRegistrationEnded);
connect(&callbacksHandler, &CallbacksHandler::registeredNameFound, this, &NewAccountModelPimpl::slotRegisteredNameFound); connect(&callbacksHandler, &CallbacksHandler::registeredNameFound, this, &NewAccountModelPimpl::slotRegisteredNameFound);
connect(&callbacksHandler, &CallbacksHandler::migrationEnded, this, &NewAccountModelPimpl::slotMigrationEnded); connect(&callbacksHandler, &CallbacksHandler::migrationEnded, this, &NewAccountModelPimpl::slotMigrationEnded);
connect(&callbacksHandler, &CallbacksHandler::accountAvatarReceived, this, &NewAccountModelPimpl::slotAccountAvatarReceived); connect(&callbacksHandler, &CallbacksHandler::accountProfileReceived, this, &NewAccountModelPimpl::slotAccountProfileReceived);
} }
NewAccountModelPimpl::~NewAccountModelPimpl() NewAccountModelPimpl::~NewAccountModelPimpl()
...@@ -638,9 +639,17 @@ NewAccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok) ...@@ -638,9 +639,17 @@ NewAccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok)
} }
void 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 void
......
...@@ -127,9 +127,9 @@ public: ...@@ -127,9 +127,9 @@ public:
[this] (const std::string &accountId, const std::string &device, int status) { [this] (const std::string &accountId, const std::string &device, int status) {
Q_EMIT this->deviceRevocationEnded(QString(accountId.c_str()), QString(device.c_str()), status); Q_EMIT this->deviceRevocationEnded(QString(accountId.c_str()), QString(device.c_str()), status);
}), }),
exportable_callback<ConfigurationSignal::AccountAvatarReceived>( exportable_callback<ConfigurationSignal::AccountProfileReceived>(
[this](const std::string& accountId, const std::string& userPhoto) { [this](const std::string& accountId, const std::string& displayName, const std::string& userPhoto) {
Q_EMIT this->accountAvatarReceived(QString(accountId.c_str()), QString(userPhoto.c_str())); Q_EMIT this->accountProfileReceived(QString(accountId.c_str()), QString(displayName.c_str()), QString(userPhoto.c_str()));
}), }),
exportable_callback<ConfigurationSignal::ExportOnRingEnded>( exportable_callback<ConfigurationSignal::ExportOnRingEnded>(
[this] (const std::string &accountId, int status, const std::string &pin) { [this] (const std::string &accountId, int status, const std::string &pin) {
...@@ -755,7 +755,7 @@ Q_SIGNALS: // SIGNALS ...@@ -755,7 +755,7 @@ Q_SIGNALS: // SIGNALS
void profileReceived(const QString &accountID, const QString &peer, const QString &vCard); void profileReceived(const QString &accountID, const QString &peer, const QString &vCard);
void dataTransferEvent(qulonglong transfer_id, uint code); void dataTransferEvent(qulonglong transfer_id, uint code);
void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status); 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 debugMessageReceived(const QString& message);
void composingStatusChanged(const QString& accountId, const QString& contactId, bool isComposing); void composingStatusChanged(const QString& accountId, const QString& contactId, bool isComposing);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment