mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-04 21:50:28 -04:00
fix some things, adjust GUI elements
- messages are now actually sent (bug in parse player list) - no more crashes on sending mail (forgot to make variables local) - actually handle CC and BCC fields instead of leaving them empty, duh - make new functions be under the mail namespace - add util functions to ensure the new format, parse and player list as well as checking whether a player is in that list or not - rearrange some GUI elements (tighter spacing, grouping, increase window height to be consistent) - convert mails to new format only as needed (old mails stay intact in case someone reverts to old version) - mails are shaded differently in inbox, depending on whether the player is in the TO field - FROM, TO and CC fields are all displayed when reading a mail - add "Reply All" button (TO includes all original recipients plus the sender, but excluding the player himself, while adopting the CC field. To contrast: "Reply" just sets the original sender as TO and leaves the rest empty) - move reply, replyall and forward to their own functions in GUI (was duplicated for inbox and show mail) - don't needlessly set messages table when we do nothing but go back
This commit is contained in:
parent
f5f21feb49
commit
ea0de708da
3 changed files with 150 additions and 54 deletions
13
api.lua
13
api.lua
|
@ -28,6 +28,9 @@ function mail.send(src, dst, subject, body)
|
|||
m.body = body
|
||||
end
|
||||
|
||||
local cc
|
||||
local bcc
|
||||
local extra
|
||||
-- log mail send action
|
||||
if m.cc or m.bcc then
|
||||
if m.cc then
|
||||
|
@ -43,22 +46,22 @@ function mail.send(src, dst, subject, body)
|
|||
else
|
||||
bcc = ""
|
||||
end
|
||||
extra = "(" .. cc .. bcc .. ") "
|
||||
extra = " (" .. cc .. bcc .. ")"
|
||||
else
|
||||
extra = ""
|
||||
end
|
||||
minetest.log("action", "[mail] '" .. m.from .. "' sends mail to '" .. m.to ..
|
||||
minetest.log("action", "[mail] '" .. m.from .. "' sends mail to '" .. m.to .. "'" ..
|
||||
extra .. "' with subject '" .. m.subject .. "' and body: '" .. m.body .. "'")
|
||||
|
||||
|
||||
-- normalize to, cc and bcc while compiling a list of all recipients
|
||||
local recipients = {}
|
||||
m.to = normalize_players_and_add_recipients(m.to, recipients)
|
||||
m.to = mail.normalize_players_and_add_recipients(m.to, recipients)
|
||||
if m.cc then
|
||||
m.cc = normalize_players_and_add_recipients(m.cc, recipients)
|
||||
m.cc = mail.normalize_players_and_add_recipients(m.cc, recipients)
|
||||
end
|
||||
if m.bcc then
|
||||
m.bcc = normalize_players_and_add_recipients(m.bcc, recipients)
|
||||
m.bcc = mail.normalize_players_and_add_recipients(m.bcc, recipients)
|
||||
end
|
||||
|
||||
-- form the actual mail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue