From 99cca59d6e53584e8e72e64af4b205f9802bec07 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 21 Jul 2023 17:23:00 +0200 Subject: plugins: Handle how get_option_period returns "never" --- plugins/mod_c2s.lua | 2 +- plugins/mod_http_file_share.lua | 2 +- plugins/mod_mam/mod_mam.lua | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 0a4e5794..b80485f5 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -367,7 +367,7 @@ function listener.onconnect(conn) end end - if c2s_timeout then + if c2s_timeout < math.huge then add_task(c2s_timeout, function () if session.type == "c2s_unauthed" then (session.log or log)("debug", "Connection still not authenticated after c2s_timeout=%gs, closing it", c2s_timeout); diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index 08d6a90e..a1c725f8 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -176,7 +176,7 @@ function get_authz(slot, uploader, filename, filesize, filetype) -- slot properties slot = slot; - expires = expiry >= 0 and (os.time()+expiry) or nil; + expires = expiry < math.huge and (os.time()+expiry) or nil; -- file properties filename = filename; filesize = filesize; diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index eb796f71..d8555ec1 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -441,7 +441,7 @@ local function message_handler(event, c2s) local time = time_now(); local ok, err = archive:append(store_user, nil, clone_for_storage, time, with); if not ok and err == "quota-limit" then - if type(cleanup_after) == "number" then + if cleanup_after ~= math.huge then module:log("debug", "User '%s' over quota, cleaning archive", store_user); local cleaned = archive:delete(store_user, { ["end"] = (os.time() - cleanup_after); @@ -506,7 +506,7 @@ module:hook("message/offline/broadcast", function (event) end end); -if cleanup_after ~= "never" then +if cleanup_after ~= math.huge then local cleanup_storage = module:open_store("archive_cleanup"); local cleanup_map = module:open_store("archive_cleanup", "map"); -- cgit v1.2.3