aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-08-14 13:37:42 -0400
committerMatthew Wild <mwild1@gmail.com>2011-08-14 13:37:42 -0400
commitedd757b55171720a07bc270cfb02e4a30934dfd2 (patch)
tree54deeebcfb08db71430a25e301b45c22ef01d31d /plugins/mod_pubsub.lua
parentb37b342dffe161785eefa41c0f43187e5be0271d (diff)
downloadprosody-edd757b55171720a07bc270cfb02e4a30934dfd2.tar.gz
prosody-edd757b55171720a07bc270cfb02e4a30934dfd2.zip
mod_pubsub: Send node items to new subscribers
Diffstat (limited to 'plugins/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub.lua12
1 files changed, 11 insertions, 1 deletions
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)