# HG changeset patch # User Kim Alvefur # Date 1536275307 -7200 # Node ID f2258e9750cf25c762c37a1ba37f1978d3c7e4c9 # Parent c047be86dd5105436d9f4d2e52cb5efd3574fa4c mod_vcard_legacy: Include avatar data even if metadata can't be loaded Normally both nodes should have the same configuration and matching items, but we can't depend on it without having some code that enforces it, which does not exist at the time of this commit. Including the avatar itself should be prioritised. The image format can be derived from magic bytes. diff -r c047be86dd51 -r f2258e9750cf plugins/mod_vcard_legacy.lua --- a/plugins/mod_vcard_legacy.lua Fri Sep 07 01:06:27 2018 +0200 +++ b/plugins/mod_vcard_legacy.lua Fri Sep 07 01:08:27 2018 +0200 @@ -111,9 +111,10 @@ local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); local data_ok, avatar_data = pep_service:get_items("urn:xmpp:avatar:data", stanza.attr.from); - if meta_ok and data_ok then - for _, hash in ipairs(avatar_meta) do - local meta = avatar_meta[hash]; + + if data_ok then + for _, hash in ipairs(avatar_data) do + local meta = meta_ok and avatar_meta[hash]; local data = avatar_data[hash]; local info = meta and meta.tags[1]:get_child("info"); vcard_temp:tag("PHOTO");