pubsub: Fire event on item retraction notifications

Fri, 17 Mar 2023 09:25:24 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 17 Mar 2023 09:25:24 +0000
changeset 468
fae5ae0ddb84
parent 467
8e6a7a5e70b3
child 469
b49d5df43a4c

pubsub: Fire event on item retraction notifications

plugins/pubsub.lua file | annotate | diff | comparison | revisions
--- a/plugins/pubsub.lua	Fri Mar 17 09:24:36 2023 +0000
+++ b/plugins/pubsub.lua	Fri Mar 17 09:25:24 2023 +0000
@@ -25,6 +25,13 @@
 						item = item;
 					});
 				end
+				for retract in items:childtags("retract") do
+					stream:event("pubsub/retraction", {
+						from = m_from;
+						node = node;
+						item = retract;
+					});
+				end
 			end
 		end
 	end);
@@ -244,8 +251,7 @@
 
 function pubsub_node:items(full, callback)
 	if full then
-		self.stream:send_iq(pubsub_iq("get", self.service, nil, "items", self.node)
-		, callback);
+		return self:item(nil, callback);
 	else
 		self.stream:disco_items(self.service, self.node, callback);
 	end

mercurial