comparison mod_profile/mod_profile.lua @ 3194:395835d89d88

mod_profile: Remove purging of previous PEP data, should no longer be needed
author Kim Alvefur <zash@zash.se>
date Tue, 24 Jul 2018 17:18:13 +0200
parents 92d80b6ce375
children 149cc5ddc64f
comparison
equal deleted inserted replaced
3193:92d80b6ce375 3194:395835d89d88
58 local function update_pep(username, data, pep) 58 local function update_pep(username, data, pep)
59 pep = pep or pep_plus.get_pep_service(username); 59 pep = pep or pep_plus.get_pep_service(username);
60 local photo, p = get_item(data, "PHOTO"); 60 local photo, p = get_item(data, "PHOTO");
61 if vcard.to_vcard4 then 61 if vcard.to_vcard4 then
62 if p then t_remove(data, p); end 62 if p then t_remove(data, p); end
63 pep:purge("urn:xmpp:vcard4", true)
64 pep:publish("urn:xmpp:vcard4", true, item_container("current", vcard.to_vcard4(data))); 63 pep:publish("urn:xmpp:vcard4", true, item_container("current", vcard.to_vcard4(data)));
65 if p then t_insert(data, p, photo); end 64 if p then t_insert(data, p, photo); end
66 end 65 end
67 66
68 local nickname = get_item(data, "NICKNAME"); 67 local nickname = get_item(data, "NICKNAME");
69 if nickname and nickname[1] then 68 if nickname and nickname[1] then
70 pep:purge("http://jabber.org/protocol/nick", true);
71 pep:publish("http://jabber.org/protocol/nick", true, item_container("current", 69 pep:publish("http://jabber.org/protocol/nick", true, item_container("current",
72 st.stanza("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1]))); 70 st.stanza("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1])));
73 end 71 end
74 72
75 if photo and photo[1] then 73 if photo and photo[1] then
76 local photo_raw = base64.decode(photo[1]); 74 local photo_raw = base64.decode(photo[1]);
77 local photo_hash = sha1(photo_raw, true); 75 local photo_hash = sha1(photo_raw, true);
78 76
79 pep:purge("urn:xmpp:avatar:metadata", true);
80 pep:purge("urn:xmpp:avatar:data", true);
81 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash, 77 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash,
82 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" }) 78 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" })
83 :tag("info", { 79 :tag("info", {
84 bytes = tostring(#photo_raw), 80 bytes = tostring(#photo_raw),
85 id = photo_hash, 81 id = photo_hash,