/usr/share/syncevolution/xml/scripting/05vcard-evolution.xml is in syncevolution-common 1.4.99.4-3.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | <macro name="VCARD_BEFOREWRITE_SCRIPT_EVOLUTION"><![CDATA[
// a wordaround for cellphone in evolution. for incoming contacts, if there is only one CELL,
// strip the HOME or WORK flag from it. Evolution then should show it. */
INTEGER i, wanted, cell_phones;
i = 0;
cell_phones = 0;
while(i < SIZE(TEL_FLAGS)) {
// 0x10 is the flag of 'cell' type of telephone
if(TEL_FLAGS[i] & 0x10) {
cell_phones = cell_phones + 1;
wanted = i;
}
i = i + 1;
}
if(cell_phones == 1) {
TEL_FLAGS[wanted] = 0x10;
}
// Google sends TYPE=WORK and TYPE=HOME when it means
// normal VOICE phone numbers. Add that flag when
// importing into Evolution, because Evolution does not
// display the numbers without VOICE.
i = 0;
while(i < SIZE(TEL_FLAGS)) {
if(TEL_FLAGS[i] == 1 || TEL_FLAGS[i] == 2) {
TEL_FLAGS[i] = TEL_FLAGS[i] | 8;
}
i = i + 1;
}
if (N_LAST == EMPTY && N_FIRST == EMPTY && N_MIDDLE == EMPTY) {
// split full name (FN) into first/middle/last components (N)
// when those are empty, because Evolution and MeeGo UX depend on them
integer i;
// split at spaces
string words[];
integer numwords;
string name;
integer start;
integer space;
integer namelen;
name = NORMALIZED(FN);
namelen = SIZE(name);
start = 0;
numwords = 0;
while (TRUE) {
space = FIND(name, " ", start);
if (space) {
words[numwords] = SUBSTR(name, start, space - start);
numwords = numwords + 1;
start = space + 1;
name;
while (SUBSTR(name, start, 1) == " ") {
start = start + 1;
}
} else {
if (start < namelen) {
words[numwords] = SUBSTR(name, start);
numwords = numwords + 1;
}
break;
}
}
if (numwords == 0) {
// use email address, phone number, etc. as fallback
N_FIRST = EMAIL[0];
if (N_FIRST == EMPTY) {
N_FIRST = TEL[0];
}
} else if (numwords == 1) {
N_FIRST = words[0];
} else {
// start and end index of middle name(s), both inclusive
integer startmiddle;
integer endmiddle;
name = words[0];
namelen = SIZE(name);
// last name given first as in "Doe, John"?
if (SUBSTR(name, namelen - 1, 1) == ",") {
N_LAST = SUBSTR(name, 0, namelen - 1);
N_FIRST = words[1];
startmiddle = 2;
endmiddle = numwords - 1;
} else {
N_FIRST = name;
startmiddle = 1;
endmiddle = numwords - 2;
N_LAST = words[numwords - 1];
}
if (endmiddle >= startmiddle) {
N_MIDDLE = words[startmiddle];
startmiddle = startmiddle + 1;
while (endmiddle >= startmiddle) {
N_MIDDLE = N_MIDDLE + " " + words[startmiddle];
startmiddle = startmiddle + 1;
}
}
}
}
// Ensure that FILE-AS is set. Some EDS versions will set it,
// so we need to do the same to ensure that incoming items
// match DB items during a slow sync.
if (FILE_AS == EMPTY) {
FILE_AS = N_LAST;
if (N_FIRST != EMPTY) {
if (FILE_AS != EMPTY) {
FILE_AS = FILE_AS + ", ";
}
FILE_AS = FILE_AS + N_FIRST;
}
}
$VCARD_OUTGOING_PHOTO_VALUE_SCRIPT;
]]></macro>
<macro name="VCARD_AFTERREAD_SCRIPT_EVOLUTION"><![CDATA[
$VCARD_INCOMING_PHOTO_VALUE_SCRIPT;
]]></macro>
|