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
commitdcba4da36a7bfe0b56b52293ccfc37e098d76746 (patch)
tree54deeebcfb08db71430a25e301b45c22ef01d31d /plugins/mod_pubsub.lua
parent01150f8e2891dbdff7ed2ea08615965fe14d603f (diff)
downloadprosody-dcba4da36a7bfe0b56b52293ccfc37e098d76746.tar.gz
prosody-dcba4da36a7bfe0b56b52293ccfc37e098d76746.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)