diff options
author | Kim Alvefur <zash@zash.se> | 2018-07-13 04:42:19 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-07-13 04:42:19 +0200 |
commit | e18193a4ffec3a0f8351827823a04425e7956a39 (patch) | |
tree | a66f7fabe799f62646263766eb2668df974ff9e5 /plugins/mod_pubsub | |
parent | fc5c354891511953236276cfffa4d4d07c278c4d (diff) | |
download | prosody-e18193a4ffec3a0f8351827823a04425e7956a39.tar.gz prosody-e18193a4ffec3a0f8351827823a04425e7956a39.zip |
mod_pubsub: Add support for owner subscription retrieval
https://xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 0fadd6e7..f10c593f 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -250,6 +250,23 @@ function handlers.get_subscriptions(origin, stanza, subscriptions, service) return true; end +function handlers.owner_get_subscriptions(origin, stanza, subscriptions, service) + local node = subscriptions.attr.node; + local ok, ret = service:get_subscriptions(node, stanza.attr.from); + if not ok then + origin.send(pubsub_error_reply(stanza, ret)); + return true; + end + local reply = st.reply(stanza) + :tag("pubsub", { xmlns = xmlns_pubsub_owner }) + :tag("subscriptions"); + for _, sub in ipairs(ret) do + reply:tag("subscription", { node = sub.node, jid = sub.jid, subscription = 'subscribed' }):up(); + end + origin.send(reply); + return true; +end + function handlers.set_create(origin, stanza, create, service) local node = create.attr.node; local ok, ret, reply; |