From edd757b55171720a07bc270cfb02e4a30934dfd2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 14 Aug 2011 13:37:42 -0400 Subject: mod_pubsub: Send node items to new subscribers --- plugins/mod_pubsub.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins/mod_pubsub.lua') diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua index 6564614c..7dac3b29 100644 --- a/plugins/mod_pubsub.lua +++ b/plugins/mod_pubsub.lua @@ -130,7 +130,17 @@ function handlers.set_subscribe(origin, stanza, subscribe) 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) -- cgit v1.2.3