This commit is contained in:
BuckarooBanzay 2023-03-28 15:28:38 +02:00 committed by Athozus
parent 8ce3dc2ecf
commit dff068d75b
No known key found for this signature in database
GPG key ID: B50895022E8484BF
7 changed files with 91 additions and 139 deletions

View file

@ -1,3 +1,5 @@
-- storage getter/setter
function mail.get_storage_entry(playername)
local str = mail.storage:get_string(playername)
if str == "" then
@ -14,52 +16,6 @@ function mail.get_storage_entry(playername)
end
end
--[[
Mail format (inbox, outbox):
table of: {
-- globally unique mail id
id = "d6cce35c-487a-458f-bab2-9032c2621f38",
-- sending player name
sender = "",
-- receiving player name
to = "",
-- carbon copy (optional)
cc = "",
-- blind carbon copy (optional)
bcc = "",
-- mail subject
subject = "",
-- mail body
body = "",
-- timestamp (os.time())
time = 1234,
-- read-flag (true: player has read the mail, inbox only)
read = true
}
Contact format:
table of: {
-- name of the player (unique key in the list)
name = "",
-- note
note = ""
}
Mail-list format:
table of: {
-- name of the maillist (unique key in the list)
name = "",
-- description
description = "",
-- playername list
players = {"playername", "playername2"}
}
--]]
function mail.set_storage_entry(playername, entry)
mail.storage:get_string(playername, minetest.write_json(entry))
end