Comparison

plugins/muc/mod_muc.lua @ 5335:bb81c13d2c6f

MUC: Always return <service-unavailable/> when a node is present in service discovery requests.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 26 Feb 2013 23:56:44 +0500
parent 5210:862a6fae05e7
child 5376:ba9be0be4bbb
comparison
equal deleted inserted replaced
5334:da7857891eb8 5335:bb81c13d2c6f
124 local origin, stanza = event.origin, event.stanza; 124 local origin, stanza = event.origin, event.stanza;
125 local type = stanza.attr.type; 125 local type = stanza.attr.type;
126 if type == "error" or type == "result" then return; end 126 if type == "error" or type == "result" then return; end
127 if stanza.name == "iq" and type == "get" then 127 if stanza.name == "iq" and type == "get" then
128 local xmlns = stanza.tags[1].attr.xmlns; 128 local xmlns = stanza.tags[1].attr.xmlns;
129 if xmlns == "http://jabber.org/protocol/disco#info" then 129 local node = stanza.tags[1].attr.node;
130 if xmlns == "http://jabber.org/protocol/disco#info" and not node then
130 origin.send(get_disco_info(stanza)); 131 origin.send(get_disco_info(stanza));
131 elseif xmlns == "http://jabber.org/protocol/disco#items" then 132 elseif xmlns == "http://jabber.org/protocol/disco#items" and not node then
132 origin.send(get_disco_items(stanza)); 133 origin.send(get_disco_items(stanza));
133 elseif xmlns == "http://jabber.org/protocol/muc#unique" then 134 elseif xmlns == "http://jabber.org/protocol/muc#unique" then
134 origin.send(st.reply(stanza):tag("unique", {xmlns = xmlns}):text(uuid_gen())); -- FIXME Random UUIDs can theoretically have collisions 135 origin.send(st.reply(stanza):tag("unique", {xmlns = xmlns}):text(uuid_gen())); -- FIXME Random UUIDs can theoretically have collisions
135 else 136 else
136 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- TODO disco/etc 137 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- TODO disco/etc