mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-06 14:40:30 -04:00
Use funcs
This commit is contained in:
parent
b840f7bce8
commit
615a102d85
1 changed files with 1 additions and 7 deletions
|
@ -367,20 +367,14 @@ end
|
||||||
|
|
||||||
function mail.deleteMaillist(ml_id)
|
function mail.deleteMaillist(ml_id)
|
||||||
local maillists = mail.getMaillists()
|
local maillists = mail.getMaillists()
|
||||||
local maillists_players = mail.getPlayersInMaillists()
|
|
||||||
-- remove players attached to the maillist
|
-- remove players attached to the maillist
|
||||||
for _, player in ipairs(maillists_players) do
|
local players_writing_done = mail.removePlayersFromMaillist(ml_id)
|
||||||
if player.id == ml_id then
|
|
||||||
table.remove(maillists_players, _)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- then remove the maillist itself
|
-- then remove the maillist itself
|
||||||
for _, maillist in ipairs(maillists) do
|
for _, maillist in ipairs(maillists) do
|
||||||
if maillist.id == ml_id then
|
if maillist.id == ml_id then
|
||||||
table.remove(maillists, _)
|
table.remove(maillists, _)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local players_writing_done = mail.write_json_file(mail.maildir .. "/mail.maillists_players.json", maillists_players)
|
|
||||||
local maillist_writing_done = mail.write_json_file(mail.maildir .. "/mail.maillists.json", maillists)
|
local maillist_writing_done = mail.write_json_file(mail.maildir .. "/mail.maillists.json", maillists)
|
||||||
if players_writing_done and maillist_writing_done then
|
if players_writing_done and maillist_writing_done then
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue