From 1c85da70c58b6d9d3337e99227d1fe901bb91789 Mon Sep 17 00:00:00 2001 From: Athozus Date: Thu, 3 Aug 2023 22:56:14 +0200 Subject: [PATCH] Store globally settings (type and default value) --- init.lua | 14 ++++++++++++++ storage.lua | 15 +-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index dadf16c..cd5fa9d 100644 --- a/init.lua +++ b/init.lua @@ -51,6 +51,20 @@ mail = { 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 = {} } diff --git a/storage.lua b/storage.lua index dc954e2..ec52933 100644 --- a/storage.lua +++ b/storage.lua @@ -394,20 +394,7 @@ function mail.extractMaillists(receivers_string, maillists_owner) end function mail.get_setting_default_value(setting_name) - local default_values = { - 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] + return mail.settings[setting_name].default end function mail.get_setting(playername, setting_name)