Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 4986:3bcefa9cf1ca

mod_http_muc_log: Mention relevant XEPs in comments
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2022 17:14:43 +0200
parent 4970:8c7b7db69f5b
child 4987:8a8ec909ac20
comparison
equal deleted inserted replaced
4985:bade04ef0a22 4986:3bcefa9cf1ca
321 verb = item.attr.type == "unavailable" and "has left" or "has joined"; 321 verb = item.attr.type == "unavailable" and "has left" or "has joined";
322 lang = "en"; 322 lang = "en";
323 end 323 end
324 324
325 local nick = select(3, jid_split(item.attr.from)); 325 local nick = select(3, jid_split(item.attr.from));
326
327 -- XEP-0066: Out of Band Data
326 local oob = use_oob and item:get_child("x", "jabber:x:oob"); 328 local oob = use_oob and item:get_child("x", "jabber:x:oob");
327 329
330 -- XEP-0425: Message Moderation
328 local moderated = item:get_child("moderated", "urn:xmpp:message-moderate:0"); 331 local moderated = item:get_child("moderated", "urn:xmpp:message-moderate:0");
329 if moderated then 332 if moderated then
330 local actor = moderated.attr.by; 333 local actor = moderated.attr.by;
331 if actor then actor = select(3, jid_split(actor)); end 334 if actor then actor = select(3, jid_split(actor)); end
332 verb = "removed by " .. (actor or "moderator"); 335 verb = "removed by " .. (actor or "moderator");
338 nick = nick or "a moderator"; 341 nick = nick or "a moderator";
339 verb = "removed a message"; 342 verb = "removed a message";
340 body = moderation:get_child_text("reason") or ""; 343 body = moderation:get_child_text("reason") or "";
341 end 344 end
342 345
346 -- XEP-0308: Last Message Correction
343 local edit = item:find("{urn:xmpp:message-correct:0}replace/@id"); 347 local edit = item:find("{urn:xmpp:message-correct:0}replace/@id");
344 if edit then 348 if edit then
345 local found = false; 349 local found = false;
346 for n = i-1, 1, -1 do 350 for n = i-1, 1, -1 do
347 if not logs[n] then 351 if not logs[n] then
357 -- Ignore unresolved edit. 361 -- Ignore unresolved edit.
358 edit = nil; 362 edit = nil;
359 end 363 end
360 end 364 end
361 365
366 -- XEP-0444: Message Reactions
362 local reactions = item:get_child("reactions", "urn:xmpp:reactions:0"); 367 local reactions = item:get_child("reactions", "urn:xmpp:reactions:0");
363 if reactions then 368 if reactions then
364 -- COMPAT Movim uses an @to attribute instead of the correct @id 369 -- COMPAT Movim uses an @to attribute instead of the correct @id
365 local target_id = reactions.attr.id or reactions.attr.to; 370 local target_id = reactions.attr.id or reactions.attr.to;
366 for n = i - 1, 1, -1 do 371 for n = i - 1, 1, -1 do