diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-13 23:58:26 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-13 23:58:26 +0200 |
commit | 9bad584931a03717f71e96900202acac43d2a62f (patch) | |
tree | 291a86498814a45ec27ff2be715af3d29fe2294a /src | |
parent | Show if there are unverified devices in a room (diff) | |
download | nheko-9bad584931a03717f71e96900202acac43d2a62f.tar.xz |
Show verification status in memberlist
Diffstat (limited to 'src')
-rw-r--r-- | src/Cache.cpp | 2 | ||||
-rw-r--r-- | src/MemberList.cpp | 12 | ||||
-rw-r--r-- | src/MemberList.h | 1 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.cpp | 8 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.h | 4 |
5 files changed, 20 insertions, 7 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp index 5edfaf09..ea034dd0 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -3584,8 +3584,6 @@ Cache::roomMembers(const std::string &room_id) crypto::Trust Cache::roomVerificationStatus(const std::string &room_id) { - std::string_view keys; - crypto::Trust trust = crypto::Verified; try { diff --git a/src/MemberList.cpp b/src/MemberList.cpp index 196647fe..0c0f0cdd 100644 --- a/src/MemberList.cpp +++ b/src/MemberList.cpp @@ -53,6 +53,7 @@ MemberList::roleNames() const {Mxid, "mxid"}, {DisplayName, "displayName"}, {AvatarUrl, "avatarUrl"}, + {Trustlevel, "trustlevel"}, }; } @@ -69,6 +70,17 @@ MemberList::data(const QModelIndex &index, int role) const return m_memberList[index.row()].first.display_name; case AvatarUrl: return m_memberList[index.row()].second; + case Trustlevel: { + auto stat = + cache::verificationStatus(m_memberList[index.row()].first.user_id.toStdString()); + + if (!stat) + return crypto::Unverified; + if (stat->unverified_device_count) + return crypto::Unverified; + else + return stat->user_verified; + } default: return {}; } diff --git a/src/MemberList.h b/src/MemberList.h index e6522694..cffcd83d 100644 --- a/src/MemberList.h +++ b/src/MemberList.h @@ -25,6 +25,7 @@ public: Mxid, DisplayName, AvatarUrl, + Trustlevel, }; MemberList(const QString &room_id, QObject *parent = nullptr); diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index b23ed278..906e328f 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -375,10 +375,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par } void -TimelineViewManager::openRoomMembers(QString room_id) +TimelineViewManager::openRoomMembers(TimelineModel *room) { - MemberList *memberList = new MemberList(room_id, this); - emit openRoomMembersDialog(memberList); + if (!room) + return; + MemberList *memberList = new MemberList(room->roomId(), this); + emit openRoomMembersDialog(memberList, room); } void diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 54e3a935..4dd5e996 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -66,7 +66,7 @@ public: Q_INVOKABLE QString userPresence(QString id) const; Q_INVOKABLE QString userStatus(QString id) const; - Q_INVOKABLE void openRoomMembers(QString room_id); + Q_INVOKABLE void openRoomMembers(TimelineModel *room); Q_INVOKABLE void openRoomSettings(QString room_id); Q_INVOKABLE void openInviteUsers(QString roomId); Q_INVOKABLE void openGlobalUserProfile(QString userId); @@ -92,7 +92,7 @@ signals: void focusChanged(); void focusInput(); void openImageOverlayInternalCb(QString eventId, QImage img); - void openRoomMembersDialog(MemberList *members); + void openRoomMembersDialog(MemberList *members, TimelineModel *room); void openRoomSettingsDialog(RoomSettings *settings); void openInviteUsersDialog(InviteesModel *invitees); void openProfile(UserProfile *profile); |