Store globally settings (type and default value)

This commit is contained in:
Athozus 2023-08-03 22:56:14 +02:00
parent 2a18322cdb
commit 1c85da70c5
No known key found for this signature in database
GPG key ID: B50895022E8484BF
2 changed files with 15 additions and 14 deletions

View file

@ -51,6 +51,20 @@ mail = {
new = "#00F529" new = "#00F529"
}, },
settings = {
chat_notifications = { type = "bool", default = true },
onjoin_notifications = { type = "bool", default = true },
hud_notifications = { type = "bool", default = true },
sound_notifications = { type = "bool", default = true },
unreadcolorenable = { type = "bool", default = true },
cccolorenable = { type = "bool", default = true },
defaultsortfield = { type = "number", default = 3 },
defaultsortdirection = { type = "number", default = 1 },
trash_move_enable = { type = "bool", default = true },
auto_marking_read = { type = "bool", default = true },
date_format = { type = "string", default = "%Y-%m-%d %X" },
},
message_drafts = {} message_drafts = {}
} }

View file

@ -394,20 +394,7 @@ function mail.extractMaillists(receivers_string, maillists_owner)
end end
function mail.get_setting_default_value(setting_name) function mail.get_setting_default_value(setting_name)
local default_values = { return mail.settings[setting_name].default
chat_notifications = true,
onjoin_notifications = true,
hud_notifications = true,
sound_notifications = true,
unreadcolorenable = true,
cccolorenable = true,
defaultsortfield = 3,
defaultsortdirection = 1,
trash_move_enable = true,
auto_marking_read = true,
date_format = "%Y-%m-%d %X",
}
return default_values[setting_name]
end end
function mail.get_setting(playername, setting_name) function mail.get_setting(playername, setting_name)