Software /
code /
prosody-modules
Diff
mod_muc_rtbl/mod_muc_rtbl.lua @ 5176:4791e0412ff3
mod_muc_rtbl: ignore blocklist for affiliated users for messages
Just like we ignore the blocklist for join attempts from
affiliated users, we also do that now on messages.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Wed, 22 Feb 2023 13:35:03 +0100 |
parent | 5175:432587ad1642 |
child | 5177:f6b5f04d4b28 |
line wrap: on
line diff
--- a/mod_muc_rtbl/mod_muc_rtbl.lua Wed Feb 22 13:33:16 2023 +0100 +++ b/mod_muc_rtbl/mod_muc_rtbl.lua Wed Feb 22 13:35:03 2023 +0100 @@ -129,6 +129,12 @@ end); module:hook("muc-occupant-groupchat", function(event) + local affiliation = event.room:get_affiliation(event.occupant.bare_jid); + if affiliation and affiliation ~= "none" then + -- Skip check for affiliated users + return; + end + local bare_hash, host_hash = update_hashes(event.occupant); if banned_hashes[bare_hash] or banned_hashes[host_hash] then module:log("debug", "Blocked message from user <%s> to room <%s> due to RTBL match", event.stanza.attr.from, event.stanza.attr.to); @@ -140,6 +146,12 @@ module:hook("muc-private-message", function(event) local occupant = event.room:get_occupant_by_nick(event.stanza.attr.from); + local affiliation = event.room:get_affiliation(event.occupant.bare_jid); + if affiliation and affiliation ~= "none" then + -- Skip check for affiliated users + return; + end + local bare_hash, host_hash = update_hashes(occupant); if banned_hashes[bare_hash] or banned_hashes[host_hash] then module:log("debug", "Blocked private message from user <%s> from room <%s> due to RTBL match", occupant.bare_jid, event.stanza.attr.to);