Comparison

plugins/mod_vcard_legacy.lua @ 10268:210278d5f995 0.11

mod_vcard_legacy: Advertise lack of avatar correctly (fixes #1431) (thanks lovetox)
author Kim Alvefur <zash@zash.se>
date Sat, 21 Sep 2019 15:20:50 +0200
parent 9814:5eb4ef537e98
child 10269:4701415f5b0e
comparison
equal deleted inserted replaced
10257:26afb1a6d086 10268:210278d5f995
299 if not username then return end 299 if not username then return end
300 if stanza.attr.type then return end 300 if stanza.attr.type then return end
301 local pep_service = mod_pep.get_pep_service(username); 301 local pep_service = mod_pep.get_pep_service(username);
302 302
303 stanza:remove_children("x", "vcard-temp:x:update"); 303 stanza:remove_children("x", "vcard-temp:x:update");
304 local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }); 304 local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }):tag("photo");
305 local ok, avatar_hash = pep_service:get_last_item("urn:xmpp:avatar:metadata", true); 305 local ok, avatar_hash = pep_service:get_last_item("urn:xmpp:avatar:metadata", true);
306 if ok and avatar_hash then 306 if ok and avatar_hash then
307 x_update:text_tag("photo", avatar_hash); 307 x_update:text(avatar_hash);
308 end 308 end
309 stanza:add_direct_child(x_update); 309 stanza:add_direct_child(x_update);
310 end 310 end
311 311
312 module:hook("pre-presence/full", inject_xep153, 1); 312 module:hook("pre-presence/full", inject_xep153, 1);