summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2020-05-14 20:35:29 -0400
committerJoseph Donofry <joedonofry@gmail.com>2020-05-14 20:35:29 -0400
commit18f934efad19821bb2932ba687b2f3c42735add2 (patch)
treef1e8512ad44afa7325e4cf36b129037c8f604f06 /src/timeline
parentShow inline images (diff)
downloadnheko-18f934efad19821bb2932ba687b2f3c42735add2.tar.xz
Add un-encrypted warning icon for messages in encrypted rooms
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineModel.cpp5
-rw-r--r--src/timeline/TimelineModel.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index b7e90034..6e653f10 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -224,6 +224,7 @@ TimelineModel::roleNames() const
           {Id, "id"},
           {State, "state"},
           {IsEncrypted, "isEncrypted"},
+          {IsRoomEncrypted, "isRoomEncrypted"},
           {ReplyTo, "replyTo"},
           {Reactions, "reactions"},
           {RoomId, "roomId"},
@@ -350,6 +351,9 @@ TimelineModel::data(const QString &id, int role) const
                 return std::holds_alternative<
                   mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(events[id]);
         }
+        case IsRoomEncrypted: {
+                return cache::isRoomEncrypted(room_id_.toStdString());
+        }
         case ReplyTo:
                 return QVariant(QString::fromStdString(in_reply_to_event(event)));
         case Reactions:
@@ -387,6 +391,7 @@ TimelineModel::data(const QString &id, int role) const
                 m.insert(names[Id], data(id, static_cast<int>(Id)));
                 m.insert(names[State], data(id, static_cast<int>(State)));
                 m.insert(names[IsEncrypted], data(id, static_cast<int>(IsEncrypted)));
+                m.insert(names[IsRoomEncrypted], data(id, static_cast<int>(IsRoomEncrypted)));
                 m.insert(names[ReplyTo], data(id, static_cast<int>(ReplyTo)));
                 m.insert(names[RoomName], data(id, static_cast<int>(RoomName)));
                 m.insert(names[RoomTopic], data(id, static_cast<int>(RoomTopic)));
diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index a737aac7..0e9ddb72 100644
--- a/src/timeline/TimelineModel.h
+++ b/src/timeline/TimelineModel.h
@@ -157,6 +157,7 @@ public:
                 Id,
                 State,
                 IsEncrypted,
+                IsRoomEncrypted,
                 ReplyTo,
                 Reactions,
                 RoomId,