From 720315a22c10533021ec466038dc2382f32f5cd9 Mon Sep 17 00:00:00 2001 From: Athozus Date: Wed, 27 Dec 2023 18:07:23 +0100 Subject: [PATCH] Move settings-related to util/settings.lua --- init.lua | 59 ----------------------------------------------- util/init.lua | 3 ++- util/settings.lua | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 util/settings.lua diff --git a/init.lua b/init.lua index 1df2e9f..889031c 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,3 @@ --- translation -local S = minetest.get_translator("mail") - mail = { -- version version = 3, @@ -35,65 +32,9 @@ mail = { settings_group = {}, }, - settings = { - chat_notifications = { - type = "bool", default = true, group = "notifications", index = 1, - label = S("Chat notifications"), tooltip = S("Receive a message in the chat when there is a new message") - }, - onjoin_notifications = { - type = "bool", default = true, group = "notifications", index = 2, - label = S("On join notifications"), tooltip = S("Receive a message at login when inbox isn't empty") }, - hud_notifications = { - type = "bool", default = true, group = "notifications", index = 3, - label = S("HUD notifications"), tooltip = S("Show an HUD notification when inbox isn't empty") - }, - sound_notifications = { - type = "bool", default = true, group = "notifications", index = 4, - label = S("Sound notifications"), tooltip = S("Play a sound when there is a new message") - }, - unreadcolorenable = { - type = "bool", default = true, group = "message_list", index = 1, - label = S("Show unread in different color") - }, - cccolorenable = { - type = "bool", default = true, group = "message_list", index = 2, - label = S("Show CC/BCC in different color") - }, - defaultsortfield = { - type = "index", default = 3, group = "message_list", index = 3, - label = S("Default sorting field"), dataset = { S("From/To"), S("Subject"), S("Date") } - }, - defaultsortdirection = { - type = "index", default = 1, group = "message_list", index = 4, - label = S("Default sorting direction"), dataset = { S("Ascending"), S("Descending") } - }, - trash_move_enable = { - type = "bool", default = true, group = "other", index = 1, - label = S("Move deleted messages to trash") - }, - auto_marking_read = { - type = "bool", default = true, group = "other", index = 2, - label = S("Automatic marking read"), tooltip = S("Mark a message as read when opened") - }, - date_format = { - type = "string", default = "%Y-%m-%d %X", group = "other", index = 3, label = S("Date format"), - dataset = {"%Y-%m-%d %X", "%d/%m/%y %X", "%A %d %B %Y %X"}, format = os.date - }, - }, - - settings_groups = { - { name = "notifications", label = S("Notifications")}, - { name = "message_list", label = S("Message list")}, - { name = "other", label = S("Other")} - }, - message_drafts = {} } -for s, _ in pairs(mail.settings) do - mail.selected_idxs[s] = {} -end - if minetest.get_modpath("default") then mail.theme = default.gui_bg .. default.gui_bg_img end diff --git a/util/init.lua b/util/init.lua index 85139fb..dca73b8 100644 --- a/util/init.lua +++ b/util/init.lua @@ -3,5 +3,6 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) dofile(MP .. "/util/normalize.lua") dofile(MP .. "/util/colors.lua") dofile(MP .. "/util/contact.lua") -dofile(MP .. "/util/uuid.lua") +dofile(MP .. "/util/settings.lua") dofile(MP .. "/util/time_ago.lua") +dofile(MP .. "/util/uuid.lua") diff --git a/util/settings.lua b/util/settings.lua new file mode 100644 index 0000000..d31607b --- /dev/null +++ b/util/settings.lua @@ -0,0 +1,58 @@ +-- translation +local S = minetest.get_translator("mail") + +mail.settings = { + chat_notifications = { + type = "bool", default = true, group = "notifications", index = 1, + label = S("Chat notifications"), tooltip = S("Receive a message in the chat when there is a new message") + }, + onjoin_notifications = { + type = "bool", default = true, group = "notifications", index = 2, + label = S("On join notifications"), tooltip = S("Receive a message at login when inbox isn't empty") }, + hud_notifications = { + type = "bool", default = true, group = "notifications", index = 3, + label = S("HUD notifications"), tooltip = S("Show an HUD notification when inbox isn't empty") + }, + sound_notifications = { + type = "bool", default = true, group = "notifications", index = 4, + label = S("Sound notifications"), tooltip = S("Play a sound when there is a new message") + }, + unreadcolorenable = { + type = "bool", default = true, group = "message_list", index = 1, + label = S("Show unread in different color") + }, + cccolorenable = { + type = "bool", default = true, group = "message_list", index = 2, + label = S("Show CC/BCC in different color") + }, + defaultsortfield = { + type = "index", default = 3, group = "message_list", index = 3, + label = S("Default sorting field"), dataset = { S("From/To"), S("Subject"), S("Date") } + }, + defaultsortdirection = { + type = "index", default = 1, group = "message_list", index = 4, + label = S("Default sorting direction"), dataset = { S("Ascending"), S("Descending") } + }, + trash_move_enable = { + type = "bool", default = true, group = "other", index = 1, + label = S("Move deleted messages to trash") + }, + auto_marking_read = { + type = "bool", default = true, group = "other", index = 2, + label = S("Automatic marking read"), tooltip = S("Mark a message as read when opened") + }, + date_format = { + type = "string", default = "%Y-%m-%d %X", group = "other", index = 3, label = S("Date format"), + dataset = {"%Y-%m-%d %X", "%d/%m/%y %X", "%A %d %B %Y %X"}, format = os.date + }, +} + +mail.settings_groups = { + { name = "notifications", label = S("Notifications")}, + { name = "message_list", label = S("Message list")}, + { name = "other", label = S("Other")} +} + +for s, _ in pairs(mail.settings) do + mail.selected_idxs[s] = {} +end