# HG changeset patch # User Waqas Hussain # Date 1343766973 -18000 # Node ID 246ba539a5cd06bcb7b500647b677bd3e369c74d # Parent 433cc9a4c7e916850a66d9e416921b163a1de23f mod_component: For disconnected external components, if a name is specified in config, return it in disco#info replies. diff -r 433cc9a4c7e9 -r 246ba539a5cd plugins/mod_component.lua --- a/plugins/mod_component.lua Wed Aug 01 01:36:11 2012 +0500 +++ b/plugins/mod_component.lua Wed Aug 01 01:36:13 2012 +0500 @@ -93,6 +93,18 @@ 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"));