Changeset

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
parents 5334:da7857891eb8
children 5336:eeb24f1e2c84
files plugins/muc/mod_muc.lua plugins/muc/muc.lib.lua
diffstat 2 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Tue Feb 26 20:31:41 2013 +0500
+++ b/plugins/muc/mod_muc.lua	Tue Feb 26 23:56:44 2013 +0500
@@ -126,9 +126,10 @@
 	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
--- a/plugins/muc/muc.lib.lua	Tue Feb 26 20:31:41 2013 +0500
+++ b/plugins/muc/muc.lib.lua	Tue Feb 26 23:56:44 2013 +0500
@@ -765,13 +765,9 @@
 	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;