MUC: Always return <service-unavailable/> when a node is present in service discovery...
authorWaqas Hussain <waqas20@gmail.com>
Tue, 26 Feb 2013 18:56:44 +0000 (23:56 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Tue, 26 Feb 2013 18:56:44 +0000 (23:56 +0500)
plugins/muc/mod_muc.lua
plugins/muc/muc.lib.lua

index 0df8b790794d2e7e40b43e7269f082015218d484..9f907f172736ac063988951c436588d83a5bc1ee 100644 (file)
@@ -126,9 +126,10 @@ local function handle_to_domain(event)
        if type == "error" or type == "result" then return; end
        if stanza.name == "iq" and type == "get" then
                local xmlns = stanza.tags[1].attr.xmlns;
-               if xmlns == "http://jabber.org/protocol/disco#info" then
+               local node = stanza.tags[1].attr.node;
+               if xmlns == "http://jabber.org/protocol/disco#info" and not node then
                        origin.send(get_disco_info(stanza));
-               elseif xmlns == "http://jabber.org/protocol/disco#items" then
+               elseif xmlns == "http://jabber.org/protocol/disco#items" and not node then
                        origin.send(get_disco_items(stanza));
                elseif xmlns == "http://jabber.org/protocol/muc#unique" then
                        origin.send(st.reply(stanza):tag("unique", {xmlns = xmlns}):text(uuid_gen())); -- FIXME Random UUIDs can theoretically have collisions
index a48c993513e7f4d9f1037e11d5dd9b43b5684ca2..91b4792d9d30fb72539ea69fc1a4272debd0b5f1 100644 (file)
@@ -765,13 +765,9 @@ function room_mt:handle_to_room(origin, stanza) -- presence changes and groupcha
        local type = stanza.attr.type;
        local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
        if stanza.name == "iq" then
-               if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" then
-                       if stanza.tags[1].attr.node then
-                               origin.send(st.error_reply(stanza, "cancel", "feature-not-implemented"));
-                       else
-                               origin.send(self:get_disco_info(stanza));
-                       end
-               elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" then
+               if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" and not stanza.tags[1].attr.node then
+                       origin.send(self:get_disco_info(stanza));
+               elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" and not stanza.tags[1].attr.node then
                        origin.send(self:get_disco_items(stanza));
                elseif xmlns == "http://jabber.org/protocol/muc#admin" then
                        local actor = stanza.attr.from;