mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-08 15:40:29 -04:00
Minor fixes
This commit is contained in:
parent
0ea3777b51
commit
b083f484c0
1 changed files with 5 additions and 6 deletions
11
api.lua
11
api.lua
|
@ -63,8 +63,7 @@ function mail.send(m)
|
||||||
m.from, m.to, extra_log, m.subject, m.body
|
m.from, m.to, extra_log, m.subject, m.body
|
||||||
))
|
))
|
||||||
|
|
||||||
|
local id
|
||||||
local id = mail.new_uuid()
|
|
||||||
if m.id then
|
if m.id then
|
||||||
mail.delete_mail(m.from, m.id)
|
mail.delete_mail(m.from, m.id)
|
||||||
id = m.id
|
id = m.id
|
||||||
|
@ -72,7 +71,7 @@ function mail.send(m)
|
||||||
|
|
||||||
-- form the actual mail
|
-- form the actual mail
|
||||||
local msg = {
|
local msg = {
|
||||||
id = id,
|
id = id or mail.new_uuid(),
|
||||||
from = m.from,
|
from = m.from,
|
||||||
to = m.to,
|
to = m.to,
|
||||||
cc = m.cc,
|
cc = m.cc,
|
||||||
|
@ -125,12 +124,12 @@ function mail.save_draft(m)
|
||||||
m.subject = string.sub(m.subject,1,27) .. "..."
|
m.subject = string.sub(m.subject,1,27) .. "..."
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.log("action", f("[mail] %q saves draft with subject %q and body %q",
|
minetest.log("verbose", f("[mail] %q saves draft with subject %q and body %q",
|
||||||
m.from, m.subject, m.body
|
m.from, m.subject, m.body
|
||||||
))
|
))
|
||||||
|
|
||||||
-- remove it is an update
|
-- remove it is an update
|
||||||
local id = mail.new_uuid()
|
local id
|
||||||
if m.id then
|
if m.id then
|
||||||
mail.delete_mail(m.from, m.id)
|
mail.delete_mail(m.from, m.id)
|
||||||
id = m.id
|
id = m.id
|
||||||
|
@ -139,7 +138,7 @@ function mail.save_draft(m)
|
||||||
-- add (again ie. update) in sender drafts
|
-- add (again ie. update) in sender drafts
|
||||||
local entry = mail.get_storage_entry(m.from)
|
local entry = mail.get_storage_entry(m.from)
|
||||||
table.insert(entry.drafts, 1, {
|
table.insert(entry.drafts, 1, {
|
||||||
id = id,
|
id = id or mail.new_uuid(),
|
||||||
from = m.from,
|
from = m.from,
|
||||||
to = m.to,
|
to = m.to,
|
||||||
cc = m.cc,
|
cc = m.cc,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue