diff options
| author | Marvin W <git@larma.de> | 2026-10-04 14:42:16 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2026-10-23 16:59:59 +0200 |
| commit | dba577f39c489b9db29960f2bf5cc78ac4f29d7b (patch) | |
| tree | a8354c9fc328c1442d5e8c5c2adec4b428c92f44 /main/src/plugins/omemo/ui/call_encryption_entry.vala | |
| parent | 2413442905e31f34cb0f77c9167003b3725760fe (diff) | |
Move OMEMO, OpenPGP and RTP plugins into main/libdino
Diffstat (limited to 'main/src/plugins/omemo/ui/call_encryption_entry.vala')
| -rw-r--r-- | main/src/plugins/omemo/ui/call_encryption_entry.vala | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/main/src/plugins/omemo/ui/call_encryption_entry.vala b/main/src/plugins/omemo/ui/call_encryption_entry.vala new file mode 100644 index 00000000..04f0443c --- /dev/null +++ b/main/src/plugins/omemo/ui/call_encryption_entry.vala @@ -0,0 +1,58 @@ +using Gtk; + +using Dino.Entities; +using Dino.Qlite; +using Xmpp; + +namespace Dino.Plugins.Omemo { + + public class CallEncryptionEntry : Plugins.CallEncryptionEntry, Object { + private Database db; + + public CallEncryptionEntry(Database db) { + this.db = db; + } + + public Plugins.CallEncryptionWidget? get_widget(Account account, Xmpp.Xep.Jingle.ContentEncryption encryption) { + DtlsSrtpVerificationDraft.OmemoContentEncryption? omemo_encryption = encryption as DtlsSrtpVerificationDraft.OmemoContentEncryption; + if (omemo_encryption == null) return null; + + int identity_id = db.identity.get_id(account.id); + Row? device = db.identity_meta.get_device(identity_id, omemo_encryption.jid.to_string(), omemo_encryption.sid); + if (device == null) return null; + TrustLevel trust = (TrustLevel) device[db.identity_meta.trust_level]; + + return new CallEncryptionWidget(trust); + } + } + + public class CallEncryptionWidget : Plugins.CallEncryptionWidget, Object { + + string? title = null; + string? icon = null; + bool should_show_keys = false; + + public CallEncryptionWidget(TrustLevel trust) { + if (trust == TrustLevel.VERIFIED) { + title = "This call is <b>encrypted and verified</b> with OMEMO."; + icon = "dino-security-high-symbolic"; + should_show_keys = false; + } else { + title = "This call is encrypted with OMEMO."; + should_show_keys = true; + } + } + + public string? get_title() { + return title; + } + + public string? get_icon_name() { + return icon; + } + + public bool show_keys() { + return should_show_keys; + } + } +} |
