aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala')
-rw-r--r--xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala19
1 files changed, 19 insertions, 0 deletions
diff --git a/xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala b/xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala
new file mode 100644
index 00000000..b177a1ef
--- /dev/null
+++ b/xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala
@@ -0,0 +1,19 @@
+using Xmpp;
+
+namespace Xmpp.Xep.HttpSchemeForUrlData {
+ public const string NS_URI = "http://jabber.org/protocol/url-data";
+
+ // If there are multiple URLs, this will only return the first one
+ public static string? get_url(StanzaNode node) {
+ StanzaNode? url_data_node = node.get_subnode("url-data", NS_URI);
+ if (url_data_node == null) return null;
+
+ return url_data_node.get_attribute("target");
+ }
+
+ public static StanzaNode to_stanza_node(string url) {
+ return new StanzaNode.build("url-data", NS_URI).add_self_xmlns()
+ .put_attribute("target", url, NS_URI);
+
+ }
+} \ No newline at end of file