aboutsummaryrefslogtreecommitdiff
path: root/main/src/plugins/openpgp/contact_details_provider.vala
diff options
context:
space:
mode:
authorfrosty <frostinator33@airmail.cc>2026-10-26 10:21:57 -0400
committerfrosty <frostinator33@airmail.cc>2026-10-26 10:21:57 -0400
commit74aecd8b0986d07b50b7ce310d64e645b8b54e38 (patch)
tree560e6434f183eb54cd779936f3a4c9575146a066 /main/src/plugins/openpgp/contact_details_provider.vala
parent3d7e90d401da02d430a87db0ec7e1db3a6f1a68f (diff)
parent4436001bb361ad4f9e4e05819214ecf0ea77c063 (diff)
Merge 'upstream/master'
Diffstat (limited to 'main/src/plugins/openpgp/contact_details_provider.vala')
-rw-r--r--main/src/plugins/openpgp/contact_details_provider.vala51
1 files changed, 51 insertions, 0 deletions
diff --git a/main/src/plugins/openpgp/contact_details_provider.vala b/main/src/plugins/openpgp/contact_details_provider.vala
new file mode 100644
index 00000000..353c0b85
--- /dev/null
+++ b/main/src/plugins/openpgp/contact_details_provider.vala
@@ -0,0 +1,51 @@
+using Gtk;
+
+using Dino.Entities;
+
+namespace Dino.Plugins.OpenPgp {
+
+public class ContactDetailsProvider : Plugins.ContactDetailsProvider, Object {
+ public string id { get { return "pgp_info"; } }
+ public string tab { get { return "encryption"; } }
+
+ private StreamInteractor stream_interactor;
+
+ public ContactDetailsProvider(StreamInteractor stream_interactor) {
+ this.stream_interactor = stream_interactor;
+ }
+
+ public void populate(Conversation conversation, Plugins.ContactDetails contact_details, WidgetType type) { }
+
+ public Object? get_widget(Conversation conversation) {
+ var preferences_group = new Adw.PreferencesGroup() { title="OpenPGP" };
+
+ if (conversation.type_ != Conversation.Type.CHAT) return null;
+
+ string? key_id = stream_interactor.get_module(Manager.IDENTITY).get_key_id(conversation.account, conversation.counterpart);
+ if (key_id == null) return null;
+
+ Gee.List<GPG.Key>? keys = null;
+ try {
+ keys = GPGHelper.get_keylist(key_id);
+ } catch (Error e) { }
+
+ var str = "";
+ if (keys != null && keys.size > 0) {
+ str = markup_id(keys[0].fpr, true);
+ } else {
+ str = _("Key not in keychain") + "\n" + markup_id(key_id, false);
+ }
+
+ var view = new Adw.ActionRow() {
+ title = _("Fingerprint"),
+ subtitle = str,
+ subtitle_selectable = true
+ };
+
+ preferences_group.add(view);
+
+ return preferences_group;
+ }
+}
+
+}