fix some issues

This commit is contained in:
BuckarooBanzay 2023-03-28 19:28:49 +02:00 committed by Athozus
parent e8c7fde4c3
commit b1ccd494f7
No known key found for this signature in database
GPG key ID: B50895022E8484BF
3 changed files with 9 additions and 3 deletions

View file

@ -119,7 +119,7 @@ end
-- get all contacts
function mail.get_contacts(playername)
local entry = mail.get_storage_entry(playername)
return entry.contact
return entry.contacts
end
-- returns the maillists of a player

View file

@ -18,6 +18,12 @@ mtt.register("storage", function(callback)
assert(contacts[1].note == contact.note)
assert(contacts[1].name == contact.name)
-- read through api
local contacts2 = mail.get_contacts(playername)
assert(#contacts2 == 1)
assert(contacts2[1].note == contact.note)
assert(contacts2[1].name == contact.name)
-- update
mail.update_contact(playername, {
name = contact.name,

View file

@ -32,7 +32,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if fields.send then
local err = mail.send({
local success, err = mail.send({
from = name,
to = fields.to,
cc = fields.cc,
@ -40,7 +40,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
subject = fields.subject,
body = fields.body,
})
if err then
if not success then
minetest.chat_send_player(name, err)
return
end