aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-20 09:18:21 +0200
committerKim Alvefur <zash@zash.se>2018-08-20 09:18:21 +0200
commita275605b5fd7ceb9561ad9b5127eb2a020d7d53f (patch)
treea6f1101a530f40436261aa9f40129efda2425d4c
parent30d35c0029d273e2778b7dd0d91f265626c44d53 (diff)
downloadprosody-a275605b5fd7ceb9561ad9b5127eb2a020d7d53f.tar.gz
prosody-a275605b5fd7ceb9561ad9b5127eb2a020d7d53f.zip
mod_vcard_legacy: Include avatar data from XEP-0084 PEP node
-rw-r--r--plugins/mod_vcard_legacy.lua14
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);