Comparison

plugins/mod_disco.lua @ 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
parent 4985:0f72123ff513
child 5627:0439d1349dc1
child 8002:57060d0cee4b
comparison
equal deleted inserted replaced
5077:6c2c8bf36d22 5081:c0c060e450be
109 if stanza.attr.type ~= "get" then return; end 109 if stanza.attr.type ~= "get" then return; end
110 local node = stanza.tags[1].attr.node; 110 local node = stanza.tags[1].attr.node;
111 if node and node ~= "" then return; end -- TODO fire event? 111 if node and node ~= "" then return; end -- TODO fire event?
112 112
113 local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items"); 113 local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items");
114 for jid in pairs(get_children(module.host)) do 114 for jid, name in pairs(get_children(module.host)) do
115 reply:tag("item", {jid = jid}):up(); 115 reply:tag("item", {jid = jid, name = name~=true and name or nil}):up();
116 end 116 end
117 for _, item in ipairs(disco_items) do 117 for _, item in ipairs(disco_items) do
118 reply:tag("item", {jid=item[1], name=item[2]}):up(); 118 reply:tag("item", {jid=item[1], name=item[2]}):up();
119 end 119 end
120 origin.send(reply); 120 origin.send(reply);