diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-07 01:08:27 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-07 01:08:27 +0200 |
commit | 3d0909ee7d595b2f3fde73407624c03fc12a24ef (patch) | |
tree | 66b6473a9220fe4874ecb2471386f7c7b76aa9c9 /plugins | |
parent | 7032c73db013dd8f9906e21f0ab917058685e738 (diff) | |
download | prosody-3d0909ee7d595b2f3fde73407624c03fc12a24ef.tar.gz prosody-3d0909ee7d595b2f3fde73407624c03fc12a24ef.zip |
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.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index 40d81e66..a59d0c26 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -111,9 +111,10 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event) 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"); |