Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 2841:462dece0a3c2

mod_http_muc_log: Parse date out of path once
author Kim Alvefur <zash@zash.se>
date Tue, 21 Nov 2017 00:02:58 +0100
parent 2840:683a2f25223d
child 2842:263c0b044973
comparison
equal deleted inserted replaced
2840:683a2f25223d 2841:462dece0a3c2
189 room = nodeprep(room); 189 room = nodeprep(room);
190 if not room then 190 if not room then
191 return years_page(event, path); 191 return years_page(event, path);
192 end 192 end
193 if not public_room(room) then return end 193 if not public_room(room) then return end
194 local day_start = datetime.parse(date.."T00:00:00Z");
194 195
195 local logs, i = {}, 1; 196 local logs, i = {}, 1;
196 local iter, err = archive:find(room, { 197 local iter, err = archive:find(room, {
197 ["start"] = datetime.parse(date.."T00:00:00Z"); 198 ["start"] = day_start;
198 ["end"] = datetime.parse(date.."T23:59:59Z"); 199 ["end"] = day_start + 86399;
199 }); 200 });
200 if not iter then 201 if not iter then
201 module:log("warn", "Could not search archive: %s", err or "no error"); 202 module:log("warn", "Could not search archive: %s", err or "no error");
202 return 500; 203 return 500;
203 end 204 end