Mercurial > prosody-hg
comparison plugins/mod_pubsub.lua @ 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 | 225d46be7301 |
| children | 203137823046 |
comparison
equal
deleted
inserted
replaced
| 4341:225d46be7301 | 4342:735d39538944 |
|---|---|
| 128 reply:add_child(options_tag); | 128 reply:add_child(options_tag); |
| 129 end | 129 end |
| 130 else | 130 else |
| 131 reply = pubsub_error_reply(stanza, ret); | 131 reply = pubsub_error_reply(stanza, ret); |
| 132 end | 132 end |
| 133 return origin.send(reply); | 133 origin.send(reply); |
| 134 if ok then | |
| 135 -- Send all current items | |
| 136 local ok, items = service:get_items(node, stanza.attr.from); | |
| 137 if items then | |
| 138 local jids = { [jid] = options or true }; | |
| 139 for id, item in pairs(items) do | |
| 140 service.config.broadcaster(node, jids, item); | |
| 141 end | |
| 142 end | |
| 143 end | |
| 134 end | 144 end |
| 135 | 145 |
| 136 function handlers.set_unsubscribe(origin, stanza, unsubscribe) | 146 function handlers.set_unsubscribe(origin, stanza, unsubscribe) |
| 137 local node, jid = unsubscribe.attr.node, unsubscribe.attr.jid; | 147 local node, jid = unsubscribe.attr.node, unsubscribe.attr.jid; |
| 138 local ok, ret = service:remove_subscription(node, stanza.attr.from, jid); | 148 local ok, ret = service:remove_subscription(node, stanza.attr.from, jid); |
