/usr/share/syncevolution/xml/scripting/05vcard-merge.xml is in syncevolution-common 1.4-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <!-- Special treatment of PHOTO data: keep a local file if it has the
same content as the binary data in the winning item.
Use in combination with a PHOTO field of type="string" (not blob,
because we need to be able to compare the field in the MERGEFIELDS()
call to detect when the data really changes) and compare="conflict"
(not used to find matches, changes are relevant).
-->
<macro name="VCARD_MERGESCRIPT"><![CDATA[
integer mode;
mode = MERGEMODE();
if (SESSIONVAR("keepPhotoData") &&
WINNING.PHOTO == EMPTY &&
LOOSING.PHOTO != EMPTY) {
// The client's item is always the "winning" one in PBAP syncing,
// but it might not have the photo data that is already on the
// server. Therefore keep the server's photo, if there is
// one and we are not in the phase where the client sends
// its photos.
WINNING.PHOTO = LOOSING.PHOTO;
WINNING.PHOTO_TYPE = LOOSING.PHOTO_TYPE;
WINNING.PHOTO_VALUE = LOOSING.PHOTO_VALUE;
} else if (mode == 1 && WINNING.PHOTO == EMPTY) {
// Removing photo from loosing item.
if (LOOSING.PHOTO != EMPTY) {
SETLOOSINGCHANGED(1);
}
LOOSING.PHOTO = EMPTY;
LOOSING.PHOTO_TYPE = "";
LOOSING.PHOTO_VALUE = "";
} else if (LOOSING.PHOTO != EMPTY) {
// Updating photo. Might actually be the same!
if (LOOSING.PHOTO_VALUE == "uri" && (WINNING.PHOTO_VALUE == EMPTY || WINNING.PHOTO_VALUE == "binary")) {
string path;
path = URITOPATH(LOOSING.PHOTO);
if (path) {
if (READ(path) == WINNING.PHOTO) {
// Reuse photo file from loosing item.
// If we need to write back for some other reason, we'll inline the data again.
WINNING.PHOTO = LOOSING.PHOTO;
WINNING.PHOTO_TYPE = LOOSING.PHOTO_TYPE;
WINNING.PHOTO_VALUE = LOOSING.PHOTO_VALUE;
}
}
} else {
LOOSING.PHOTO_VALUE = EMPTY;
LOOSING.PHOTO = EMPTY;
}
}
// Continue merge.
MERGEFIELDS(mode);
]]></macro>
|