mod_muc_moderation: Use reserved nickname as fallback
authorKim Alvefur <zash@zash.se>
Sat, 06 Nov 2021 19:03:00 +0100
changeset 4754 98429b646bd4
parent 4753 3a7953a5ee5b
child 4755 16118edbddfe
mod_muc_moderation: Use reserved nickname as fallback When moderation is invoked from a JID that is not joined, the nickname is not known, but we should include it in the broadcast for transparency.
mod_muc_moderation/mod_muc_moderation.lua
--- a/mod_muc_moderation/mod_muc_moderation.lua	Sat Nov 06 16:19:38 2021 +0100
+++ b/mod_muc_moderation/mod_muc_moderation.lua	Sat Nov 06 19:03:00 2021 +0100
@@ -63,6 +63,13 @@
 		return true;
 	end
 
+	if not actor_nick then
+		local reserved_nickname = room:get_affiliation_data(jid.bare(actor), "reserved_nickname");
+		if reserved_nickname then
+			actor_nick = jid.join(room.jid, reserved_nickname);
+		end
+	end
+
 	-- Original stanza to base tombstone on
 	local original, err;
 	if muc_log_archive.get then