aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0367_message_attaching.vala
blob: 7441cd1996a652ab20cd0a8c509cec030d9e490a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
    }
}