aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mamprefs.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-01-16 21:04:58 +0100
committerKim Alvefur <zash@zash.se>2021-01-16 21:04:58 +0100
commita8b0c56f656fcd3fca033dc5f3154a4d8a2464a2 (patch)
tree622eea2bf7444475db1e24fbe0d6bc49d980654d /plugins/mod_mam/mamprefs.lib.lua
parentc4abd68e92a258750177f25dca38525fe3133063 (diff)
downloadprosody-a8b0c56f656fcd3fca033dc5f3154a4d8a2464a2.tar.gz
prosody-a8b0c56f656fcd3fca033dc5f3154a4d8a2464a2.zip
plugins: Use get_option_enum where appropriate
Diffstat (limited to 'plugins/mod_mam/mamprefs.lib.lua')
-rw-r--r--plugins/mod_mam/mamprefs.lib.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/mod_mam/mamprefs.lib.lua b/plugins/mod_mam/mamprefs.lib.lua
index dd82b626..cddcbd30 100644
--- a/plugins/mod_mam/mamprefs.lib.lua
+++ b/plugins/mod_mam/mamprefs.lib.lua
@@ -10,12 +10,15 @@
--
-- luacheck: ignore 122/prosody
-local global_default_policy = module:get_option_string("default_archive_policy", true);
-if global_default_policy ~= "roster" then
- global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy);
-end
+local global_default_policy = module:get_option_enum("default_archive_policy", "always", "roster", "never", true, false);
local smart_enable = module:get_option_boolean("mam_smart_enable", false);
+if global_default_policy == "always" then
+ global_default_policy = true;
+elseif global_default_policy == "never" then
+ global_default_policy = false;
+end
+
do
-- luacheck: ignore 211/prefs_format
local prefs_format = {