Software /
code /
prosody
Changeset
13202:173038306750
plugins: Use get_option_enum where appropriate
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 16 Jan 2021 21:04:58 +0100 |
parents | 13201:65fb0d7a2312 |
children | 13203:aa6c2692a4be |
files | plugins/mod_auth_internal_hashed.lua plugins/mod_component.lua plugins/mod_mam/mamprefs.lib.lua plugins/mod_pubsub/mod_pubsub.lua plugins/mod_watchregistrations.lua |
diffstat | 5 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_auth_internal_hashed.lua Sat Jan 16 20:40:14 2021 +0100 +++ b/plugins/mod_auth_internal_hashed.lua Sat Jan 16 21:04:58 2021 +0100 @@ -22,7 +22,7 @@ local accounts = module:open_store("accounts"); -local hash_name = module:get_option_string("password_hash", "SHA-1"); +local hash_name = module:get_option_enum("password_hash", "SHA-1", "SHA-256"); local get_auth_db = assert(scram_hashers[hash_name], "SCRAM-"..hash_name.." not supported by SASL library"); local scram_name = "scram_"..hash_name:gsub("%-","_"):lower();
--- a/plugins/mod_component.lua Sat Jan 16 20:40:14 2021 +0100 +++ b/plugins/mod_component.lua Sat Jan 16 21:04:58 2021 +0100 @@ -85,7 +85,7 @@ end if env.connected then - local policy = module:get_option_string("component_conflict_resolve", "kick_new"); + local policy = module:get_option_enum("component_conflict_resolve", "kick_new", "kick_old"); if policy == "kick_old" then env.session:close{ condition = "conflict", text = "Replaced by a new connection" }; else -- kick_new
--- 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
--- a/plugins/mod_pubsub/mod_pubsub.lua Sat Jan 16 20:40:14 2021 +0100 +++ b/plugins/mod_pubsub/mod_pubsub.lua Sat Jan 16 21:04:58 2021 +0100 @@ -179,7 +179,7 @@ end end); -local admin_aff = module:get_option_string("default_admin_affiliation", "owner"); +local admin_aff = module:get_option_enum("default_admin_affiliation", "owner", "publisher", "member", "outcast", "none"); module:default_permission("prosody:admin", ":service-admin"); local function get_affiliation(jid) local bare_jid = jid_bare(jid);
--- a/plugins/mod_watchregistrations.lua Sat Jan 16 20:40:14 2021 +0100 +++ b/plugins/mod_watchregistrations.lua Sat Jan 16 21:04:58 2021 +0100 @@ -13,7 +13,7 @@ local registration_watchers = module:get_option_set("registration_watchers", module:get_option("admins", {})) / jid_prep; local registration_from = module:get_option_string("registration_from", host); local registration_notification = module:get_option_string("registration_notification", "User $username just registered on $host from $ip"); -local msg_type = module:get_option_string("registration_notification_type", "chat"); +local msg_type = module:get_option_enum("registration_notification_type", "chat", "normal", "headline"); local st = require "prosody.util.stanza";