Prevent sending mail to the sender themselves

This commit is contained in:
1F616EMO 2024-12-20 22:10:55 +08:00
parent 4620144d05
commit c36d99475c
No known key found for this signature in database
GPG Key ID: EF52EFA8E05859B2

View File

@ -78,12 +78,14 @@ mail.register_recipient_handler(function(sender, name)
local list_dest = {} local list_dest = {}
if list_name == "admins" or list_name == "moderators" then if list_name == "admins" or list_name == "moderators" then
for k, v in pairs(list_admins) do for k, v in pairs(list_admins) do
list_dest[#list_dest+1] = k if k ~= sender then
list_dest[#list_dest+1] = k
end
end end
if list_name == "moderators" then if list_name == "moderators" then
for k, v in pairs(list_moderators) do for k, v in pairs(list_moderators) do
if list_name ~= "admins" or not list_admins[k] then if k ~= sender and (list_name ~= "admins" or not list_admins[k]) then
list_dest[#list_dest+1] = k list_dest[#list_dest+1] = k
end end
end end