aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/ui
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-03-28 14:46:51 +0100
committerfiaxh <git@lightrise.org>2020-03-29 20:24:39 +0200
commit1016529c36011ec881820b61778821ae4caa230a (patch)
tree554806e3691eb73febeb1f679cb1e14c5cfe884c /plugins/omemo/src/ui
parentc029da49bc20fdaf6da2788fbb83662ec9cf278e (diff)
downloaddino-1016529c36011ec881820b61778821ae4caa230a.tar.gz
dino-1016529c36011ec881820b61778821ae4caa230a.zip
Visually mark OMEMO messages from a trusted device as trusted
Diffstat (limited to 'plugins/omemo/src/ui')
-rw-r--r--plugins/omemo/src/ui/encryption_list_entry.vala20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/omemo/src/ui/encryption_list_entry.vala b/plugins/omemo/src/ui/encryption_list_entry.vala
index a4891442..aaec517f 100644
--- a/plugins/omemo/src/ui/encryption_list_entry.vala
+++ b/plugins/omemo/src/ui/encryption_list_entry.vala
@@ -1,12 +1,16 @@
+using Gtk;
+using Qlite;
using Xmpp;
namespace Dino.Plugins.Omemo {
public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
private Plugin plugin;
+ private Database db;
public EncryptionListEntry(Plugin plugin) {
this.plugin = plugin;
+ this.db = plugin.db;
}
public Entities.Encryption encryption { get {
@@ -17,6 +21,22 @@ public class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OMEMO";
}}
+ public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON2", 17, 12);
+
+ public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
+ if (content_item.encryption != encryption) return null;
+
+ RowOption row = db.content_item_meta.select( { db.identity_meta.trust_level } ).with(db.content_item_meta.content_item_id, "=", content_item.id)
+ .join_on(db.identity_meta, @"$(db.identity_meta.address_name)=$(db.content_item_meta.address_name) AND $(db.identity_meta.device_id)=$(db.content_item_meta.device_id)")
+ .single().row();
+
+
+ if (row.is_present() && (TrustLevel) row[db.identity_meta.trust_level] == TrustLevel.VERIFIED) {
+ return new Image.from_icon_name("dino-security-high-symbolic", ICON_SIZE_HEADER) { opacity=0.4, visible = true };
+ }
+ return null;
+ }
+
public void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) {
encryption_activated_async.begin(conversation, input_status_callback);
}