From abf4456dd2397f1ed38b64a499615c652872dbee Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 20 Jul 2025 19:32:37 +0200 Subject: User Avatar: Correctly handle multiple avatar sources --- xmpp-vala/src/module/xep/0084_user_avatars.vala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala index 4d84b34b..680c8e78 100644 --- a/xmpp-vala/src/module/xep/0084_user_avatars.vala +++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala @@ -57,10 +57,14 @@ namespace Xmpp.Xep.UserAvatars { } public void on_pupsub_item(XmppStream stream, Jid jid, string hash, StanzaNode? node) { - StanzaNode? info_node = node.get_subnode("info", NS_URI_METADATA); - string? type = info_node == null ? null : info_node.get_attribute("type"); - if (type != "image/png" && type != "image/jpeg") return; - received_avatar_hash(stream, jid, hash); + foreach (var info_node in node.get_subnodes("info", NS_URI_METADATA)) { + if (info_node.get_attribute("id") == hash) { + string? type = info_node == null ? null : info_node.get_attribute("type"); + if (type != "image/png" && type != "image/jpeg") return; + received_avatar_hash(stream, jid, hash); + return; + } + } } public void on_pubsub_delete(XmppStream stream, Jid jid) { -- cgit v1.3