diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-08-14 13:37:42 -0400 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-08-14 13:37:42 -0400 |
commit | edd757b55171720a07bc270cfb02e4a30934dfd2 (patch) | |
tree | 54deeebcfb08db71430a25e301b45c22ef01d31d | |
parent | b37b342dffe161785eefa41c0f43187e5be0271d (diff) | |
download | prosody-edd757b55171720a07bc270cfb02e4a30934dfd2.tar.gz prosody-edd757b55171720a07bc270cfb02e4a30934dfd2.zip |
mod_pubsub: Send node items to new subscribers
-rw-r--r-- | plugins/mod_pubsub.lua | 12 |
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) |