comparison mod_profile/mod_profile.lua @ 3321:628659e2e6b0

Backed out changeset 395835d89d88: Might still be needed
author Kim Alvefur <zash@zash.se>
date Sun, 16 Sep 2018 13:08:04 +0200
parents eec70a863d16
children 682b05b4017e
comparison
equal deleted inserted replaced
3320:2333e384409d 3321:628659e2e6b0
59 local function update_pep(username, data, pep) 59 local function update_pep(username, data, pep)
60 pep = pep or pep_plus.get_pep_service(username); 60 pep = pep or pep_plus.get_pep_service(username);
61 local photo, p = get_item(data, "PHOTO"); 61 local photo, p = get_item(data, "PHOTO");
62 if vcard.to_vcard4 then 62 if vcard.to_vcard4 then
63 if p then t_remove(data, p); end 63 if p then t_remove(data, p); end
64 pep:purge("urn:xmpp:vcard4", true)
64 pep:publish("urn:xmpp:vcard4", true, item_container("current", vcard.to_vcard4(data))); 65 pep:publish("urn:xmpp:vcard4", true, item_container("current", vcard.to_vcard4(data)));
65 if p then t_insert(data, p, photo); end 66 if p then t_insert(data, p, photo); end
66 end 67 end
67 68
68 local nickname = get_item(data, "NICKNAME"); 69 local nickname = get_item(data, "NICKNAME");
69 if nickname and nickname[1] then 70 if nickname and nickname[1] then
71 pep:purge("http://jabber.org/protocol/nick", true);
70 pep:publish("http://jabber.org/protocol/nick", true, item_container("current", 72 pep:publish("http://jabber.org/protocol/nick", true, item_container("current",
71 st.stanza("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1]))); 73 st.stanza("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1])));
72 end 74 end
73 75
74 if photo and photo[1] then 76 if photo and photo[1] then
75 local photo_raw = base64.decode(photo[1]); 77 local photo_raw = base64.decode(photo[1]);
76 local photo_hash = sha1(photo_raw, true); 78 local photo_hash = sha1(photo_raw, true);
77 local photo_type = photo.TYPE and photo.TYPE[1]; 79 local photo_type = photo.TYPE and photo.TYPE[1];
78 80
81 pep:purge("urn:xmpp:avatar:metadata", true);
82 pep:purge("urn:xmpp:avatar:data", true);
79 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash, 83 pep:publish("urn:xmpp:avatar:metadata", true, item_container(photo_hash,
80 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" }) 84 st.stanza("metadata", { xmlns="urn:xmpp:avatar:metadata" })
81 :tag("info", { 85 :tag("info", {
82 bytes = tostring(#photo_raw), 86 bytes = tostring(#photo_raw),
83 id = photo_hash, 87 id = photo_hash,