Changeset

4342:735d39538944

mod_pubsub: Send node items to new subscribers
author Matthew Wild <mwild1@gmail.com>
date Sun, 14 Aug 2011 13:37:42 -0400
parents 4341:225d46be7301
children 4343:203137823046
files plugins/mod_pubsub.lua
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub.lua	Sun Aug 14 13:37:08 2011 -0400
+++ b/plugins/mod_pubsub.lua	Sun Aug 14 13:37:42 2011 -0400
@@ -130,7 +130,17 @@
 	else
 		reply = pubsub_error_reply(stanza, ret);
 	end
-	return origin.send(reply);
+	origin.send(reply);
+	if ok then
+		-- Send all current items
+		local ok, items = service:get_items(node, stanza.attr.from);
+		if items then
+			local jids = { [jid] = options or true };
+			for id, item in pairs(items) do
+				service.config.broadcaster(node, jids, item);
+			end
+		end
+	end
 end
 
 function handlers.set_unsubscribe(origin, stanza, unsubscribe)