# HG changeset patch # User Kim Alvefur # Date 1548455243 -3600 # Node ID 330a937e085ea2d146e8b689f7b62875cba08781 # Parent ce6eb482eb50b66dc8b7d275ab90beaae855e806 mod_vcard_legacy: Don't overwrite existing PEP data diff -r ce6eb482eb50 -r 330a937e085e plugins/mod_vcard_legacy.lua --- a/plugins/mod_vcard_legacy.lua Fri Jan 25 23:21:13 2019 +0100 +++ b/plugins/mod_vcard_legacy.lua Fri Jan 25 23:27:23 2019 +0100 @@ -315,8 +315,15 @@ session.log("debug", "No legacy vCard to migrate or already migrated"); return; end + local pep_service = mod_pep.get_pep_service(username); + if pep_service:get_last_item("urn:xmpp:vcard4", true) + or pep_service:get_last_item("urn:xmpp:avatar:metadata", true) + or pep_service:get_last_item("urn:xmpp:avatar:data", true) then + session.log("debug", "Already PEP data, not overwriting with migrated data"); + vcards:set(username, nil); + return; + end vcard_temp = st.deserialize(vcard_temp); - local pep_service = mod_pep.get_pep_service(username); local ok, err = save_to_pep(pep_service, true, vcard_to_pep(vcard_temp)); if ok and vcards:set(username, nil) then session.log("info", "Migrated vCard-temp to PEP");