aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0367_message_attaching.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/0367_message_attaching.vala
parentaaf4542e6208460c305db4be36b15dc832ddc95a (diff)
downloaddino-79f792e090330a05753f9edb27332a946eb0840d.tar.gz
dino-79f792e090330a05753f9edb27332a946eb0840d.zip
Fix and improve stateless file-sharing
Diffstat (limited to 'xmpp-vala/src/module/xep/0367_message_attaching.vala')
-rw-r--r--xmpp-vala/src/module/xep/0367_message_attaching.vala15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmpp-vala/src/module/xep/0367_message_attaching.vala b/xmpp-vala/src/module/xep/0367_message_attaching.vala
new file mode 100644
index 00000000..7441cd19
--- /dev/null
+++ b/xmpp-vala/src/module/xep/0367_message_attaching.vala
@@ -0,0 +1,15 @@
+namespace Xmpp.Xep.MessageAttaching {
+ public const string NS_URI = "urn:xmpp:message-attaching:1";
+
+ public static string? get_attach_to(StanzaNode node) {
+ StanzaNode? attach_to = node.get_subnode("attach-to", NS_URI);
+ if (attach_to == null) return null;
+
+ return attach_to.get_attribute("id", NS_URI);
+ }
+
+ public static StanzaNode to_stanza_node(string id) {
+ return new StanzaNode.build("attach-to", NS_URI).add_self_xmlns()
+ .put_attribute("id", id, NS_URI);
+ }
+} \ No newline at end of file