# HG changeset patch # User Kim Alvefur # Date 1531449739 -7200 # Node ID 029e1e18d65c9085bb91c7541f44f0b34c89cf6b # Parent d1a4b1b786957d5af4bab233ffbfe1d55a9d9d4b mod_pubsub: Add support for owner subscription retrieval https://xmpp.org/extensions/xep-0060.html#owner-subscriptions-retrieve diff -r d1a4b1b78695 -r 029e1e18d65c plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Fri Jul 13 04:41:59 2018 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Fri Jul 13 04:42:19 2018 +0200 @@ -250,6 +250,23 @@ 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;