aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_component.lua
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
commitc204694247ccaeffb4842d260f5e1a5fe0b9fe1e (patch)
tree0aa206d8055473407b16857c9f9d99c82e4935f5 /plugins/mod_component.lua
parentc33e8699c02ea861669e607e6fe1725db4822f1f (diff)
downloadprosody-c204694247ccaeffb4842d260f5e1a5fe0b9fe1e.tar.gz
prosody-c204694247ccaeffb4842d260f5e1a5fe0b9fe1e.zip
mod_component: For disconnected external components, if a name is specified in config, return it in disco#info replies.
Diffstat (limited to 'plugins/mod_component.lua')
-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"));