aboutsummaryrefslogtreecommitdiff
path: root/plugins/openpgp/src/xmpp_flag.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-12 02:49:53 +0100
committerfiaxh <git@mx.ax.lt>2017-03-12 02:52:43 +0100
commit7e1ecb34cb1eca2b74949c7ddc2ad52fb02e3a77 (patch)
tree1a7a479efffafcf5098798fd5ce8d815bf4503a9 /plugins/openpgp/src/xmpp_flag.vala
parent63fffcddce49e231e82ee60aef4a23a16caa931e (diff)
downloaddino-7e1ecb34cb1eca2b74949c7ddc2ad52fb02e3a77.tar.gz
dino-7e1ecb34cb1eca2b74949c7ddc2ad52fb02e3a77.zip
Move PGP support into plugin
Diffstat (limited to 'plugins/openpgp/src/xmpp_flag.vala')
-rw-r--r--plugins/openpgp/src/xmpp_flag.vala25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/openpgp/src/xmpp_flag.vala b/plugins/openpgp/src/xmpp_flag.vala
new file mode 100644
index 00000000..5ace26bd
--- /dev/null
+++ b/plugins/openpgp/src/xmpp_flag.vala
@@ -0,0 +1,25 @@
+using Gee;
+
+using Xmpp;
+using Xmpp.Core;
+
+namespace Dino.Plugins.OpenPgp {
+
+public class Flag : XmppStreamFlag {
+ public const string ID = "pgp";
+ public HashMap<string, string> key_ids = new HashMap<string, string>();
+
+ public string? get_key_id(string jid) { return key_ids[get_bare_jid(jid)]; }
+
+ public void set_key_id(string jid, string key) { key_ids[get_bare_jid(jid)] = key; }
+
+ public static Flag? get_flag(XmppStream stream) { return (Flag?) stream.get_flag(NS_URI, ID); }
+
+ public static bool has_flag(XmppStream stream) { return get_flag(stream) != null; }
+
+ public override string get_ns() { return NS_URI; }
+
+ public override string get_id() { return ID; }
+}
+
+} \ No newline at end of file