# HG changeset patch # User Kim Alvefur # Date 1510932653 -3600 # Node ID ed26608920d47080b8f95bec48d2affececc0ce0 # Parent d0c4ecabf3f551e7025461ec5540924ce4e3e3f1 mod_http_muc_log: Switch to an inaccurate but O(1) method of producing the calendar view diff -r d0c4ecabf3f5 -r ed26608920d4 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Wed Nov 15 22:21:14 2017 +0100 +++ b/mod_http_muc_log/mod_http_muc_log.lua Fri Nov 17 16:30:53 2017 +0100 @@ -77,6 +77,8 @@ return iter(); end +local lazy = module:get_option_boolean(module.name .. "_lazy_calendar", true); + -- Produce the calendar view local function years_page(event, path) local response = event.response; @@ -94,6 +96,14 @@ local t = os_date("!*t", when); dates:set(t.year, t.month, t.day, when); end + elseif lazy then + -- Lazy with many false positives + local first_day = find_once(room, nil, 3); + local last_day = find_once(room, { reverse = true }, 3); + for when = first_day, last_day, 86400 do + local t = os_date("!*t", when); + dates:set(t.year, t.month, t.day, when ); + end else -- Collect date the hard way module:log("debug", "Find all dates with messages");