comparison plugins/muc/vcard.lib.lua @ 13941:f4e16e6265e6 13.0

mod_muc: Remove avatar hash caching Computing the hash of the room might be a bit expensive, but this cache was preventing any change from reaching clients, so let’s disable it. Fixes #1961.
author Link Mauve <linkmauve@linkmauve.fr>
date Mon, 08 Sep 2025 12:19:26 +0200
parents 31f8fd2bcab9
children 758dd39c2808
comparison
equal deleted inserted replaced
13940:5f8a9e50c2fb 13941:f4e16e6265e6
8 local advertise_hashes = module:get_option("muc_avatar_advertise_hashes"); 8 local advertise_hashes = module:get_option("muc_avatar_advertise_hashes");
9 9
10 --luacheck: ignore 113/get_room_from_jid 10 --luacheck: ignore 113/get_room_from_jid
11 11
12 local function get_avatar_hash(room) 12 local function get_avatar_hash(room)
13 if room.avatar_hash then return room.avatar_hash; end
14
15 local room_node = jid.split(room.jid); 13 local room_node = jid.split(room.jid);
16 local hash = mod_vcard.get_avatar_hash(room_node); 14 return mod_vcard.get_avatar_hash(room_node);
17 room.avatar_hash = hash;
18
19 return hash;
20 end 15 end
21 16
22 local function send_avatar_hash(room, to) 17 local function send_avatar_hash(room, to)
23 local hash = get_avatar_hash(room); 18 local hash = get_avatar_hash(room);
24 if not hash and to then return; end -- Don't announce when no avatar 19 if not hash and to then return; end -- Don't announce when no avatar