MUC: Return correct error to non-members attempting to enter a members-only room.

Tue, 03 Aug 2010 21:07:00 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Tue, 03 Aug 2010 21:07:00 +0500
changeset 3445
2fde9cb97f76
parent 3444
e6a78e15fed2
child 3446
9c0b3cd890e9

MUC: Return correct error to non-members attempting to enter a members-only room.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Tue Aug 03 20:05:58 2010 +0500
+++ b/plugins/muc/muc.lib.lua	Tue Aug 03 21:07:00 2010 +0500
@@ -432,6 +432,10 @@
 								:tag("status", {code='110'}));
 						end
 						self:send_history(from, stanza);
+					elseif not affiliation then -- registration required for entering members-only room
+						local reply = st.error_reply(stanza, "auth", "registration-required"):up();
+						reply.tags[1].attr.code = "407";
+						origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
 					else -- banned
 						local reply = st.error_reply(stanza, "auth", "forbidden"):up();
 						reply.tags[1].attr.code = "403";

mercurial