diff options
| author | Marvin W <git@larma.de> | 2025-07-20 19:32:37 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2025-07-20 19:32:37 +0200 |
| commit | abf4456dd2397f1ed38b64a499615c652872dbee (patch) | |
| tree | aed69ecf5c7af9d8f7fdb2159b26d053f58b45a5 /xmpp-vala/src/module | |
| parent | a4bbcb9ab9ed265841549766fee574ad5d14d29b (diff) | |
User Avatar: Correctly handle multiple avatar sources
Diffstat (limited to 'xmpp-vala/src/module')
| -rw-r--r-- | xmpp-vala/src/module/xep/0084_user_avatars.vala | 12 |
1 files 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) { |
