Software /
code /
prosody
Diff
plugins/mod_component.lua @ 5059:246ba539a5cd
mod_component: For disconnected external components, if a name is specified in config, return it in disco#info replies.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 01 Aug 2012 01:36:13 +0500 |
parent | 5013:ab693eea0869 |
child | 5120:bcabea740c00 |
line wrap: on
line diff
--- 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"));