summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 17:00:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 17:00:23 +0000
commit7c3e1ef285a12ea7bd9995bfd4843e71689f4c9f (patch)
tree592ad95c1b248dfccf0bf7b7cc0c7dcbe3aa22e9 /content
parentAdding upstream version 4.7. (diff)
downloadeas4tbsync-upstream.tar.xz
eas4tbsync-upstream.zip
Adding upstream version 4.8.upstream/4.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'content')
-rw-r--r--content/includes/contactsync.js22
-rw-r--r--content/provider.js5
2 files changed, 17 insertions, 10 deletions
diff --git a/content/includes/contactsync.js b/content/includes/contactsync.js
index 23d6535..513ef4d 100644
--- a/content/includes/contactsync.js
+++ b/content/includes/contactsync.js
@@ -45,7 +45,7 @@ var Contacts = {
org : 2
},
- map_EAS_properties_to_vCard : {
+ map_EAS_properties_to_vCard: revision => ({
FileAs: {item: "fn", type: "text", params: {}}, /* DisplayName */
Birthday: {item: "bday", type: "date", params: {}},
@@ -72,8 +72,8 @@ var Contacts = {
// "other".
WebPage: {item: "url", type: "text", matchAll: true, params: {}},
- CompanyName: {item: "org", type: "text", params: {}, index: 1}, /* Company */
- Department: {item: "org", type: "text", params: {}, index: 0}, /* Department */
+ CompanyName: {item: "org", type: "text", params: {}, index: revision < 2 ? 1 : 0}, /* Company */
+ Department: {item: "org", type: "text", params: {}, index: revision < 2 ? 0 : 1}, /* Department */
JobTitle: { item: "title", type: "text", params: {} }, /* JobTitle */
MobilePhoneNumber: { item: "tel", type: "text", params: {type: "cell" }},
@@ -115,7 +115,7 @@ var Contacts = {
CarPhoneNumber: { item: "tel", type: "text", params: {type: "Car"}, prefix: true},
RadioPhoneNumber: { item: "tel", type: "text", params: {type: "Radio"}, prefix: true},
BusinessFaxNumber: { item: "tel", type: "text", params: {type: "WorkFax"}, prefix: true},
- },
+ }),
map_EAS_properties_to_vCard_set2 : {
NickName: {item: "nickname", type: "text", params: {} },
@@ -235,6 +235,9 @@ var Contacts = {
// --------------------------------------------------------------------------- //
setThunderbirdItemFromWbxml: function (abItem, data, id, syncdata, mode = "standard") {
let asversion = syncdata.accountData.getAccountProperty("asversion");
+ let revision = parseInt(syncdata.target._directory.getStringValue("tbSyncRevision","1"), 10);
+ let map_EAS_properties_to_vCard = this.map_EAS_properties_to_vCard(revision);
+
if (TbSync.prefs.getIntPref("log.userdatalevel") > 2) TbSync.dump("Processing " + mode + " contact item", id);
// Make sure we are dealing with a vCard, so we can update the card just
@@ -251,7 +254,7 @@ var Contacts = {
let properties = (set == 0) ? this.EAS_properties : this.EAS_properties2;
for (let EAS_property of properties) {
- let vCard_property = (set == 0) ? this.map_EAS_properties_to_vCard[EAS_property] : this.map_EAS_properties_to_vCard_set2[EAS_property];
+ let vCard_property = (set == 0) ? map_EAS_properties_to_vCard[EAS_property] : this.map_EAS_properties_to_vCard_set2[EAS_property];
let value;
switch (EAS_property) {
case "Notes":
@@ -399,6 +402,9 @@ var Contacts = {
// --------------------------------------------------------------------------- //
getWbxmlFromThunderbirdItem: async function (abItem, syncdata, isException = false) {
let asversion = syncdata.accountData.getAccountProperty("asversion");
+ let revision = parseInt(syncdata.target._directory.getStringValue("tbSyncRevision","1"), 10);
+ let map_EAS_properties_to_vCard = this.map_EAS_properties_to_vCard(revision);
+
let wbxml = eas.wbxmltools.createWBXML("", syncdata.type); //init wbxml with "" and not with precodes, and set initial codepage
let nowDate = new Date();
@@ -411,7 +417,7 @@ var Contacts = {
// Loop over all known EAS properties (send empty value if not set).
for (let EAS_property of this.EAS_properties) {
// Some props need special handling.
- let vCard_property = this.map_EAS_properties_to_vCard[EAS_property];
+ let vCard_property = map_EAS_properties_to_vCard[EAS_property];
let value;
switch (EAS_property) {
case "Notes":
@@ -512,7 +518,7 @@ var Contacts = {
}
// Take care of notes - SWITCHING TO AirSyncBase (if 2.5, we still need Contact group here!)
- let description = this.getValue(vCardProperties, this.map_EAS_properties_to_vCard["Notes"]);
+ let description = this.getValue(vCardProperties, map_EAS_properties_to_vCard["Notes"]);
if (asversion == "2.5") {
wbxml.atag("Body", description);
} else {
@@ -538,5 +544,5 @@ var Contacts = {
}
}
-Contacts.EAS_properties = Object.keys(Contacts.map_EAS_properties_to_vCard);
+Contacts.EAS_properties = Object.keys(Contacts.map_EAS_properties_to_vCard());
Contacts.EAS_properties2 = Object.keys(Contacts.map_EAS_properties_to_vCard_set2);
diff --git a/content/provider.js b/content/provider.js
index de5af36..97f7a28 100644
--- a/content/provider.js
+++ b/content/provider.js
@@ -280,7 +280,7 @@ var Base = class {
"synckey" : "",
"target" : "",
"targetColor" : "",
- "targetName" : "",
+ "targetName" : "",
"parentID" : "0",
"serverID" : "",
};
@@ -526,7 +526,8 @@ var TargetData_addressbook = class extends TbSync.addressbook.AdvancedTargetData
if (directory && directory instanceof Components.interfaces.nsIAbDirectory && directory.dirPrefId == dirPrefId) {
directory.setStringValue("tbSyncIcon", "eas" + (this.folderData.accountData.getAccountProperty("servertype") == "office365" ? "_365" : ""));
- return directory;
+ directory.setStringValue("tbSyncRevision", "2");
+ return directory;
}
return null;
}