Software /
code /
prosody-modules
Comparison
mod_profile/mod_profile.lua @ 1423:4852fc446d26
mod_profile: Use the item id "current" as recomended in the Singleton Nodes section of XEP-0060
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 30 May 2014 14:57:34 +0200 |
parent | 1422:c3882787ae06 |
child | 1424:9892a537e7fc |
comparison
equal
deleted
inserted
replaced
1422:c3882787ae06 | 1423:4852fc446d26 |
---|---|
43 | 43 |
44 local function update_pep(username, data) | 44 local function update_pep(username, data) |
45 local pep = pep_plus.get_pep_service(username.."@"..module.host); | 45 local pep = pep_plus.get_pep_service(username.."@"..module.host); |
46 if vcard.to_vcard4 then | 46 if vcard.to_vcard4 then |
47 pep:purge("urn:xmpp:vcard4", true); | 47 pep:purge("urn:xmpp:vcard4", true); |
48 pep:publish("urn:xmpp:vcard4", true, "", st.stanza("item"):add_child(vcard.to_vcard4(data))); | 48 pep:publish("urn:xmpp:vcard4", true, "current", st.stanza("item"):add_child(vcard.to_vcard4(data))); |
49 end | 49 end |
50 | 50 |
51 local nickname = get_item(data, "NICKNAME"); | 51 local nickname = get_item(data, "NICKNAME"); |
52 if nickname and nickname[1] then | 52 if nickname and nickname[1] then |
53 pep:purge("http://jabber.org/protocol/nick", true); | 53 pep:purge("http://jabber.org/protocol/nick", true); |
54 pep:publish("http://jabber.org/protocol/nick", true, "", st.stanza("item") | 54 pep:publish("http://jabber.org/protocol/nick", true, "current", st.stanza("item") |
55 :tag("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1])); | 55 :tag("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1])); |
56 end | 56 end |
57 | 57 |
58 local photo = get_item(data, "PHOTO"); | 58 local photo = get_item(data, "PHOTO"); |
59 if photo and photo[1] then | 59 if photo and photo[1] then |
60 local photo_raw = base64.decode(photo[1]); | 60 local photo_raw = base64.decode(photo[1]); |
61 local photo_hash = sha1(photo_raw, true); | 61 local photo_hash = sha1(photo_raw, true); |
62 | 62 |
63 pep:purge("urn:xmpp:avatar:metadata", true); | 63 pep:purge("urn:xmpp:avatar:metadata", true); |
64 pep:purge("urn:xmpp:avatar:data", true); | 64 pep:purge("urn:xmpp:avatar:data", true); |
65 pep:publish("urn:xmpp:avatar:metadata", true, "", st.stanza("item") | 65 pep:publish("urn:xmpp:avatar:metadata", true, "current", st.stanza("item") |
66 :tag("metadata", { | 66 :tag("metadata", { |
67 xmlns="urn:xmpp:avatar:metadata", | 67 xmlns="urn:xmpp:avatar:metadata", |
68 bytes = tostring(#photo_raw), | 68 bytes = tostring(#photo_raw), |
69 id = photo_hash, | 69 id = photo_hash, |
70 type = identify(photo_raw), | 70 type = identify(photo_raw), |