Software /
code /
verse
Comparison
plugins/pubsub.lua @ 221:efb4f60ba36e
plugins.pubsub: implement node creation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 11 Oct 2011 13:26:11 +0200 |
parent | 193:fa6e1e65cb3c |
child | 222:3c257afd68e7 |
comparison
equal
deleted
inserted
replaced
220:5e5af66b03fd | 221:efb4f60ba36e |
---|---|
23 end | 23 end |
24 end | 24 end |
25 end | 25 end |
26 end); | 26 end); |
27 return true; | 27 return true; |
28 end | |
29 | |
30 function pubsub:create(server, node, callback) | |
31 local create = verse.iq({ to = server, type = "set" }) | |
32 :tag("pubsub", { xmlns = xmlns_pubsub }) | |
33 :tag("create", { node = node }):up() | |
34 self.stream:send_iq(create, function (result) | |
35 if callback then | |
36 if result.attr.type == "result" then | |
37 callback(true); | |
38 else | |
39 callback(false, result:get_error()); | |
40 end | |
41 end | |
42 end | |
43 ); | |
28 end | 44 end |
29 | 45 |
30 function pubsub:subscribe(server, node, jid, callback) | 46 function pubsub:subscribe(server, node, jid, callback) |
31 self.stream:send_iq(verse.iq({ to = server, type = "set" }) | 47 self.stream:send_iq(verse.iq({ to = server, type = "set" }) |
32 :tag("pubsub", { xmlns = xmlns_pubsub }) | 48 :tag("pubsub", { xmlns = xmlns_pubsub }) |