diff options
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r-- | src/timeline/RoomlistModel.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index 35507cbd..ec41cc12 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -1235,3 +1235,49 @@ FilteredRoomlistModel::previousRoom() } } } + +QString +RoomPreview::inviterAvatarUrl() const +{ + if (isInvite_) { + auto self = cache::client()->getInviteMember(roomid_.toStdString(), + http::client()->user_id().to_string()); + if (self && !self->inviter.empty()) { + auto other = cache::client()->getInviteMember(roomid_.toStdString(), self->inviter); + if (other && other->avatar_url.starts_with("mxc://")) { + return QString::fromStdString(other->avatar_url); + } + } + } + + return QString(); +} +QString +RoomPreview::inviterDisplayName() const +{ + if (isInvite_) { + auto self = cache::client()->getInviteMember(roomid_.toStdString(), + http::client()->user_id().to_string()); + if (self && !self->inviter.empty()) { + auto other = cache::client()->getInviteMember(roomid_.toStdString(), self->inviter); + if (other) { + return QString::fromStdString(other->name).toHtmlEscaped(); + } + } + } + + return QString(); +} +QString +RoomPreview::inviterUserId() const +{ + if (isInvite_) { + auto self = cache::client()->getInviteMember(roomid_.toStdString(), + http::client()->user_id().to_string()); + if (self && !self->inviter.empty()) { + return QString::fromStdString(self->inviter); + } + } + + return QString(); +} |