aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-07-17 01:38:54 +0200
committerKim Alvefur <zash@zash.se>2023-07-17 01:38:54 +0200
commit71ad48095d92dd52a415eef499da32f8c27bb7fe (patch)
tree0287ae06ee488c1b62e9e3eccbf4a9ae74b8370d /plugins/muc
parent55768509a3f15b0476289f7a338d02e7233d1926 (diff)
downloadprosody-71ad48095d92dd52a415eef499da32f8c27bb7fe.tar.gz
prosody-71ad48095d92dd52a415eef499da32f8c27bb7fe.zip
plugins: Use integer config API with interval specification where sensible
Many of these fall into a few categories: - util.cache size, must be >= 1 - byte or item counts that logically can't be negative - port numbers that should be in 1..0xffff
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/history.lib.lua2
-rw-r--r--plugins/muc/mod_muc.lua6
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua
index 9fad4721..005bd1d8 100644
--- a/plugins/muc/history.lib.lua
+++ b/plugins/muc/history.lib.lua
@@ -12,7 +12,7 @@ local datetime = require "prosody.util.datetime";
local st = require "prosody.util.stanza";
local default_history_length = 20;
-local max_history_length = module:get_option_number("max_history_messages", math.huge);
+local max_history_length = module:get_option_integer("max_history_messages", math.huge, 0);
local function set_max_history_length(_max_history_length)
max_history_length = _max_history_length or math.huge;
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index b8a0d480..88a2be54 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -159,8 +159,8 @@ local function room_save(room, forced, savestate)
end
end
-local max_rooms = module:get_option_number("muc_max_rooms");
-local max_live_rooms = module:get_option_number("muc_room_cache_size", 100);
+local max_rooms = module:get_option_integer("muc_max_rooms", nil, 0);
+local max_live_rooms = module:get_option_integer("muc_room_cache_size", 100, 1);
local room_hit = module:measure("room_hit", "rate");
local room_miss = module:measure("room_miss", "rate")
@@ -288,7 +288,7 @@ local function set_room_defaults(room, lang)
room:set_whois(module:get_option_boolean("muc_room_default_public_jids",
room:get_whois() == "anyone") and "anyone" or "moderators");
room:set_changesubject(module:get_option_boolean("muc_room_default_change_subject", room:get_changesubject()));
- room:set_historylength(module:get_option_number("muc_room_default_history_length", room:get_historylength()));
+ room:set_historylength(module:get_option_integer("muc_room_default_history_length", room:get_historylength(), 0));
room:set_language(lang or module:get_option_string("muc_room_default_language"));
room:set_presence_broadcast(module:get_option("muc_room_default_presence_broadcast", room:get_presence_broadcast()));
end