Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 4592:38f501dca618

mod_http_muc_log: Find edit relations using XEP-0308
author Kim Alvefur <zash@zash.se>
date Tue, 15 Jun 2021 17:35:56 +0200
parent 4590:3145823992cb
child 4676:a2cf3b69a3d6
comparison
equal deleted inserted replaced
4591:327c7cacd89f 4592:38f501dca618
328 end 328 end
329 329
330 local nick = select(3, jid_split(item.attr.from)); 330 local nick = select(3, jid_split(item.attr.from));
331 local oob = use_oob and item:get_child("x", "jabber:x:oob"); 331 local oob = use_oob and item:get_child("x", "jabber:x:oob");
332 332
333 local edit = item:find("{urn:xmpp:message-correct:0}replace/@id");
334 if edit then
335 local found = false;
336 for n = i-1, 1, -1 do
337 if not logs[n] then
338 break; -- Probably reached logs[0]
339 elseif logs[n].id == edit and nick == logs[n].nick then
340 found = true;
341 logs[n].edited = key;
342 edit = logs[n].key;
343 break;
344 end
345 end
346 if not found then
347 -- Ignore unresolved edit.
348 edit = nil;
349 end
350 end
351
333 if body or verb or oob then 352 if body or verb or oob then
334 local line = { 353 local line = {
354 id = item.attr.id,
335 key = key; 355 key = key;
336 datetime = datetime.datetime(when); 356 datetime = datetime.datetime(when);
337 time = datetime.time(when); 357 time = datetime.time(when);
338 verb = verb; 358 verb = verb;
339 body = body; 359 body = body;
340 lang = lang; 360 lang = lang;
341 nick = nick; 361 nick = nick;
342 st_name = item.name; 362 st_name = item.name;
343 st_type = item.attr.type; 363 st_type = item.attr.type;
364 edit = edit;
344 }; 365 };
345 if oob then 366 if oob then
346 line.oob = { 367 line.oob = {
347 url = oob:get_child_text("url"); 368 url = oob:get_child_text("url");
348 desc = oob:get_child_text("desc"); 369 desc = oob:get_child_text("desc");