aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-22 03:49:52 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-22 03:49:52 +0000
commit1d8be7498d04ac65eafbb81c6729634920b3d571 (patch)
treee7bebf1c8b0c66ecfe66cb5d1117eb4d9ecc787e /plugins
parent85236d58c98aec549e587597f0d7e866f4404161 (diff)
downloadprosody-1d8be7498d04ac65eafbb81c6729634920b3d571.tar.gz
prosody-1d8be7498d04ac65eafbb81c6729634920b3d571.zip
mod_pubsub: Implement get_subscriptions
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pubsub.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua
index bb2f0059..bbf16dd5 100644
--- a/plugins/mod_pubsub.lua
+++ b/plugins/mod_pubsub.lua
@@ -67,6 +67,20 @@ function handlers.get_items(origin, stanza, items)
return origin.send(reply);
end
+function handlers.get_subscriptions(origin, stanza, subscriptions)
+ local node = subscriptions.attr.node;
+ local ok, ret = service:get_subscriptions(node, stanza.attr.from, stanza.attr.from);
+ if not ok then
+ return origin.send(pubsub_error_reply(stanza, ret));
+ end
+ local reply = st.reply(stanza)
+ :tag("subscriptions", { xmlns = xmlns_pubsub });
+ for _, sub in ipairs(ret) do
+ reply:tag("subscription", { node = sub.node, jid = sub.jid, subscription = 'subscribed' }):up();
+ end
+ return origin.send(reply);
+end
+
function handlers.set_create(origin, stanza, create)
local node = create.attr.node;
local ok, ret, reply;