aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-11-25 21:42:05 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-11-25 21:42:05 +0500
commite3c1d3f2c74ba92b1b2bb858b4e2810d78afebcf (patch)
tree2978cef56c1aac3267846569a394148bb17a6e88
parent24bd0394c83f8741278306eb3ba4483916aef7b0 (diff)
downloadprosody-e3c1d3f2c74ba92b1b2bb858b4e2810d78afebcf.tar.gz
prosody-e3c1d3f2c74ba92b1b2bb858b4e2810d78afebcf.zip
MUC: Prevent visitors from broadcasting messages.
-rw-r--r--plugins/muc/muc.lib.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 0fb5223d..7907c0c3 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -519,8 +519,11 @@ function room_mt:handle_to_room(origin, stanza) -- presence changes and groupcha
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;