Comparison

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
comparison
equal deleted inserted replaced
13201:65fb0d7a2312 13202:173038306750
8 -- 8 --
9 -- XEP-0313: Message Archive Management for Prosody 9 -- XEP-0313: Message Archive Management for Prosody
10 -- 10 --
11 -- luacheck: ignore 122/prosody 11 -- luacheck: ignore 122/prosody
12 12
13 local global_default_policy = module:get_option_string("default_archive_policy", true); 13 local global_default_policy = module:get_option_enum("default_archive_policy", "always", "roster", "never", true, false);
14 if global_default_policy ~= "roster" then 14 local smart_enable = module:get_option_boolean("mam_smart_enable", false);
15 global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy); 15
16 if global_default_policy == "always" then
17 global_default_policy = true;
18 elseif global_default_policy == "never" then
19 global_default_policy = false;
16 end 20 end
17 local smart_enable = module:get_option_boolean("mam_smart_enable", false);
18 21
19 do 22 do
20 -- luacheck: ignore 211/prefs_format 23 -- luacheck: ignore 211/prefs_format
21 local prefs_format = { 24 local prefs_format = {
22 [false] = "roster", 25 [false] = "roster",