aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-22 16:53:38 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-22 16:53:38 +0000
commit19f1881207ed14ad13c97d28e20b665d3c4ec09e (patch)
treed2ef02777c74486e09d6a7ef9f72b00d7ed83d94 /plugins
parent7513fb3ead3b5a6d4c4d790b64d1801643cea20d (diff)
downloadprosody-19f1881207ed14ad13c97d28e20b665d3c4ec09e.tar.gz
prosody-19f1881207ed14ad13c97d28e20b665d3c4ec09e.zip
mod_pubsub: Implement disco#info for nodes
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pubsub.lua19
1 files changed, 17 insertions, 2 deletions
diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua
index bbf16dd5..99f645a2 100644
--- a/plugins/mod_pubsub.lua
+++ b/plugins/mod_pubsub.lua
@@ -231,8 +231,23 @@ local function build_disco_info(service)
end
module:hook("iq-get/host/http://jabber.org/protocol/disco#info:query", function (event)
- event.origin.send(st.reply(event.stanza):add_child(disco_info));
- return true;
+ local origin, stanza = event.origin, event.stanza;
+ local node = stanza.tags[1].attr.node;
+ if not node then
+ return origin.send(st.reply(stanza):add_child(disco_info));
+ else
+ local ok, ret = service:get_nodes(stanza.attr.from);
+ if ok and not ret[node] then
+ ok, ret = false, "item-not-found";
+ end
+ if not ok then
+ return origin.send(pubsub_error_reply(stanza, ret));
+ end
+ local reply = st.reply(stanza)
+ :tag("query", { xmlns = "http://jabber.org/protocol/disco#info", node = node })
+ :tag("identity", { category = "pubsub", type = "leaf" });
+ return origin.send(reply);
+ end
end);
local function handle_disco_items_on_node(event)