Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 1564:cb4111a4cd36

mod_http_muc_log: Remove infinity limit
author Kim Alvefur <zash@zash.se>
date Sun, 09 Nov 2014 20:19:36 +0100
parent 1563:49ba05d75119
child 1571:eed7db9f3157
comparison
equal deleted inserted replaced
1563:49ba05d75119 1564:cb4111a4cd36
254 254
255 local logs, i = {}, 1; 255 local logs, i = {}, 1;
256 local iter, err = archive:find(room, { 256 local iter, err = archive:find(room, {
257 ["start"] = datetime.parse(date.."T00:00:00Z"); 257 ["start"] = datetime.parse(date.."T00:00:00Z");
258 ["end"] = datetime.parse(date.."T23:59:59Z"); 258 ["end"] = datetime.parse(date.."T23:59:59Z");
259 limit = math.huge;
260 -- with = "message<groupchat"; 259 -- with = "message<groupchat";
261 }); 260 });
262 if not iter then return 500; end 261 if not iter then return 500; end
263 262
264 local verb, subject, body; 263 local verb, subject, body;
289 local prev_when = ""; 288 local prev_when = "";
290 289
291 module:log("debug", "Find next date with messages"); 290 module:log("debug", "Find next date with messages");
292 for key, message, when in archive:find(room, { 291 for key, message, when in archive:find(room, {
293 ["start"] = datetime.parse(date.."T00:00:00Z") + 86400; 292 ["start"] = datetime.parse(date.."T00:00:00Z") + 86400;
294 limit = math.huge;
295 }) do 293 }) do
296 next_when = datetime.date(when); 294 next_when = datetime.date(when);
297 module:log("debug", "Next message: %s", datetime.datetime(when)); 295 module:log("debug", "Next message: %s", datetime.datetime(when));
298 break; 296 break;
299 end 297 end
300 298
301 module:log("debug", "Find prev date with messages"); 299 module:log("debug", "Find prev date with messages");
302 for key, message, when in archive:find(room, { 300 for key, message, when in archive:find(room, {
303 ["end"] = datetime.parse(date.."T00:00:00Z") - 1; 301 ["end"] = datetime.parse(date.."T00:00:00Z") - 1;
304 limit = math.huge;
305 reverse = true; 302 reverse = true;
306 }) do 303 }) do
307 prev_when = datetime.date(when); 304 prev_when = datetime.date(when);
308 module:log("debug", "Previous message: %s", datetime.datetime(when)); 305 module:log("debug", "Previous message: %s", datetime.datetime(when));
309 break; 306 break;