Mercurial > prosody-modules
comparison mod_profile/mod_profile.lua @ 1503:c4c9ccc6e6c9
mod_profile: Set metadata nodes ItemID to the same hash as the data node
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 16 Sep 2014 16:23:15 +0200 |
| parents | 698686dca982 |
| children | f367d7cbfaa6 |
comparison
equal
deleted
inserted
replaced
| 1502:72ef98818b90 | 1503:c4c9ccc6e6c9 |
|---|---|
| 65 local photo_raw = base64.decode(photo[1]); | 65 local photo_raw = base64.decode(photo[1]); |
| 66 local photo_hash = sha1(photo_raw, true); | 66 local photo_hash = sha1(photo_raw, true); |
| 67 | 67 |
| 68 pep:purge("urn:xmpp:avatar:metadata", true); | 68 pep:purge("urn:xmpp:avatar:metadata", true); |
| 69 pep:purge("urn:xmpp:avatar:data", true); | 69 pep:purge("urn:xmpp:avatar:data", true); |
| 70 pep:publish("urn:xmpp:avatar:metadata", true, "current", st.stanza("item", {id="current"}) | 70 pep:publish("urn:xmpp:avatar:metadata", true, photo_hash, st.stanza("item", {id=photo_hash}) |
| 71 :tag("metadata", { xmlns="urn:xmpp:avatar:metadata" }) | 71 :tag("metadata", { xmlns="urn:xmpp:avatar:metadata" }) |
| 72 :tag("info", { | 72 :tag("info", { |
| 73 bytes = tostring(#photo_raw), | 73 bytes = tostring(#photo_raw), |
| 74 id = photo_hash, | 74 id = photo_hash, |
| 75 type = identify(photo_raw), | 75 type = identify(photo_raw), |
