aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-08-01 01:36:13 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-08-01 01:36:13 +0500
commitd4b224bc0ae49c721391f2256396480bb2cc1566 (patch)
tree0aa206d8055473407b16857c9f9d99c82e4935f5
parent7f39ebc04c3d0e3ef98efc7c8eeb3baa01f88c43 (diff)
downloadprosody-d4b224bc0ae49c721391f2256396480bb2cc1566.tar.gz
prosody-d4b224bc0ae49c721391f2256396480bb2cc1566.zip
mod_component: For disconnected external components, if a name is specified in config, return it in disco#info replies.
-rw-r--r--plugins/mod_component.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index 751de59b..cff54f61 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -93,6 +93,18 @@ function module.add_host(module)
stanza.attr.xmlns = nil;
send(stanza);
else
+ if stanza.name == "iq" and stanza.attr.type == "get" and stanza.attr.to == module.host then
+ local query = stanza.tags[1];
+ local node = query.attr.node;
+ if query.name == "query" and query.attr.xmlns == "http://jabber.org/protocol/disco#info" and (not node or node == "") then
+ local name = module:get_option_string("name");
+ if name then
+ event.origin.send(st.reply(stanza):tag("query", { xmlns = "http://jabber.org/protocol/disco#info" })
+ :tag("identity", { category = "component", type = "generic", name = module:get_option_string("name", "Prosody") }))
+ return true;
+ end
+ end
+ end
module:log("warn", "Component not connected, bouncing error for: %s", stanza:top_tag());
if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
event.origin.send(st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable"));