Merge 0.9->trunk
[prosody.git] / plugins / mod_privacy.lua
index 2d696154cce03701c584f4692909fe61a2faf51a..dc6b153a46caff8cd41916ce84a26020d2f42653 100644 (file)
@@ -9,10 +9,9 @@
 
 module:add_feature("jabber:iq:privacy");
 
-local prosody = prosody;
 local st = require "util.stanza";
 local datamanager = require "util.datamanager";
-local bare_sessions, full_sessions = bare_sessions, full_sessions;
+local bare_sessions, full_sessions = prosody.bare_sessions, prosody.full_sessions;
 local util_Jid = require "util.jid";
 local jid_bare = util_Jid.bare;
 local jid_split, jid_join = util_Jid.split, util_Jid.join;
@@ -367,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"));