Skip to content

Commit

Permalink
generate_log: minor refactor...
Browse files Browse the repository at this point in the history
- Increase handled max messages per day log to 5000
- At least show a placemarker for XHTML-IM messages that (wrongly) don't have a plain body variant, since we don't yet have a way to do sanitization of XHTML-IM content
  • Loading branch information
maranda committed Apr 9, 2020
1 parent 67d332d commit 5ec29ad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/muc_log_http/generate_log
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,20 @@ day_t, day_m, day_mm, day_title = html_day.time, html_day.message, html_day.mess
data = datamanager.load(node, host, "muc_log" .. "/" .. date);
if not data then
ret = "";
elseif data and #data <= 3000 then
elseif data and #data <= 5000 then
for i, entry in ipairs(data) do
local label, actions, dont_add = entry.label_name, entry.label_actions;
if label and (not actions or actions == "none" or (type(actions) == "table" and actions.type == "groupchat")) then
dont_add = true;
end
if not dont_add then
local tmp = parse_message(entry.body, entry.subject, entry.time, entry.from, day_t, day_m, day_mm, day_title);
local body;
if not entry.body and entry.html then
body = "[This is XHTML-IM message without a plain body variant, can't show it]";
else
body = entry.body;
end
local tmp = parse_message(body, entry.subject, entry.time, entry.from, day_t, day_m, day_mm, day_title);
if tmp then ret = ret .. tmp; end
end
end
Expand Down

0 comments on commit 5ec29ad

Please sign in to comment.