Debian Codegraph @

xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala

raw
1 using Xmpp;
2
3 namespace Xmpp.Xep.HttpSchemeForUrlData {
4 public const string NS_URI = "http://jabber.org/protocol/url-data";
5
6 // If there are multiple URLs, this will only return the first one
7 public static string? get_url(StanzaNode node) {
8 StanzaNode? url_data_node = node.get_subnode("url-data", NS_URI);
9 if (url_data_node == null) return null;
10
11 return url_data_node.get_attribute("target");
12 }
13
14 public static StanzaNode to_stanza_node(string url) {
15 return new StanzaNode.build("url-data", NS_URI).add_self_xmlns()
16 .put_attribute("target", url, NS_URI);
17
18 }
19 }