aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-02-16 20:05:58 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-02-16 20:05:58 +0500
commit11b1d563ce87237008b1323869e049a1a1988fe1 (patch)
tree905f18655530fd42802e086357bcaa09b8a9fc9b
parente635b213dfa37d9b122177f2699b6e8a0079968d (diff)
downloadprosody-11b1d563ce87237008b1323869e049a1a1988fe1.tar.gz
prosody-11b1d563ce87237008b1323869e049a1a1988fe1.zip
MUC: Kick participants sending error messages to other participants
-rw-r--r--plugins/mod_muc.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua
index 7c6d283c..36ea0477 100644
--- a/plugins/mod_muc.lua
+++ b/plugins/mod_muc.lua
@@ -329,9 +329,19 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc
end
elseif not current_nick then -- not in room
origin.send(st.error_reply(stanza, "cancel", "not-acceptable"));
- elseif stanza.name == "message" and type == "groupchat" then
- -- groupchat messages not allowed in PM
+ elseif stanza.name == "message" and type == "groupchat" then -- groupchat messages not allowed in PM
origin.send(st.error_reply(stanza, "modify", "bad-request"));
+ elseif stanza.name == "message" and type == "error" then
+ if current_nick then
+ local data = rooms:get(room, to);
+ data.role = 'none';
+ local pr = st.presence({type='unavailable', from=current_nick}):tag('status'):text('This participant is kicked from the room because he sent an error message to another occupant'):up()
+ :tag("x", {xmlns='http://jabber.org/protocol/muc#user'})
+ :tag("item", {affiliation=data.affiliation, role=data.role}):up();
+ broadcast_presence_stanza(room, pr);
+ rooms:remove(room, to);
+ jid_nick:remove(from, room);
+ end
else -- private stanza
local o_data = rooms:get(room, to);
if o_data then