diff options
author | Kim Alvefur <zash@zash.se> | 2018-08-20 09:18:21 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-08-20 09:18:21 +0200 |
commit | 046c7917f2cccdde7dcccb660ad5f36562053ad5 (patch) | |
tree | a6f1101a530f40436261aa9f40129efda2425d4c /plugins/mod_vcard_legacy.lua | |
parent | a28e20077f5e58afc86e77b20785ddcc984127ca (diff) | |
download | prosody-046c7917f2cccdde7dcccb660ad5f36562053ad5.tar.gz prosody-046c7917f2cccdde7dcccb660ad5f36562053ad5.zip |
mod_vcard_legacy: Include avatar data from XEP-0084 PEP node
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index c44c2520..51d722b9 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -77,6 +77,20 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event) end end + 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]; + local data = avatar_data[hash]; + local info = meta.tags[1]:get_child("info"); + vcard_temp:tag("PHOTO") + :text_tag("TYPE", info and info.attr.type) + :text_tag("BINVAL", data.tags[1]:get_text()) + :up(); + end + end + origin.send(st.reply(stanza):add_child(vcard_temp)); return true; end); |