From 64440086ea5ee8d2f1726f2101ced46d4f08b929 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Thu, 28 Mar 2013 12:49:19 +0100
Subject: mod_privacy: Drop stanzas of type groupchat, so users aren't kicked
 from their chatrooms when blocking specific MUC occupants.

---
 plugins/mod_privacy.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua
index 7ec94922..dc6b153a 100644
--- a/plugins/mod_privacy.lua
+++ b/plugins/mod_privacy.lua
@@ -366,6 +366,10 @@ function checkIfNeedToBeBlocked(e, session)
 		end
 		if apply then
 			if block then
+				-- drop and not bounce groupchat messages, otherwise users will get kicked
+				if stanza.attr.type == "groupchat" then
+					return true;
+				end
 				module:log("debug", "stanza blocked: %s, to: %s, from: %s", tostring(stanza.name), tostring(to), tostring(from));
 				if stanza.name == "message" then
 					origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
-- 
cgit v1.2.3