# HG changeset patch # User Matthew Wild # Date 1737109901 0 # Node ID ef7bf4215cb3a5d15425440770532df299cbc44a # Parent 5961e01dd963cad368b0051766478a03c44a58a6 mod_anti_spam: Update definition of "stranger" to include sub to/from JID or domains This should allow more trusted communications while keeping untrusted ones going through the filters. diff -r 5961e01dd963 -r ef7bf4215cb3 mod_anti_spam/mod_anti_spam.lua --- a/mod_anti_spam/mod_anti_spam.lua Fri Jan 17 10:29:28 2025 +0000 +++ b/mod_anti_spam/mod_anti_spam.lua Fri Jan 17 10:31:41 2025 +0000 @@ -68,13 +68,20 @@ local to_session = full_sessions[stanza.attr.to]; if to_session then return false; end - if not is_contact_subscribed(to_user, to_host, from_jid) then + if not (is_contact_subscribed(to_user, to_host, from_jid) or is_user_subscribed(to_user, to_host, from_jid)) then + local from_user, from_host = jid_split(from_jid); + -- Allow all messages from your own jid if from_jid == to_user.."@"..to_host then return false; -- Pass through end if to_resource and stanza.attr.type == "groupchat" then - return false; -- Pass through + return false; -- Pass through group chat messages + end + if is_contact_subscribed(to_user, to_host, from_host) then + -- If you have the sending domain in your roster, + -- allow through (probably a gateway) + return false; end return true; -- Stranger danger end