trunk
changeset 5081:c0c060e450be
hostmanager, mod_disco: Show optional 'name' option from the config in disco#items queries (fixes use-case in #292) (thanks diSabler, mva)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 05 Aug 2012 17:18:35 +0100 |
| parents | 6c2c8bf36d22 |
| children | 1ffc788c5696 |
| files | core/hostmanager.lua plugins/mod_disco.lua |
| diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/core/hostmanager.lua Fri Aug 03 14:07:41 2012 +0100 1.2 +++ b/core/hostmanager.lua Sun Aug 05 17:18:35 2012 +0100 1.3 @@ -84,7 +84,7 @@ 1.4 end 1.5 hosts[host] = host_session; 1.6 if not host:match("[@/]") then 1.7 - disco_items:set(host:match("%.(.*)") or "*", host, true); 1.8 + disco_items:set(host:match("%.(.*)") or "*", host, host_config.core.name or true); 1.9 end 1.10 for option_name in pairs(host_config.core) do 1.11 if option_name:match("_ports$") or option_name:match("_interface$") then
2.1 --- a/plugins/mod_disco.lua Fri Aug 03 14:07:41 2012 +0100 2.2 +++ b/plugins/mod_disco.lua Sun Aug 05 17:18:35 2012 +0100 2.3 @@ -111,8 +111,8 @@ 2.4 if node and node ~= "" then return; end -- TODO fire event? 2.5 2.6 local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items"); 2.7 - for jid in pairs(get_children(module.host)) do 2.8 - reply:tag("item", {jid = jid}):up(); 2.9 + for jid, name in pairs(get_children(module.host)) do 2.10 + reply:tag("item", {jid = jid, name = name~=true and name or nil}):up(); 2.11 end 2.12 for _, item in ipairs(disco_items) do 2.13 reply:tag("item", {jid=item[1], name=item[2]}):up();
