Changeset

1996:3e6b36c6d7b7

MUC: Kick occupants on sending error messages to other occupants.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 18 Oct 2009 05:35:33 +0500
parents 1995:03ecc636af1e
children 1997:c70ee886e309
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Sun Oct 18 05:19:40 2009 +0500
+++ b/plugins/muc/muc.lib.lua	Sun Oct 18 05:35:33 2009 +0500
@@ -351,6 +351,10 @@
 		end
 	elseif stanza.name == "message" and type == "groupchat" then -- groupchat messages not allowed in PM
 		origin.send(st.error_reply(stanza, "modify", "bad-request"));
+	elseif current_nick and stanza.name == "message" and type == "error" and get_kickable_error(stanza) then
+		log("debug", "%s kicked from %s for sending an error message", current_nick, self.jid);
+		self:handle_to_occupant(origin, st.presence({type='unavailable', from=stanza.attr.from, to=stanza.attr.to})
+			:tag('status'):text('This participant is kicked from the room because he sent an error message to another occupant')); -- send unavailable
 	else -- private stanza
 		local o_data = self._occupants[to];
 		if o_data then