diff mod_http_muc_log/mod_http_muc_log.lua @ 4781:306066898e5f

mod_http_muc_log: Show messages moderated using XEP-0425
author Kim Alvefur <zash@zash.se>
date Mon, 22 Nov 2021 21:01:53 +0100
parents 823370bc2e4c
children 13070c6a7ce8
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Fri Nov 19 17:00:38 2021 +0000
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Mon Nov 22 21:01:53 2021 +0100
@@ -330,6 +330,21 @@
 		local nick = select(3, jid_split(item.attr.from));
 		local oob = use_oob and item:get_child("x", "jabber:x:oob");
 
+		local moderated = item:get_child("moderated", "urn:xmpp:message-moderate:0");
+		if moderated then
+			local actor = moderated.attr.by;
+			if actor then actor = select(3, jid_split(actor)); end
+			verb = "removed by " .. (actor or "moderator");
+			body = moderated:get_child_text("reason") or "";
+		end
+
+		local moderation = item:find("{urn:xmpp:fasten:0}apply-to/{urn:xmpp:message-moderate:0}moderated");
+		if moderation then
+			nick = nick or "a moderator";
+			verb = "removed a message";
+			body = moderation:get_child_text("reason") or "";
+		end
+
 		local edit = item:find("{urn:xmpp:message-correct:0}replace/@id");
 		if edit then
 			local found = false;