Fix blank messages (#54)
* Fix blank messages : store as a draft if it is invalid * Fix line too long luacheck * Fix duplication of id variable (luacheck)
This commit is contained in:
parent
c94c82e5c1
commit
9238029dd8
@ -45,6 +45,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if msg_id[name] then
|
if msg_id[name] then
|
||||||
id = msg_id[name]
|
id = msg_id[name]
|
||||||
end
|
end
|
||||||
|
if (fields.to == "" and fields.cc == "" and fields.bcc == "") or fields.body == "" then
|
||||||
|
-- if mail is invalid then store it as a draft
|
||||||
|
mail.save_draft({
|
||||||
|
id = id,
|
||||||
|
from = name,
|
||||||
|
to = fields.to,
|
||||||
|
cc = fields.cc,
|
||||||
|
bcc = fields.bcc,
|
||||||
|
subject = fields.subject,
|
||||||
|
body = fields.body
|
||||||
|
})
|
||||||
|
mail.show_mail_menu(name)
|
||||||
|
return
|
||||||
|
end
|
||||||
local success, err = mail.send({
|
local success, err = mail.send({
|
||||||
id = id,
|
id = id,
|
||||||
from = name,
|
from = name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user