summary refs log tree commit diff
path: root/src/AvatarProvider.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 20:28:38 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 20:28:38 +0200
commitc123bada94bfd21121d6d847c472c910b88fed65 (patch)
treebeb24ae17228126b91468cd683d78a8f0910ab0f /src/AvatarProvider.cc
parentFix iterator crash (diff)
downloadnheko-c123bada94bfd21121d6d847c472c910b88fed65.tar.xz
Refactor avatar fetching in one function
Diffstat (limited to 'src/AvatarProvider.cc')
-rw-r--r--src/AvatarProvider.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/AvatarProvider.cc b/src/AvatarProvider.cc

index b8ea9e20..881ef2d5 100644 --- a/src/AvatarProvider.cc +++ b/src/AvatarProvider.cc
@@ -27,8 +27,6 @@ void AvatarProvider::init(QSharedPointer<MatrixClient> client) { client_ = client; - - connect(client_.data(), &MatrixClient::userAvatarRetrieved, &AvatarProvider::updateAvatar); } void @@ -65,7 +63,13 @@ AvatarProvider::resolve(const QString &userId, std::function<void(QImage)> callb // Add the current timeline item to the waiting list for this avatar. if (!toBeResolved_.contains(userId)) { - client_->fetchUserAvatar(userId, avatars_[userId].url); + client_->fetchUserAvatar(avatars_[userId].url, + [userId](QImage image) { updateAvatar(userId, image); }, + [userId](QString error) { + qWarning() + << error << ": failed to retrieve user avatar" + << userId; + }); QList<std::function<void(QImage)>> items; items.push_back(callback);