Significantly improve maillist behaviour

Replace maillist by its players when sending a message
List of players separated by ,
Avoid doublons when editing more than 2 times a maillist
This commit is contained in:
Athozus 2023-03-24 19:47:19 +01:00
parent 1e6e06e56f
commit c4dd235782
No known key found for this signature in database
GPG key ID: B50895022E8484BF
4 changed files with 36 additions and 61 deletions

View file

@ -7,14 +7,10 @@ and add individual player names to recipient list
function mail.normalize_players_and_add_recipients(field, recipients, undeliverable)
local order = mail.parse_player_list(field)
for _, recipient_name in ipairs(order) do
if recipient_name:split("@")[1] == "" then -- in case of maillist
if not minetest.player_exists(recipient_name) then
undeliverable[recipient_name] = true
else
recipients[recipient_name] = true
else -- in case of playerˇ
if not minetest.player_exists(recipient_name) then
undeliverable[recipient_name] = true
else
recipients[recipient_name] = true
end
end
end
return mail.concat_player_list(order)