Minor fixes

This commit is contained in:
Athozus 2023-03-31 18:02:26 +02:00
parent 0ea3777b51
commit b083f484c0
No known key found for this signature in database
GPG key ID: B50895022E8484BF

11
api.lua
View file

@ -63,8 +63,7 @@ function mail.send(m)
m.from, m.to, extra_log, m.subject, m.body
))
local id = mail.new_uuid()
local id
if m.id then
mail.delete_mail(m.from, m.id)
id = m.id
@ -72,7 +71,7 @@ function mail.send(m)
-- form the actual mail
local msg = {
id = id,
id = id or mail.new_uuid(),
from = m.from,
to = m.to,
cc = m.cc,
@ -125,12 +124,12 @@ function mail.save_draft(m)
m.subject = string.sub(m.subject,1,27) .. "..."
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
))
-- remove it is an update
local id = mail.new_uuid()
local id
if m.id then
mail.delete_mail(m.from, m.id)
id = m.id
@ -139,7 +138,7 @@ function mail.save_draft(m)
-- add (again ie. update) in sender drafts
local entry = mail.get_storage_entry(m.from)
table.insert(entry.drafts, 1, {
id = id,
id = id or mail.new_uuid(),
from = m.from,
to = m.to,
cc = m.cc,