From 62e5e6485e75df355226e3d48ee23ea11aff223f Mon Sep 17 00:00:00 2001 From: Samuel Hand Date: Mon, 28 May 2018 15:19:51 +0100 Subject: 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 --- xmpp-vala/src/module/xep/0380_explicit_encryption.vala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 xmpp-vala/src/module/xep/0380_explicit_encryption.vala (limited to 'xmpp-vala/src/module/xep') 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); +} + +} -- cgit v1.2.3-70-g09d2