diff options
author | Kim Alvefur <zash@zash.se> | 2023-07-17 01:38:54 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-07-17 01:38:54 +0200 |
commit | 71ad48095d92dd52a415eef499da32f8c27bb7fe (patch) | |
tree | 0287ae06ee488c1b62e9e3eccbf4a9ae74b8370d /plugins/mod_mam | |
parent | 55768509a3f15b0476289f7a338d02e7233d1926 (diff) | |
download | prosody-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/mod_mam')
-rw-r--r-- | plugins/mod_mam/mod_mam.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index d1e07de8..eb796f71 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -37,14 +37,14 @@ local tostring = tostring; local time_now = require "prosody.util.time".now; local m_min = math.min; local timestamp, datestamp = import( "util.datetime", "datetime", "date"); -local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); +local default_max_items, max_max_items = 20, module:get_option_integer("max_archive_query_results", 50, 0); local strip_tags = module:get_option_set("dont_archive_namespaces", { "http://jabber.org/protocol/chatstates" }); local archive_store = module:get_option_string("archive_store", "archive"); local archive = module:open_store(archive_store, "archive"); local cleanup_after = module:get_option_period("archive_expires_after", "1w"); -local archive_item_limit = module:get_option_number("storage_archive_item_limit", archive.caps and archive.caps.quota or 1000); +local archive_item_limit = module:get_option_integer("storage_archive_item_limit", archive.caps and archive.caps.quota or 1000, 0); local archive_truncate = math.floor(archive_item_limit * 0.99); if not archive.find then @@ -522,7 +522,7 @@ if cleanup_after ~= "never" then -- outside the cleanup range. if not (archive.caps and archive.caps.wildcard_delete) then - local last_date = require "prosody.util.cache".new(module:get_option_number("archive_cleanup_date_cache_size", 1000)); + local last_date = require "prosody.util.cache".new(module:get_option_integer("archive_cleanup_date_cache_size", 1000, 1)); function schedule_cleanup(username, date) date = date or datestamp(); if last_date:get(username) == date then return end |