Diff

plugins/muc/mod_muc.lua @ 13213:50324f66ca2a

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
author Kim Alvefur <zash@zash.se>
date Mon, 17 Jul 2023 01:38:54 +0200
parent 13209:c8d949cf6b09
child 13226:ac44bb7b7064
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Mon Jul 17 00:37:44 2023 +0200
+++ b/plugins/muc/mod_muc.lua	Mon Jul 17 01:38:54 2023 +0200
@@ -159,8 +159,8 @@
 	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 @@
 	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