Diff

plugins/muc/muc.lib.lua @ 3445:2fde9cb97f76

MUC: Return correct error to non-members attempting to enter a members-only room.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 03 Aug 2010 21:07:00 +0500
parent 3393:5b8de0731c4d
child 3446:9c0b3cd890e9
line wrap: on
line diff
--- 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";