Changeset

468:fae5ae0ddb84

pubsub: Fire event on item retraction notifications
author Matthew Wild <mwild1@gmail.com>
date Fri, 17 Mar 2023 09:25:24 +0000
parents 467:8e6a7a5e70b3
children 469:b49d5df43a4c
files plugins/pubsub.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
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