Diff

plugins/mod_mam/mamprefs.lib.lua @ 13202:173038306750

plugins: Use get_option_enum where appropriate
author Kim Alvefur <zash@zash.se>
date Sat, 16 Jan 2021 21:04:58 +0100
parent 8538:3eb4cafb3b64
line wrap: on
line diff
--- a/plugins/mod_mam/mamprefs.lib.lua	Sat Jan 16 20:40:14 2021 +0100
+++ b/plugins/mod_mam/mamprefs.lib.lua	Sat Jan 16 21:04:58 2021 +0100
@@ -10,11 +10,14 @@
 --
 -- 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);
+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
-local smart_enable = module:get_option_boolean("mam_smart_enable", false);
 
 do
 	-- luacheck: ignore 211/prefs_format