From 9840774a87b9d15523ecc04ee4c157270e9abfe5 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 13 May 2017 17:48:13 +0200 Subject: omemo: store and display identity keys of all devices --- plugins/omemo/src/contact_details_provider.vala | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/omemo/src/contact_details_provider.vala (limited to 'plugins/omemo/src/contact_details_provider.vala') diff --git a/plugins/omemo/src/contact_details_provider.vala b/plugins/omemo/src/contact_details_provider.vala new file mode 100644 index 00000000..8155424d --- /dev/null +++ b/plugins/omemo/src/contact_details_provider.vala @@ -0,0 +1,37 @@ +using Gtk; +using Qlite; +using Dino.Entities; + +namespace Dino.Plugins.Omemo { + +public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object { + public string id { get { return "omemo_info"; } } + + private Plugin plugin; + + public ContactDetailsProvider(Plugin plugin) { + this.plugin = plugin; + } + + public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) { + if (conversation.type_ == Conversation.Type.CHAT && type == WidgetType.GTK) { + string res = ""; + int i = 0; + foreach (Row row in plugin.db.identity_meta.with_address(conversation.counterpart.to_string())) { + if (row[plugin.db.identity_meta.identity_key_public_base64] != null) { + if (i != 0) { + res += "\n\n"; + } + res += fingerprint_markup(fingerprint_from_base64(row[plugin.db.identity_meta.identity_key_public_base64])); + i++; + } + } + if (i > 0) { + Label label = new Label(res) { use_markup=true, justify=Justification.RIGHT, selectable=true, visible=true }; + contact_details.add(_("Encryption"), _("OMEMO"), n("%d OMEMO device", "%d OMEMO devices", i).printf(i), label); + } + } + } +} + +} -- cgit v1.3