aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0066_out_of_band_data.vala
blob: 804d406a89b29b4dbd1e728ecb6614280be51f04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using Xmpp.Core;

namespace Xmpp.Xep.OutOfBandData {

public const string NS_URI = "jabber:x:oob";

public static void add_url_to_message(Message.Stanza message, string url, string? desc = null) {
    message.stanza.put_node(new StanzaNode.build("x", NS_URI).add_self_xmlns().put_node(new StanzaNode.build("url", NS_URI).put_node(new StanzaNode.text(url))));
}

public static string? get_url_from_message(Message.Stanza message) {
    return message.stanza.get_deep_string_content(NS_URI + ":x", NS_URI + ":url");
}

}