2017-03-11 22:04:58 +00:00
|
|
|
using Gee;
|
|
|
|
|
2017-03-02 14:37:32 +00:00
|
|
|
namespace Xmpp.Xep.PrivateXmlStorage {
|
|
|
|
private const string NS_URI = "jabber:iq:private";
|
|
|
|
|
|
|
|
public class Module : XmppStreamModule {
|
2017-03-19 11:55:36 +00:00
|
|
|
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0049_private_xml_storage");
|
2017-03-02 14:37:32 +00:00
|
|
|
|
2020-04-24 12:19:42 +00:00
|
|
|
public async void store(XmppStream stream, StanzaNode node) {
|
2017-03-02 14:37:32 +00:00
|
|
|
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
|
|
|
|
Iq.Stanza iq = new Iq.Stanza.set(queryNode);
|
2020-04-24 12:19:42 +00:00
|
|
|
yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
|
2017-03-02 14:37:32 +00:00
|
|
|
}
|
|
|
|
|
2020-04-24 12:19:42 +00:00
|
|
|
public async StanzaNode? retrieve(XmppStream stream, StanzaNode node) {
|
2017-03-02 14:37:32 +00:00
|
|
|
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
|
|
|
|
Iq.Stanza iq = new Iq.Stanza.get(queryNode);
|
2020-04-24 12:19:42 +00:00
|
|
|
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);
|
2017-03-02 14:37:32 +00:00
|
|
|
}
|
|
|
|
|
2017-08-12 21:27:20 +00:00
|
|
|
public override void attach(XmppStream stream) { }
|
2017-03-02 14:37:32 +00:00
|
|
|
|
|
|
|
public override void detach(XmppStream stream) { }
|
|
|
|
|
|
|
|
public override string get_ns() { return NS_URI; }
|
2017-03-19 11:55:36 +00:00
|
|
|
public override string get_id() { return IDENTITY.id; }
|
2017-03-02 14:37:32 +00:00
|
|
|
}
|
|
|
|
}
|