changeset 4810:181738ae4117

mod_muc_rtbl: Skip check if user has any explicit affiliation with the MUC
author Matthew Wild <mwild1@gmail.com>
date Mon, 06 Dec 2021 12:24:07 +0000
parents 9e9ec0f0b128
children a1fe59c06c48
files mod_muc_rtbl/mod_muc_rtbl.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);