mod_muc_rtbl: Skip check if user has any explicit affiliation with the MUC
authorMatthew Wild <mwild1@gmail.com>
Mon, 06 Dec 2021 12:24:07 +0000
changeset 4814 181738ae4117
parent 4813 9e9ec0f0b128
child 4815 a1fe59c06c48
mod_muc_rtbl: Skip check if user has any explicit affiliation with the MUC
mod_muc_rtbl/mod_muc_rtbl.lua
--- a/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 12:02:45 2021 +0000
+++ b/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 12:24:07 2021 +0000
@@ -93,6 +93,13 @@
 
 module:hook("muc-occupant-pre-join", function (event)
 	local from_bare = jid.bare(event.stanza.attr.from);
+
+	local affiliation = event.room:get_affiliation(from_bare);
+	if affiliation and affilition ~= "none" then
+		-- Skip check for affiliated users
+		return;
+	end
+
 	local hash = sha256(jid.bare(event.stanza.attr.from), true);
 	if banned_hashes[hash] then
 		module:log("info", "Blocked user <%s> from room <%s> due to RTBL match", from_bare, event.stanza.attr.to);