MUC: Prevent visitors from broadcasting messages.

Wed, 25 Nov 2009 21:42:05 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 25 Nov 2009 21:42:05 +0500
changeset 2212
f9af31dbfeb8
parent 2211
84dd0fada45b
child 2213
13375e6c4ecb

MUC: Prevent visitors from broadcasting messages.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Wed Nov 25 21:40:44 2009 +0500
+++ b/plugins/muc/muc.lib.lua	Wed Nov 25 21:42:05 2009 +0500
@@ -519,8 +519,11 @@
 		local from, to = stanza.attr.from, stanza.attr.to;
 		local room = jid_bare(to);
 		local current_nick = self._jid_nick[from];
-		if not current_nick then -- not in room
+		local occupant = self._occupants[current_nick];
+		if not occupant then -- not in room
 			origin.send(st.error_reply(stanza, "cancel", "not-acceptable"));
+		elseif occupant.role == "visitor" then
+			origin.send(st.error_reply(stanza, "cancel", "forbidden"));
 		else
 			local from = stanza.attr.from;
 			stanza.attr.from = current_nick;

mercurial