Debian Codegraph @

xmpp-vala/src/module/xep/0380_explicit_encryption.vala

raw
1 namespace Xmpp.Xep.ExplicitEncryption {
2 public const string NS_URI = "urn:xmpp:eme:0";
3
4 public static void add_encryption_tag_to_message(MessageStanza message, string ns, string? name = null) {
5 StanzaNode encryption = new StanzaNode.build("encryption", NS_URI).add_self_xmlns()
6 .put_attribute("namespace", ns);
7
8 if(name != null)
9 encryption.put_attribute("name", name);
10
11 message.stanza.put_node(encryption);
12 }
13
14 public static string? get_encryption_tag(MessageStanza message) {
15 StanzaNode? encryption_node = message.stanza.get_subnode("encryption", NS_URI);
16 if (encryption_node != null) {
17 return encryption_node.get_attribute("namespace", NS_URI);
18 }
19 return null;
20 }
21
22 }