Software /
code /
prosody-modules
Changeset
6153:ef7bf4215cb3
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 Jan 2025 10:31:41 +0000 |
parents | 6152:5961e01dd963 |
children | 6154:160d1bcfe341 |
files | mod_anti_spam/mod_anti_spam.lua |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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