blob: 81ccde9b492f1d1f0c5f5d6a9c82414965be982c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using Gee;
namespace Xmpp.Xep.PrivateXmlStorage {
private const string NS_URI = "jabber:iq:private";
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0049_private_xml_storage");
public async void store(XmppStream stream, StanzaNode node) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.set(queryNode);
yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
}
public async StanzaNode? retrieve(XmppStream stream, StanzaNode node) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.get(queryNode);
Iq.Stanza iq_result = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
return iq_result.stanza.get_subnode("query", NS_URI);
}
public override void attach(XmppStream stream) { }
public override void detach(XmppStream stream) { }
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
}
}
|