aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
authorSamuel Hand <sdhand@users.noreply.github.com>2018-05-28 15:19:51 +0100
committerfiaxh <fiaxh@users.noreply.github.com>2018-05-28 16:19:51 +0200
commit62e5e6485e75df355226e3d48ee23ea11aff223f (patch)
tree0dd41573e658aa1d377bfa4b257ad3f857bc5a3f /xmpp-vala
parent5425243203cbf5f86b33c4014c5aa787c6aae856 (diff)
downloaddino-62e5e6485e75df355226e3d48ee23ea11aff223f.tar.gz
dino-62e5e6485e75df355226e3d48ee23ea11aff223f.zip
Implement XEP-0380 for the OMEMO and OpenPGP plugins (#359)
* Implement XEP-0380 in a naive fashion for both the OMEMO and OpenPGP plugins * Move the XEP-0380 namespace to a constant * Move the implementation for xep-0380 to its own module * Remove un-needed lines from plugins/openpgp/src/stream_module.vala
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/CMakeLists.txt1
-rw-r--r--xmpp-vala/src/module/xep/0380_explicit_encryption.vala14
2 files changed, 15 insertions, 0 deletions
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 3190fad0..6734f0ee 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -68,6 +68,7 @@ SOURCES
"src/module/xep/0313_message_archive_management.vala"
"src/module/xep/0333_chat_markers.vala"
"src/module/xep/0368_srv_records_tls.vala"
+ "src/module/xep/0380_explicit_encryption.vala"
"src/module/xep/pixbuf_storage.vala"
PACKAGES
${ENGINE_PACKAGES}
diff --git a/xmpp-vala/src/module/xep/0380_explicit_encryption.vala b/xmpp-vala/src/module/xep/0380_explicit_encryption.vala
new file mode 100644
index 00000000..710da92d
--- /dev/null
+++ b/xmpp-vala/src/module/xep/0380_explicit_encryption.vala
@@ -0,0 +1,14 @@
+namespace Xmpp.Xep.ExplicitEncryption {
+public const string NS_URI = "urn:xmpp:eme:0";
+
+public static void add_encryption_tag_to_message(MessageStanza message, string ns, string? name = null) {
+ StanzaNode encryption = new StanzaNode.build("encryption", NS_URI).add_self_xmlns()
+ .put_attribute("namespace", ns);
+
+ if(name != null)
+ encryption.put_attribute("name", name);
+
+ message.stanza.put_node(encryption);
+}
+
+}