/usr/share/syncevolution/xml/scripting/11vcard.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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | <macro name="VCARD_BEFOREWRITE_SCRIPT"><![CDATA[
if (UID == EMPTY) { UID = newuid(); }
$VCARD_OUTGOING_PHOTO_VALUE_SCRIPT;
]]></macro>
<macro name="NEWTAG"><![CDATA[
INTEGER newtag;
newtag = 1;
while (TRUE) {
$1 = "item" + newtag;
if (!CONTAINS($2, $1)) {
break;
}
newtag = newtag + 1;
}
]]></macro>
<macro name="VCARD_AFTERREAD_SCRIPT"><![CDATA[
$VCARD_INCOMING_PHOTO_VALUE_SCRIPT;
]]></macro>
<!-- moves an IMPP value to a specific legacy field -->
<macro name="VCARD_MODERN_TO_LEGACY_IMPP"><![CDATA[
INTEGER impp_index;
impp_index = SIZE($2);
SWAP($1, $2[impp_index]);
SWAP(IMPP_SLOT[$4], $3[impp_index]);
IMPP[$4] = UNASSIGNED;
]]></macro>
<!-- convert from IMPP to X- fields, XDATE to ANNIVERSARY, etc. -->
<macro name="VCARD_MODERN_TO_LEGACY"><![CDATA[
INTEGER i;
STRING s;
// Special X-ABDATE -> X-ANNIVERSARY.
i = SIZE(XDATE) - 1;
while (i >= 0) {
if (GROUP_TAG[i] != EMPTY &&
XDATE[i] != UNASSIGNED &&
LABEL[i] == "Anniversary") {
SWAP(ANNIVERSARY, XDATE[i]);
// XDATE[i] = UNASSIGNED;
break;
}
i = i - 1;
}
// Special X-ABRELATEDNAMES -> X-SPOUSE/MANAGER/ASSISTANT
i = SIZE(RELATEDNAMES) - 1;
while (i >= 0) {
if (GROUP_TAG[i] != EMPTY &&
RELATEDNAMES[i] != UNASSIGNED) {
s = LABEL[i];
if (s == "Spouse") {
if (SPOUSE == EMPTY) {
SWAP(SPOUSE, RELATEDNAMES[i]);
// RELATEDNAMES[i] = UNASSIGNED;
}
} else if (s == "Manager") {
if (MANAGER == EMPTY) {
SWAP(MANAGER, RELATEDNAMES[i]);
// RELATEDNAMES[i] = UNASSIGNED;
}
} else if (s == "Assistant") {
if (ASSISTANT == EMPTY) {
SWAP(ASSISTANT, RELATEDNAMES[i]);
// RELATEDNAMES[i] = UNASSIGNED;
}
}
}
i = i - 1;
}
// IMPP -> X-JABBER/AIM/... depending on service type. Protocol must match.
i = SIZE(IMPP) - 1;
INTEGER offset;
STRING service;
STRING protocol;
STRING value;
while (i >= 0) {
service = IMPP_SERVICE[i];
if (service != UNASSIGNED) {
offset = FIND(IMPP[i], ":");
if (offset != UNASSIGNED) {
protocol = SUBSTR(IMPP[i], 0, offset);
value = URLDECODE(SUBSTR(IMPP[i], offset + 1));
if (service == "AIM" && protocol == "aim") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, AIM_HANDLE, AIM_SLOT, i);
} else if (service == "Gadugadu") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, GADUGADU_HANDLE, GADUGADU_SLOT, i);
} else if (service == "Groupwise") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, GROUPWISE_HANDLE, GROUPWISE_SLOT, i);
} else if (service == "ICQ" && protocol == "aim") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, ICQ_HANDLE, ICQ_SLOT, i);
} else if (service == "Jabber" && protocol == "xmpp") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, JABBER_HANDLE, JABBER_SLOT, i);
} else if (service == "MSN" && protocol == "msnim") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, MSN_HANDLE, MSN_SLOT, i);
} else if (service == "Yahoo" && protocol == "ymsgr") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, YAHOO_HANDLE, YAHOO_SLOT, i);
} else if (service == "Skype" && protocol == "skype") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, SKYPE_HANDLE, SKYPE_SLOT, i);
} else if (service == "Sip") {
$VCARD_MODERN_TO_LEGACY_IMPP(value, SIP_HANDLE, SIP_SLOT, i);
}
}
}
i = i - 1;
}
// Remove labels which are no longer needed (valued moved above,
// stored for a group which has no other properties (Google
// CardDAV server sometimes sends that, editing in Evolution
// might cause it, etc.) or provide no information ("Other").
i = SIZE(LABEL) - 1;
while (i >= 0) {
if (LABEL[i] == "Other" ||
LABEL[i] != UNASSIGNED &&
(GROUP_TAG[i] == EMPTY ||
RELATEDNAMES[i] == UNASSIGNED &&
XDATE[i] == UNASSIGNED &&
TEL[i] == UNASSIGNED &&
EMAIL[i] == UNASSIGNED &&
WEB[i] == UNASSIGNED &&
XDATE[i] == UNASSIGNED &&
IMPP[i] == UNASSIGNED &&
ADR_POBOX[i] == UNASSIGNED &&
ADR_ADDTL[i] == UNASSIGNED &&
ADR_STREET[i] == UNASSIGNED &&
ADR_CITY[i] == UNASSIGNED &&
ADR_REG[i] == UNASSIGNED &&
ADR_ZIP[i] == UNASSIGNED &&
ADR_COUNTRY[i] == UNASSIGNED &&
ADR_STREET_FLAGS[i] == UNASSIGNED)) {
LABEL[i] = UNASSIGNED;
}
i = i - 1;
}
// Remove all group tags. Not used for legacy formats.
GROUP_TAG = UNASSIGNED;
]]></macro>
<!-- The legacy->modern conversion ignores empty property values
because we would not encode them as empty
IMPP/X-ABDATE/X-ABRELATEDNAMES values anyway
(<noemptyproperties>), leaving us with just the redundant labels.
-->
<!-- X-SPOUSE/MANAGER/ASSISTANT -> special X-ABRELATEDNAMES -->
<macro name="VCARD_LEGACY_TO_MODERN_RELATEDNAMES"><![CDATA[
if ($1 != EMPTY) {
// STRING tag;
INTEGER num;
num = SIZE(LABEL);
// $NEWTAG(tag, GROUP_TAG);
SWAP(RELATEDNAMES[num], $1);
LABEL[num] = $2;
// GROUP_TAG[num] = tag;
// $1 = UNASSIGNED;
}
]]></macro>
<!-- X-JABBER/AIM/... -> IMPP -->
<macro name="VCARD_LEGACY_TO_MODERN_IMPP"><![CDATA[
INTEGER impp_index;
impp_index = SIZE($3) - 1;
while (impp_index >= 0) {
if ($3[impp_index] != EMPTY) {
INTEGER num;
num = SIZE(LABEL);
IMPP[num] = $2 + ":" + URLENCODE($3[impp_index]);
$3[impp_index] = UNASSIGNED;
SWAP($4[impp_index], IMPP_SLOT[num]);
IMPP_SERVICE[num] = $1;
LABEL[num] = "Other";
}
impp_index = impp_index - 1;
}
]]></macro>
<!-- convert from X- fields to IMPP, ANNIVERSARY to DATE, etc. -->
<macro name="VCARD_LEGACY_TO_MODERN"><![CDATA[
if (ANNIVERSARY != EMPTY) {
INTEGER i;
i = SIZE(LABEL);
// STRING tag;
// $NEWTAG(tag, GROUP_TAG);
SWAP(XDATE[i], ANNIVERSARY);
LABEL[i] = "Anniversary";
// GROUP_TAG[i] = tag;
// ANNIVERSARY = UNASSIGNED;
}
$VCARD_LEGACY_TO_MODERN_RELATEDNAMES(SPOUSE, "Spouse");
$VCARD_LEGACY_TO_MODERN_RELATEDNAMES(MANAGER, "Manager");
$VCARD_LEGACY_TO_MODERN_RELATEDNAMES(ASSISTANT, "Assistant");
$VCARD_LEGACY_TO_MODERN_IMPP("AIM", "aim", AIM_HANDLE, AIM_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("Gadugadu", "x-apple", GADUGADU_HANDLE, GADUGADU_SLOT); // ???
$VCARD_LEGACY_TO_MODERN_IMPP("Groupwise", "x-apple", GROUPWISE_HANDLE, GROUPWISE_SLOT); // ???
$VCARD_LEGACY_TO_MODERN_IMPP("ICQ", "aim", ICQ_HANDLE, ICQ_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("Jabber", "xmpp", JABBER_HANDLE, JABBER_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("MSN", "msnim", MSN_HANDLE, MSN_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("Yahoo", "ymsgr", YAHOO_HANDLE, YAHOO_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("Skype", "skype", SKYPE_HANDLE, SKYPE_SLOT);
$VCARD_LEGACY_TO_MODERN_IMPP("Sip", "x-apple", SIP_HANDLE, SIP_SLOT); // ???
// $VCARD_LEGACY_TO_MODERN_IMPP("???", "???", IM_ADDRESS);
// $VCARD_LEGACY_TO_MODERN_IMPP("???", "???", MEANWHILE_HANDLE, MEANWHILE_SLOT);
// $VCARD_LEGACY_TO_MODERN_IMPP("??", "???", SMS_HANDLE, SMS_SLOT);
// Create group tags for all labels. Without them the label won't be
// associated with the corresponding property in the modern vCard.
INTEGER i;
i = SIZE(LABEL) - 1;
// Reset GROUP_TAG. It might contain obsolete tags after
// a read/modify cycle.
GROUP_TAG = EMPTY;
// We don't use group tags internally, so we can simply enumerate them
// here.
INTEGER tagnum;
tagnum = 1;
while (i >= 0) {
if (LABEL[i] != EMPTY) {
GROUP_TAG[i] = "item" + tagnum;
tagnum = tagnum + 1;
}
i = i - 1;
}
]]></macro>
<macro name="VCARD_BEFOREWRITE_SCRIPT_WEBDAV"><![CDATA[
$VCARD_BEFOREWRITE_SCRIPT;
$VCARD_LEGACY_TO_MODERN;
]]></macro>
<macro name="VCARD_AFTERREAD_SCRIPT_WEBDAV"><![CDATA[
$VCARD_MODERN_TO_LEGACY;
$VCARD_AFTERREAD_SCRIPT;
]]></macro>
|