Mercurial > prosody-hg
comparison plugins/muc/vcard.lib.lua @ 13943:758dd39c2808 13.0
mod_muc: Revert f4e16e6265e6 and invalidate avatar cache only on vcard change
This should be the proper fix for this issue.
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Mon, 08 Sep 2025 15:01:50 +0200 |
| parents | f4e16e6265e6 |
| children | 5365227852ce |
comparison
equal
deleted
inserted
replaced
| 13941:f4e16e6265e6 | 13943:758dd39c2808 |
|---|---|
| 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 | |
| 13 local room_node = jid.split(room.jid); | 15 local room_node = jid.split(room.jid); |
| 14 return mod_vcard.get_avatar_hash(room_node); | 16 local hash = mod_vcard.get_avatar_hash(room_node); |
| 17 room.avatar_hash = hash; | |
| 18 | |
| 19 return hash; | |
| 15 end | 20 end |
| 16 | 21 |
| 17 local function send_avatar_hash(room, to) | 22 local function send_avatar_hash(room, to) |
| 18 local hash = get_avatar_hash(room); | 23 local hash = get_avatar_hash(room); |
| 19 if not hash and to then return; end -- Don't announce when no avatar | 24 if not hash and to then return; end -- Don't announce when no avatar |
| 60 module:hook("muc-occupant-joined", function (event) | 65 module:hook("muc-occupant-joined", function (event) |
| 61 send_avatar_hash(event.room, event.stanza.attr.from); | 66 send_avatar_hash(event.room, event.stanza.attr.from); |
| 62 end); | 67 end); |
| 63 module:hook("vcard-updated", function (event) | 68 module:hook("vcard-updated", function (event) |
| 64 local room = get_room_from_jid(event.stanza.attr.to); | 69 local room = get_room_from_jid(event.stanza.attr.to); |
| 70 room.avatar_hash = nil; | |
| 65 send_avatar_hash(room, nil); | 71 send_avatar_hash(room, nil); |
| 66 end); | 72 end); |
| 67 end | 73 end |
| 68 | 74 |
| 69 module:hook("muc-disco#info", function (event) | 75 module:hook("muc-disco#info", function (event) |
