Comparison

plugins/pubsub.lua @ 468:fae5ae0ddb84

pubsub: Fire event on item retraction notifications
author Matthew Wild <mwild1@gmail.com>
date Fri, 17 Mar 2023 09:25:24 +0000
parent 438:98dc1750584d
child 490:6b2f31da9610
comparison
equal deleted inserted replaced
467:8e6a7a5e70b3 468:fae5ae0ddb84
21 for item in items:childtags("item") do 21 for item in items:childtags("item") do
22 stream:event("pubsub/event", { 22 stream:event("pubsub/event", {
23 from = m_from; 23 from = m_from;
24 node = node; 24 node = node;
25 item = item; 25 item = item;
26 });
27 end
28 for retract in items:childtags("retract") do
29 stream:event("pubsub/retraction", {
30 from = m_from;
31 node = node;
32 item = retract;
26 }); 33 });
27 end 34 end
28 end 35 end
29 end 36 end
30 end); 37 end);
242 error("Not implemented yet."); 249 error("Not implemented yet.");
243 end 250 end
244 251
245 function pubsub_node:items(full, callback) 252 function pubsub_node:items(full, callback)
246 if full then 253 if full then
247 self.stream:send_iq(pubsub_iq("get", self.service, nil, "items", self.node) 254 return self:item(nil, callback);
248 , callback);
249 else 255 else
250 self.stream:disco_items(self.service, self.node, callback); 256 self.stream:disco_items(self.service, self.node, callback);
251 end 257 end
252 end 258 end
253 259