mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 16:31:43 -04:00
Fix #97
This commit is contained in:
parent
95b7f3b757
commit
e3fa29506e
1 changed files with 18 additions and 15 deletions
33
storage.lua
33
storage.lua
|
@ -114,27 +114,30 @@ function mail.delete_mail(playername, msg_ids)
|
||||||
if type(msg_ids) ~= "table" then -- if this is not a table
|
if type(msg_ids) ~= "table" then -- if this is not a table
|
||||||
msg_ids = { msg_ids }
|
msg_ids = { msg_ids }
|
||||||
end
|
end
|
||||||
for i = #entry.inbox, 1, -1 do
|
if #entry.inbox > 0 then
|
||||||
for _, deleted_msg in ipairs(msg_ids) do
|
for i = #entry.inbox, 1, -1 do
|
||||||
if entry.inbox[i].id == deleted_msg then
|
for _, deleted_msg in ipairs(msg_ids) do
|
||||||
table.remove(entry.inbox, i)
|
if entry.inbox[i].id == deleted_msg then
|
||||||
break
|
table.remove(entry.inbox, i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = #entry.outbox, 1, -1 do
|
if #entry.outbox > 0 then
|
||||||
for _, deleted_msg in ipairs(msg_ids) do
|
for i = #entry.outbox, 1, -1 do
|
||||||
if entry.outbox[i].id == deleted_msg then
|
for _, deleted_msg in ipairs(msg_ids) do
|
||||||
table.remove(entry.outbox, i)
|
if entry.outbox[i].id == deleted_msg then
|
||||||
break
|
table.remove(entry.outbox, i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = #entry.drafts, 1, -1 do
|
if #entry.drafts > 0 then
|
||||||
for _, deleted_msg in ipairs(msg_ids) do
|
for i = #entry.drafts, 1, -1 do
|
||||||
if entry.drafts[i].id == deleted_msg then
|
for _, deleted_msg in ipairs(msg_ids) do
|
||||||
table.remove(entry.drafts, i)
|
if entry.drafts[i].id == deleted_msg then
|
||||||
break
|
table.remove(entry.drafts, i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue