aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-11-02 22:24:59 +0100
committerfiaxh <git@lightrise.org>2024-11-15 14:40:08 -0600
commit79f792e090330a05753f9edb27332a946eb0840d (patch)
tree5a6f1ad3ac0af0beea44ca9e83e7a9b052263025 /xmpp-vala/src/module/xep/0104_http_scheme_url_data.vala
parentaaf4542e6208460c305db4be36b15dc832ddc95a (diff)
downloaddino-79f792e090330a05753f9edb27332a946eb0840d.tar.gz
dino-79f792e090330a05753f9edb27332a946eb0840d.zip
Fix and improve stateless file-sharing
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