aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
parentc4abd68e92a258750177f25dca38525fe3133063 (diff)
downloadprosody-a8b0c56f656fcd3fca033dc5f3154a4d8a2464a2.tar.gz
prosody-a8b0c56f656fcd3fca033dc5f3154a4d8a2464a2.zip
plugins: Use get_option_enum where appropriate
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_auth_internal_hashed.lua2
-rw-r--r--plugins/mod_component.lua2
-rw-r--r--plugins/mod_mam/mamprefs.lib.lua11
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua2
-rw-r--r--plugins/mod_watchregistrations.lua2
5 files changed, 11 insertions, 8 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua
index b8fea993..a0c4d48e 100644
--- a/plugins/mod_auth_internal_hashed.lua
+++ b/plugins/mod_auth_internal_hashed.lua
@@ -22,7 +22,7 @@ local host = module.host;
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();
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index 7050dcbb..9b62c8fd 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -85,7 +85,7 @@ function module.add_host(module)
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
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 = {
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 088f6a87..40a87581 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -179,7 +179,7 @@ module:hook("host-disco-items", function (event)
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);
diff --git a/plugins/mod_watchregistrations.lua b/plugins/mod_watchregistrations.lua
index 21025360..d433d732 100644
--- a/plugins/mod_watchregistrations.lua
+++ b/plugins/mod_watchregistrations.lua
@@ -13,7 +13,7 @@ local jid_prep = require "prosody.util.jid".prep;
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";