aboutsummaryrefslogtreecommitdiff
path: root/lib/user.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/user.cpp')
-rw-r--r--lib/user.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/user.cpp b/lib/user.cpp
index c4c4fec8..7933c5d9 100644
--- a/lib/user.cpp
+++ b/lib/user.cpp
@@ -51,13 +51,7 @@ User::User(QString userId, Connection* connection)
setObjectName(id());
if (connection->userId() == id()) {
// Load profile information for local user.
- auto *profileJob = connection->callApi<GetUserProfileJob>(id());
- connect(profileJob, &BaseJob::result, this, [this, profileJob] {
- d->defaultName = profileJob->displayname();
- d->defaultAvatar = Avatar(QUrl(profileJob->avatarUrl()));
- emit defaultNameChanged();
- emit defaultAvatarChanged();
- });
+ load();
}
}
@@ -69,6 +63,17 @@ Connection* User::connection() const
User::~User() = default;
+void User::load()
+{
+ auto *profileJob = connection()->callApi<GetUserProfileJob>(id());
+ connect(profileJob, &BaseJob::result, this, [this, profileJob] {
+ d->defaultName = profileJob->displayname();
+ d->defaultAvatar = Avatar(QUrl(profileJob->avatarUrl()));
+ emit defaultNameChanged();
+ emit defaultAvatarChanged();
+ });
+}
+
QString User::id() const { return d->id; }
bool User::isGuest() const