aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_vcard_legacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-01-25 23:27:23 +0100
committerKim Alvefur <zash@zash.se>2019-01-25 23:27:23 +0100
commit38564bdc80e3b2489ef3c43b149502b41c8d51b1 (patch)
treee99d2fee5616813a6015671251974029449c722a /plugins/mod_vcard_legacy.lua
parentd80ab9dd577c93cf3d718116b64eab06ccb42f5e (diff)
downloadprosody-38564bdc80e3b2489ef3c43b149502b41c8d51b1.tar.gz
prosody-38564bdc80e3b2489ef3c43b149502b41c8d51b1.zip
mod_vcard_legacy: Don't overwrite existing PEP data
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r--plugins/mod_vcard_legacy.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index a738a5f7..633b7729 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -315,8 +315,15 @@ module:hook("resource-bind", function (event)
session.log("debug", "No legacy vCard to migrate or already migrated");
return;
end
- vcard_temp = st.deserialize(vcard_temp);
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 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");