Software /
code /
prosody
Comparison
plugins/mod_vcard_legacy.lua @ 9253:dbe3ae6f9746
mod_vcard_legacy: Include avatar data from XEP-0084 PEP node
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 20 Aug 2018 09:18:21 +0200 |
parent | 9252:292d283c7694 |
child | 9254:2ffbcad8ec50 |
comparison
equal
deleted
inserted
replaced
9252:292d283c7694 | 9253:dbe3ae6f9746 |
---|---|
75 end | 75 end |
76 end | 76 end |
77 end | 77 end |
78 end | 78 end |
79 | 79 |
80 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); | |
81 local data_ok, avatar_data = pep_service:get_items("urn:xmpp:avatar:data", stanza.attr.from); | |
82 if meta_ok and data_ok then | |
83 for _, hash in ipairs(avatar_meta) do | |
84 local meta = avatar_meta[hash]; | |
85 local data = avatar_data[hash]; | |
86 local info = meta.tags[1]:get_child("info"); | |
87 vcard_temp:tag("PHOTO") | |
88 :text_tag("TYPE", info and info.attr.type) | |
89 :text_tag("BINVAL", data.tags[1]:get_text()) | |
90 :up(); | |
91 end | |
92 end | |
93 | |
80 origin.send(st.reply(stanza):add_child(vcard_temp)); | 94 origin.send(st.reply(stanza):add_child(vcard_temp)); |
81 return true; | 95 return true; |
82 end); | 96 end); |
83 | 97 |
84 local function inject_xep153(event) | 98 local function inject_xep153(event) |