aboutsummaryrefslogtreecommitdiff
path: root/plugins
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
parentc029da49bc20fdaf6da2788fbb83662ec9cf278e (diff)
downloaddino-1016529c36011ec881820b61778821ae4caa230a.tar.gz
dino-1016529c36011ec881820b61778821ae4caa230a.zip
Visually mark OMEMO messages from a trusted device as trusted
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo/src/ui/encryption_list_entry.vala20
-rw-r--r--plugins/openpgp/src/encryption_list_entry.vala7
2 files changed, 27 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);
}
diff --git a/plugins/openpgp/src/encryption_list_entry.vala b/plugins/openpgp/src/encryption_list_entry.vala
index 5b89ec1c..4169a2a2 100644
--- a/plugins/openpgp/src/encryption_list_entry.vala
+++ b/plugins/openpgp/src/encryption_list_entry.vala
@@ -1,4 +1,5 @@
using Gee;
+using Gtk;
using Dino.Entities;
using Xmpp;
@@ -23,6 +24,12 @@ private class EncryptionListEntry : Plugins.EncryptionListEntry, Object {
return "OpenPGP";
}}
+ public static IconSize ICON_SIZE_HEADER = Gtk.icon_size_register("im.dino.Dino.HEADER_ICON3", 17, 12);
+
+ public Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item) {
+ return null;
+ }
+
public void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus input_status_callback) {
try {
GPGHelper.get_public_key(db.get_account_key(conversation.account) ?? "");