From 79f792e090330a05753f9edb27332a946eb0840d Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 2 Nov 2024 22:24:59 +0100 Subject: Fix and improve stateless file-sharing --- xmpp-vala/src/module/xep/0367_message_attaching.vala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 xmpp-vala/src/module/xep/0367_message_attaching.vala (limited to 'xmpp-vala/src/module/xep/0367_message_attaching.vala') 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 -- cgit v1.2.3-70-g09d2