From f593ba0c191678898c32ffac249061af96dd47c8 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 26 Feb 2013 20:31:41 +0500 Subject: MUC: Fix affiliation check for admins, and bring it in line with the spec (thanks Maranda). --- plugins/muc/muc.lib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/muc') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 16a0238d..a48c9935 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -987,7 +987,7 @@ function room_mt:set_affiliation(actor, jid, affiliation, callback, reason) return true; end if actor_affiliation ~= "owner" then - if actor_affiliation ~= "admin" or target_affiliation == "owner" or target_affiliation == "admin" then + if affiliation == "owner" or affiliation == "admin" or actor_affiliation ~= "admin" or target_affiliation == "owner" or target_affiliation == "admin" then return nil, "cancel", "not-allowed"; end elseif target_affiliation == "owner" and jid_bare(actor) == jid then -- self change -- cgit v1.2.3 From 8fe41d1d853c9ab64d7e01582711c02c53f2967b Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Tue, 26 Feb 2013 23:56:44 +0500 Subject: MUC: Always return when a node is present in service discovery requests. --- plugins/muc/mod_muc.lua | 5 +++-- plugins/muc/muc.lib.lua | 10 +++------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'plugins/muc') diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 0df8b790..9f907f17 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -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 diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index a48c9935..91b4792d 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -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; -- cgit v1.2.3