Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
13212:3e6e98cc63e9 | 13213:50324f66ca2a |
---|---|
157 room_state:set(node, nil); | 157 room_state:set(node, nil); |
158 return room_configs:set(node, nil); | 158 return room_configs:set(node, nil); |
159 end | 159 end |
160 end | 160 end |
161 | 161 |
162 local max_rooms = module:get_option_number("muc_max_rooms"); | 162 local max_rooms = module:get_option_integer("muc_max_rooms", nil, 0); |
163 local max_live_rooms = module:get_option_number("muc_room_cache_size", 100); | 163 local max_live_rooms = module:get_option_integer("muc_room_cache_size", 100, 1); |
164 | 164 |
165 local room_hit = module:measure("room_hit", "rate"); | 165 local room_hit = module:measure("room_hit", "rate"); |
166 local room_miss = module:measure("room_miss", "rate") | 166 local room_miss = module:measure("room_miss", "rate") |
167 local room_eviction = module:measure("room_eviction", "rate"); | 167 local room_eviction = module:measure("room_eviction", "rate"); |
168 local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room) | 168 local rooms = cache.new(max_rooms or max_live_rooms, function (jid, room) |
286 room:get_allow_member_invites())); | 286 room:get_allow_member_invites())); |
287 room:set_moderated(module:get_option_boolean("muc_room_default_moderated", room:get_moderated())); | 287 room:set_moderated(module:get_option_boolean("muc_room_default_moderated", room:get_moderated())); |
288 room:set_whois(module:get_option_boolean("muc_room_default_public_jids", | 288 room:set_whois(module:get_option_boolean("muc_room_default_public_jids", |
289 room:get_whois() == "anyone") and "anyone" or "moderators"); | 289 room:get_whois() == "anyone") and "anyone" or "moderators"); |
290 room:set_changesubject(module:get_option_boolean("muc_room_default_change_subject", room:get_changesubject())); | 290 room:set_changesubject(module:get_option_boolean("muc_room_default_change_subject", room:get_changesubject())); |
291 room:set_historylength(module:get_option_number("muc_room_default_history_length", room:get_historylength())); | 291 room:set_historylength(module:get_option_integer("muc_room_default_history_length", room:get_historylength(), 0)); |
292 room:set_language(lang or module:get_option_string("muc_room_default_language")); | 292 room:set_language(lang or module:get_option_string("muc_room_default_language")); |
293 room:set_presence_broadcast(module:get_option("muc_room_default_presence_broadcast", room:get_presence_broadcast())); | 293 room:set_presence_broadcast(module:get_option("muc_room_default_presence_broadcast", room:get_presence_broadcast())); |
294 end | 294 end |
295 | 295 |
296 function create_room(room_jid, config) | 296 function create_room(room_jid, config) |