Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 1578:a68ec7a2dc02

mod_http_muc_log: Show only messages with presentable content
author Kim Alvefur <zash@zash.se>
date Thu, 20 Nov 2014 20:01:07 +0100
parent 1577:0a6974f2cb55
child 1579:9e784ddac236
comparison
equal deleted inserted replaced
1577:0a6974f2cb55 1578:a68ec7a2dc02
269 for key, item, when in iter do 269 for key, item, when in iter do
270 body = item:get_child_text("body"); 270 body = item:get_child_text("body");
271 subject = item:get_child_text("subject"); 271 subject = item:get_child_text("subject");
272 verb = nil; 272 verb = nil;
273 if subject then 273 if subject then
274 verb = "set the topic to"; 274 verb, body = "set the topic to", subject;
275 elseif body and body:sub(1,4) == "/me " then 275 elseif body and body:sub(1,4) == "/me " then
276 verb, body = body:sub(5), nil; 276 verb, body = body:sub(5), nil;
277 elseif item.name == "presence" then 277 elseif item.name == "presence" then
278 verb = item.attr.type == "unavailable" and "has left" or "has joined"; 278 verb = item.attr.type == "unavailable" and "has left" or "has joined";
279 end 279 end
280 logs[i], i = line_template { 280 if body or verb then
281 key = key; 281 logs[i], i = line_template {
282 datetime = datetime.datetime(when); 282 key = key;
283 time = datetime.time(when); 283 datetime = datetime.datetime(when);
284 verb = verb; 284 time = datetime.time(when);
285 body = subject or body; 285 verb = verb;
286 nick = select(3, jid_split(item.attr.from)); 286 body = body;
287 st_name = item.name; 287 nick = select(3, jid_split(item.attr.from));
288 st_type = item.attr.type; 288 st_name = item.name;
289 }, i + 1; 289 st_type = item.attr.type;
290 }, i + 1;
291 end
290 first = first or key; 292 first = first or key;
291 last = key; 293 last = key;
292 end 294 end
293 if i == 1 then return end -- No items 295 if i == 1 then return end -- No items
294 296