summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-08-13 23:13:09 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-08-13 23:19:54 +0200
commit18ea01e198d112de00ac70e1e1c357424706d10a (patch)
tree356bcdbebb2acbf639392c98589a03b979fec9f5 /src/timeline
parentFix lambda to function pointer in coeurl on Linux (diff)
downloadnheko-18ea01e198d112de00ac70e1e1c357424706d10a.tar.xz
Show if there are unverified devices in a room
Also fixes some issues where nested transactions will poison the
verification cache.
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp17
-rw-r--r--src/timeline/TimelineModel.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 513f08bc..79c28edf 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -418,6 +418,14 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
                 &events,
                 &EventStore::enableKeyRequests);
 
+        connect(this, &TimelineModel::encryptionChanged, this, &TimelineModel::trustlevelChanged);
+        connect(
+          this, &TimelineModel::roomMemberCountChanged, this, &TimelineModel::trustlevelChanged);
+        connect(cache::client(),
+                &Cache::verificationStatusChanged,
+                this,
+                &TimelineModel::trustlevelChanged);
+
         showEventTimer.callOnTimeout(this, &TimelineModel::scrollTimerEvent);
 }
 
@@ -1993,6 +2001,15 @@ TimelineModel::roomTopic() const
                   QString::fromStdString(info[room_id_].topic).toHtmlEscaped()));
 }
 
+crypto::Trust
+TimelineModel::trustlevel() const
+{
+        if (!isEncrypted_)
+                return crypto::Trust::Unverified;
+
+        return cache::client()->roomVerificationStatus(room_id_.toStdString());
+}
+
 int
 TimelineModel::roomMemberCount() const
 {
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index ad7cfbbb..aa07fe01 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -175,6 +175,7 @@ class TimelineModel : public QAbstractListModel
         Q_PROPERTY(int roomMemberCount READ roomMemberCount NOTIFY roomMemberCountChanged)
         Q_PROPERTY(bool isEncrypted READ isEncrypted NOTIFY encryptionChanged)
         Q_PROPERTY(bool isSpace READ isSpace CONSTANT)
+        Q_PROPERTY(int trustlevel READ trustlevel NOTIFY trustlevelChanged)
         Q_PROPERTY(InputBar *input READ input CONSTANT)
         Q_PROPERTY(Permissions *permissions READ permissions NOTIFY permissionsChanged)
 
@@ -287,6 +288,7 @@ public:
         DescInfo lastMessage() const { return lastMessage_; }
         bool isSpace() const { return isSpace_; }
         bool isEncrypted() const { return isEncrypted_; }
+        crypto::Trust trustlevel() const;
         int roomMemberCount() const;
 
 public slots:
@@ -372,6 +374,7 @@ signals:
         void updateFlowEventId(std::string event_id);
 
         void encryptionChanged();
+        void trustlevelChanged();
         void roomNameChanged();
         void plainRoomNameChanged();
         void roomTopicChanged();