mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-04 21:50:28 -04:00
Fix messages loading
This commit is contained in:
parent
1441c28ccf
commit
3dd820a16b
2 changed files with 29 additions and 25 deletions
13
storage.lua
13
storage.lua
|
@ -30,10 +30,19 @@ function mail.getPlayerMessages(playername)
|
|||
local playerMessages = {}
|
||||
if messages then
|
||||
for _, msg in ipairs(messages) do
|
||||
local receivers = mail.split((msg.to .. ", " .. (msg.cc or "") .. ", " .. (msg.bcc or "")),",")
|
||||
local cc = ""
|
||||
local bcc = ""
|
||||
if msg.cc then
|
||||
cc = msg.cc
|
||||
end
|
||||
if msg.bcc then
|
||||
bcc = msg.bcc
|
||||
end
|
||||
|
||||
local receivers = mail.split((msg.to .. ", " .. cc .. ", " .. bcc),",")
|
||||
for _, receiver in ipairs(receivers) do
|
||||
if receiver == playername then -- check if player is a receiver
|
||||
if mail.getStatus(receiver, msg.id) ~= "deleted" then -- do not return if the message was deleted from player
|
||||
if mail.getMessageStatus(receiver, msg.id) ~= "deleted" then -- do not return if the message was deleted from player
|
||||
table.insert(playerMessages, msg)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue