Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 2235:c5ee48e27d01

mod_http_muc_log: Link to next day with content, regardless of type (simplifes)
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jul 2016 22:39:41 +0200
parent 1832:48125f2c358b
child 2236:86bc6e1d9d4d
comparison
equal deleted inserted replaced
2234:3024116d6093 2235:c5ee48e27d01
94 end 94 end
95 else 95 else
96 module:log("debug", "Find all dates with messages"); 96 module:log("debug", "Find all dates with messages");
97 local next_day; 97 local next_day;
98 repeat 98 repeat
99 local when = find_once(room, { start = next_day; with = "message<groupchat"; }, 3); 99 local when = find_once(room, { start = next_day; }, 3);
100 if not when then break; end 100 if not when then break; end
101 local t = os_date("!*t", when); 101 local t = os_date("!*t", when);
102 dates:set(t.year, t.month, t.day, when ); 102 dates:set(t.year, t.month, t.day, when );
103 next_day = when + (86400 - (when % 86400)); 103 next_day = when + (86400 - (when % 86400));
104 until not next_day; 104 until not next_day;
163 163
164 local logs, i = {}, 1; 164 local logs, i = {}, 1;
165 local iter, err = archive:find(room, { 165 local iter, err = archive:find(room, {
166 ["start"] = datetime.parse(date.."T00:00:00Z"); 166 ["start"] = datetime.parse(date.."T00:00:00Z");
167 ["end"] = datetime.parse(date.."T23:59:59Z"); 167 ["end"] = datetime.parse(date.."T23:59:59Z");
168 -- with = "message<groupchat";
169 }); 168 });
170 if not iter then 169 if not iter then
171 module:log("warn", "Could not search archive: %s", err or "no error"); 170 module:log("warn", "Could not search archive: %s", err or "no error");
172 return 500; 171 return 500;
173 end 172 end