blob: 69b7b686b1d1481d0f68bf5589b42b7418a0e749 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using Dino.Entities;
using Gtk;
using 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;
}
}
}
|