diff options
-rw-r--r-- | lib/user.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/user.cpp b/lib/user.cpp index bed7be3a..9f0386f4 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -49,6 +49,16 @@ User::User(QString userId, Connection* connection) : QObject(connection), d(new Private(move(userId))) { 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(); + }); + } } Connection* User::connection() const |