Diff

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
line wrap: on
line diff
--- 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