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 | 25b8c1a92157113c3c24cf213a9de870bba7a311 (patch) | |
tree | a66f7fabe799f62646263766eb2668df974ff9e5 /plugins/mod_pubsub | |
parent | cde6dca2f7234e083c5adea70a7b0fd4a8aaf38e (diff) | |
download | prosody-25b8c1a92157113c3c24cf213a9de870bba7a311.tar.gz prosody-25b8c1a92157113c3c24cf213a9de870bba7a311.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; |