Mercurial > prosody-modules
comparison mod_profile/mod_profile.lua @ 3245:1d57f485efef
mod_profile: Use type property over content identifiguesstimation
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 20 Aug 2018 21:20:53 +0200 |
| parents | e55172ce68d4 |
| children | 2a54b331f011 |
comparison
equal
deleted
inserted
replaced
| 3244:2b888a7aa21c | 3245:1d57f485efef |
|---|---|
| 72 end | 72 end |
| 73 | 73 |
| 74 if photo and photo[1] then | 74 if photo and photo[1] then |
| 75 local photo_raw = base64.decode(photo[1]); | 75 local photo_raw = base64.decode(photo[1]); |
| 76 local photo_hash = sha1(photo_raw, true); | 76 local photo_hash = sha1(photo_raw, true); |
| 77 local photo_type = photo.TYPE and photo.TYPE[1]; | |
| 77 | 78 |
| 78 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash, | 79 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash, |
| 79 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" }) | 80 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" }) |
| 80 :tag("info", { | 81 :tag("info", { |
| 81 bytes = tostring(#photo_raw), | 82 bytes = tostring(#photo_raw), |
| 82 id = photo_hash, | 83 id = photo_hash, |
| 83 type = identify(photo_raw), | 84 type = photo_type or identify(photo_raw), |
| 84 }))); | 85 }))); |
| 85 pep:publish("urn:xmpp:avatar:data", true, item_container(photo_hash, | 86 pep:publish("urn:xmpp:avatar:data", true, item_container(photo_hash, |
| 86 st.stanza("data", { xmlns="urn:xmpp:avatar:data" }):text(photo[1]))); | 87 st.stanza("data", { xmlns="urn:xmpp:avatar:data" }):text(photo[1]))); |
| 87 end | 88 end |
| 88 end | 89 end |
