diff options
author | Kim Alvefur <zash@zash.se> | 2019-09-21 16:50:29 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-09-21 16:50:29 +0200 |
commit | 05ec84974f71fe632f6000d8edf55262f5388138 (patch) | |
tree | 40b22469e78321dfd44d5528ccc33d3eeb115019 /plugins | |
parent | ac208e0520994fcab9761057d3c9dded5a439d2d (diff) | |
parent | ae7a763b275c6306e6c6dcb19e624c1255158d8e (diff) | |
download | prosody-05ec84974f71fe632f6000d8edf55262f5388138.tar.gz prosody-05ec84974f71fe632f6000d8edf55262f5388138.zip |
Merge 0.11->trunk
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index 91497493..6bae3ee5 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -321,13 +321,19 @@ local function inject_xep153(event) if stanza.attr.type then return end local pep_service = mod_pep.get_pep_service(username); - stanza:remove_children("x", "vcard-temp:x:update"); - local x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }); + local x_update = stanza:get_child("x", "vcard-temp:x:update"); + if not x_update then + x_update = st.stanza("x", { xmlns = "vcard-temp:x:update" }):tag("photo"); + stanza:add_direct_child(x_update); + elseif x_update:get_child("photo") then + return; -- XEP implies that these should be left alone + else + x_update:tag("photo"); + end local ok, avatar_hash = pep_service:get_last_item("urn:xmpp:avatar:metadata", true); if ok and avatar_hash then - x_update:text_tag("photo", avatar_hash); + x_update:text(avatar_hash); end - stanza:add_direct_child(x_update); end module:hook("pre-presence/full", inject_xep153, 1); |