changeset 13945:b609c777956a

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 12 Sep 2025 17:05:42 +0200
parents bf49d1136235 (current diff) 5365227852ce (diff)
children f5e8ab42c708
files
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/vcard.lib.lua	Mon Sep 08 13:25:53 2025 +0200
+++ b/plugins/muc/vcard.lib.lua	Fri Sep 12 17:05:42 2025 +0200
@@ -10,8 +10,13 @@
 --luacheck: ignore 113/get_room_from_jid
 
 local function get_avatar_hash(room)
+	if room.avatar_hash then return room.avatar_hash; end
+
 	local room_node = jid.split(room.jid);
-	return mod_vcard.get_avatar_hash(room_node);
+	local hash = mod_vcard.get_avatar_hash(room_node);
+	room.avatar_hash = hash;
+
+	return hash;
 end
 
 local function send_avatar_hash(room, to)
@@ -57,11 +62,12 @@
 end, 10);
 
 if advertise_hashes ~= "none" then
-	module:hook("muc-occupant-joined", function (event)
+	module:hook("muc-occupant-session-new", function (event)
 		send_avatar_hash(event.room, event.stanza.attr.from);
 	end);
 	module:hook("vcard-updated", function (event)
 		local room = get_room_from_jid(event.stanza.attr.to);
+		room.avatar_hash = nil;
 		send_avatar_hash(room, nil);
 	end);
 end