summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorniko <niko>2012-10-01 22:54:16 (GMT)
committerniko <niko>2012-10-01 22:54:16 (GMT)
commit7b47175cd7c82f806b37d2fe2332cc3b6b8e105b (patch)
tree0b8e251df97fa99301e8909e1804b9adcaec81dc /src
parent9df93aa72d2e67afde9e4e6d515072720f98f9fc (diff)
downloadsynckolab-7b47175cd7c82f806b37d2fe2332cc3b6b8e105b.tar.gz
initial tests
Diffstat (limited to 'src')
-rw-r--r--src/chrome/content/synckolab/abWindow.xul4
-rw-r--r--src/chrome/content/synckolab/addressbook.js347
-rw-r--r--src/chrome/content/synckolab/addressbookTools.js370
-rw-r--r--src/chrome/content/synckolab/calendar.js358
-rw-r--r--src/chrome/content/synckolab/calendarTools.js229
-rw-r--r--src/chrome/content/synckolab/config.js199
-rw-r--r--src/chrome/content/synckolab/contactConflictDialog.xul10
-rw-r--r--src/chrome/content/synckolab/contactConflictDialogCode.js27
-rw-r--r--src/chrome/content/synckolab/contents.rdf2
-rw-r--r--src/chrome/content/synckolab/mainWindow.xul6
-rw-r--r--src/chrome/content/synckolab/synckolab.js835
-rw-r--r--src/chrome/content/synckolab/tools.js246
-rw-r--r--src/chrome/content/synckolab/tools/kolab.js11
-rw-r--r--src/chrome/content/synckolab/tools/sha1.js7
-rw-r--r--src/chrome/content/synckolab/tools/text.js36
-rw-r--r--src/chrome/content/synckolab/wndConfig.js295
-rw-r--r--src/chrome/content/synckolab/wndConfig.xul38
-rw-r--r--src/chrome/content/synckolab/wndNewConfigType.xul6
18 files changed, 1512 insertions, 1514 deletions
diff --git a/src/chrome/content/synckolab/abWindow.xul b/src/chrome/content/synckolab/abWindow.xul
index d8971d9..1c807e1 100644
--- a/src/chrome/content/synckolab/abWindow.xul
+++ b/src/chrome/content/synckolab/abWindow.xul
@@ -44,14 +44,14 @@
<menupopup id="taskPopup">
<menuseparator/>
- <menuitem id="SyncKolab-Sync" oncommand="com.synckolab.main.sync('manual');" label="&synckolab.syncMenu.label;"/>
+ <menuitem id="SyncKolab-Sync" oncommand="synckolab.main.sync('manual');" label="&synckolab.syncMenu.label;"/>
<menuitem id="SyncKolab-Options"
oncommand="window.openDialog('chrome://synckolab/content/wndConfig.xul', 'options', 'chrome=yes,resizable=yes,modal=yes');"
label="&synckolab.optionMenu.label;"/>
</menupopup>
<toolbarpalette id="AddressBookToolbarPalette">
- <toolbarbutton id="SyncKolab-button-ab" oncommand="com.synckolab.main.sync('manual');" class="toolbarbutton-1" label="&synckolab.sync.label;"/>
+ <toolbarbutton id="SyncKolab-button-ab" oncommand="synckolab.main.sync('manual');" class="toolbarbutton-1" label="&synckolab.sync.label;"/>
</toolbarpalette>
</overlay>
diff --git a/src/chrome/content/synckolab/addressbook.js b/src/chrome/content/synckolab/addressbook.js
index d3110df..cec3d95 100644
--- a/src/chrome/content/synckolab/addressbook.js
+++ b/src/chrome/content/synckolab/addressbook.js
@@ -34,8 +34,7 @@
***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
/*
* A kinda "provider" class for syncing the address book.
@@ -44,7 +43,7 @@ if(!com.synckolab) com.synckolab={};
* body) to generate add/update contacts in the address book.
*
*/
-com.synckolab.AddressBook = {
+synckolab.AddressBook = {
gConfig: null, // remember the configuration name
gCurUID: '', // save the last checked uid - for external use
@@ -72,21 +71,21 @@ com.synckolab.AddressBook = {
* @param pref a nsIPrefBranch for reading of the configuration
*/
readConfig: function(config, pref) {
- com.synckolab.tools.logMessage("Reading Configuration:" + config.name, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Reading Configuration:" + config.name, synckolab.global.LOG_DEBUG);
// get the rdf for the Addresbook list
// the addressbook type nsIAbDirectory
- var cn = com.synckolab.addressbookTools.getABDirectory(!config.syncListener?null:{
+ var cn = synckolab.addressbookTools.getABDirectory(!config.syncListener?null:{
getConfig: function(addressBokName) {
// search through the configs
- for(var j = 0; j < com.synckolab.main.syncConfigs.length; j++) {
- if(com.synckolab.main.syncConfigs[j] && com.synckolab.main.syncConfigs[j].type === "contact") {
- var curConfig = com.synckolab.main.syncConfigs[j];
- //com.synckolab.tools.logMessage("checking " + curConfig.contact.folderMsgURI + " vs. " + folder, com.synckolab.global.LOG_DEBUG);
+ for(var j = 0; j < synckolab.main.syncConfigs.length; j++) {
+ if(synckolab.main.syncConfigs[j] && synckolab.main.syncConfigs[j].type === "contact") {
+ var curConfig = synckolab.main.syncConfigs[j];
+ //synckolab.tools.logMessage("checking " + curConfig.contact.folderMsgURI + " vs. " + folder, synckolab.global.LOG_DEBUG);
if(curConfig.enabled && curConfig.syncListener) {
- if(curConfig.source === addressBokName || com.synckolab.tools.text.fixNameToMiniCharset(curConfig.source) === com.synckolab.tools.text.fixNameToMiniCharset(addressBokName))
+ if(curConfig.source === addressBokName || synckolab.tools.text.fixNameToMiniCharset(curConfig.source) === synckolab.tools.text.fixNameToMiniCharset(addressBokName))
{
return curConfig;
}
@@ -103,8 +102,8 @@ com.synckolab.AddressBook = {
OnStopRunningUrl: function ( url, exitCode )
{
- com.synckolab.tools.logMessage("Finished trigger", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
- com.synckolab.global.triggerRunning = false;
+ synckolab.tools.logMessage("Finished trigger", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
+ synckolab.global.triggerRunning = false;
}
}, msgWindow);
},
@@ -114,7 +113,7 @@ com.synckolab.AddressBook = {
return;
}
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
@@ -124,55 +123,55 @@ com.synckolab.AddressBook = {
}
newCard = newCard.QueryInterface(Components.interfaces.nsIAbCard);
- com.synckolab.tools.logMessage("trigger new card", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("trigger new card", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// get the dbfile from the local disk
var cUID = null;
- cUID = com.synckolab.addressbookTools.getUID(newCard);
+ cUID = synckolab.addressbookTools.getUID(newCard);
if (!cUID) {
// generate a unique id (will random be enough for the future?)
- cUID = "sk-vc-" + com.synckolab.tools.text.randomVcardId();
- com.synckolab.addressbookTools.setUID(newCard, cUID);
+ cUID = "sk-vc-" + synckolab.tools.text.randomVcardId();
+ synckolab.addressbookTools.setUID(newCard, cUID);
// avoid loop
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
cConfig.addressBook.modifyCard(newCard);
- com.synckolab.global.triggerRunning = false;
+ synckolab.global.triggerRunning = false;
}
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cUID)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cUID)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
if (newCard.isMailList) {
- com.synckolab.tools.logMessage("adding unsaved list: " + cUID, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved list: " + cUID, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
} else {
- com.synckolab.tools.logMessage("adding unsaved card: " + cUID, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved card: " + cUID, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
// and write the message
- var abcontent = com.synckolab.addressbookTools.card2Message(newCard, cConfig.email, cConfig.format);
- com.synckolab.tools.logMessage("New Card " + abcontent, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ var abcontent = synckolab.addressbookTools.card2Message(newCard, cConfig.email, cConfig.format);
+ synckolab.tools.logMessage("New Card " + abcontent, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// get the dbfile from the local disk
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cUID);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(cConfig, cUID);
// write the current content in the sync-db file (parse to json object first)
- com.synckolab.tools.writeSyncDBFile(idxEntry, com.synckolab.addressbookTools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, synckolab.addressbookTools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
- com.synckolab.tools.logMessage("Writing card to imap" , com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Writing card to imap" , synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
var listener = this;
- com.synckolab.main.writeImapMessage(abcontent, cConfig,
+ synckolab.main.writeImapMessage(abcontent, cConfig,
{
OnProgress: function (progress, progressMax) {},
OnStartCopy: function () { },
SetMessageKey: function (key) {},
OnStopCopy: function (status) {
// update folder information from imap and make sure we got everything
- com.synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
listener.finishMsgfolderChange(cConfig.folder);
}
});
@@ -183,7 +182,7 @@ com.synckolab.AddressBook = {
return;
}
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
@@ -192,24 +191,24 @@ com.synckolab.AddressBook = {
return;
}
- var cUID = com.synckolab.addressbookTools.getUID(item);
+ var cUID = synckolab.addressbookTools.getUID(item);
// the item doesnt have an uuid - skip
if(!cUID) {
return;
}
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cUID)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cUID)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
// find the correct message to the given uid
if(cConfig.msgList.length() === 0) {
- com.synckolab.tools.fillMessageLookup(cConfig.msgList, config, com.synckolab.addressbookTools.parseMessageContent);
+ synckolab.tools.fillMessageLookup(cConfig.msgList, config, synckolab.addressbookTools.parseMessageContent);
}
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
// get and delete the message
var msg = cConfig.msgList.get(cUID);
@@ -217,12 +216,12 @@ com.synckolab.AddressBook = {
var list = null;
// use mutablearray
list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
- com.synckolab.tools.logMessage("deleting [" + cUID + "]");
+ synckolab.tools.logMessage("deleting [" + cUID + "]");
list.appendElement(msg, false);
cConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
// also remove sync db file
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cUID);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(cConfig, cUID);
idxEntry.remove(false);
}
@@ -231,14 +230,14 @@ com.synckolab.AddressBook = {
},
onItemPropertyChanged: function(item, prop, oldval, newval) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
var dirName = item.directoryId.substring(item.directoryId.lastIndexOf("&")+1);
// local change triggers a full sync
- com.synckolab.tools.logMessage("item changed in "+ dirName, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("item changed in "+ dirName, synckolab.global.LOG_INFO);
// get the right config for this address book
var cConfig = this.getConfig(dirName);
@@ -246,43 +245,43 @@ com.synckolab.AddressBook = {
return;
}
- var cUID = com.synckolab.addressbookTools.getUID(item);
+ var cUID = synckolab.addressbookTools.getUID(item);
// the item doesnt have an uuid - create one
if(!cUID) {
- com.synckolab.addressbookTools.setUID(item, "sk-vc-" + com.synckolab.tools.text.randomVcardId());
+ synckolab.addressbookTools.setUID(item, "sk-vc-" + synckolab.tools.text.randomVcardId());
this.gConfig.addressBook.modifyCard(item);
if (item.isMailList) {
- com.synckolab.tools.logMessage("adding unsaved list: " + cUID, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved list: " + cUID, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
} else {
- com.synckolab.tools.logMessage("adding unsaved card: " + cUID, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved card: " + cUID, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
- cUID = com.synckolab.addressbookTools.getUID(item);
+ cUID = synckolab.addressbookTools.getUID(item);
}
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cUID)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cUID)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
// and write the message
- var abcontent = com.synckolab.addressbookTools.card2Message(item, cConfig.email, cConfig.format);
- com.synckolab.tools.logMessage("Updated Card " + cUID, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ var abcontent = synckolab.addressbookTools.card2Message(item, cConfig.email, cConfig.format);
+ synckolab.tools.logMessage("Updated Card " + cUID, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
- com.synckolab.tools.logMessage("looking for message", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("looking for message", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// finally update imap
// find the correct message to the given uid
if(cConfig.msgList.length() === 0) {
- com.synckolab.tools.fillMessageLookup(cConfig.msgList, config, com.synckolab.addressbookTools.parseMessageContent);
+ synckolab.tools.fillMessageLookup(cConfig.msgList, config, synckolab.addressbookTools.parseMessageContent);
}
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
// get the dbfile from the local disk
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cUID);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(cConfig, cUID);
// get and delete the message
var msg = cConfig.msgList.get(cUID);
@@ -290,29 +289,29 @@ com.synckolab.AddressBook = {
var list = null;
// use mutablearray
list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
- com.synckolab.tools.logMessage("deleting [" + cUID + "]");
+ synckolab.tools.logMessage("deleting [" + cUID + "]");
list.appendElement(msg, false);
cConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
idxEntry.remove(false);
}
// add new
- com.synckolab.tools.logMessage("Writing card to imap" , com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Writing card to imap" , synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// remember that we just added this one
cConfig.recentProcessed.push(cUID);
// write the current content in the sync-db file (parse to json object first)
- com.synckolab.tools.writeSyncDBFile(idxEntry, com.synckolab.addressbookTools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, synckolab.addressbookTools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
var listener = this;
- com.synckolab.main.writeImapMessage(abcontent, cConfig,
+ synckolab.main.writeImapMessage(abcontent, cConfig,
{
OnProgress: function (progress, progressMax) {},
OnStartCopy: function () { },
SetMessageKey: function (key) {},
OnStopCopy: function (status) {
- com.synckolab.tools.logMessage("Finished writing contact entry to imap", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Finished writing contact entry to imap", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
listener.finishMsgfolderChange(cConfig.folder);
}
});
@@ -325,7 +324,7 @@ com.synckolab.AddressBook = {
{
var cur = ABook.QueryInterface(Components.interfaces.nsIAbDirectory);
if (cur.dirName === config.addressBookName ||
- com.synckolab.tools.text.fixNameToMiniCharset(config.source) === com.synckolab.tools.text.fixNameToMiniCharset(cur.dirName)
+ synckolab.tools.text.fixNameToMiniCharset(config.source) === synckolab.tools.text.fixNameToMiniCharset(cur.dirName)
)
{
config.addressBook = cur;
@@ -344,12 +343,12 @@ com.synckolab.AddressBook = {
// the current sync database filen (a file with uid:size:date:localfile)
// uid -> filename database - main functions needs to know the name
- config.dbFile = com.synckolab.tools.file.getHashDataBaseFile(config);
+ config.dbFile = synckolab.tools.file.getHashDataBaseFile(config);
},
init: function (config, itemList, document) {
// shortcuts for some common used utils
- this.tools = com.synckolab.addressbookTools;
+ this.tools = synckolab.addressbookTools;
this.itemList = itemList;
this.doc = document;
@@ -369,11 +368,11 @@ com.synckolab.AddressBook = {
this.gConfig.recentProcessed = [];
// a hashmap remembering all the cards - for faster use
- this.gCardDB = new com.synckolab.hashMap();
+ this.gCardDB = new synckolab.hashMap();
// shouldnt happen, since we have a config...
if(this.gConfig.type !== "contact") {
- com.synckolab.tools.logMessage("address book missing, please restart or try again", com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("address book missing, please restart or try again", synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return null;
}
@@ -392,7 +391,7 @@ com.synckolab.AddressBook = {
var cUID = this.tools.getUID(card);
if (cUID === null || cUID === "")
{
- cUID = "sk-vc-" + com.synckolab.tools.text.randomVcardId();
+ cUID = "sk-vc-" + synckolab.tools.text.randomVcardId();
this.tools.setUID(card, cUID);
this.gConfig.addressBook.modifyCard(card);
}
@@ -407,16 +406,16 @@ com.synckolab.AddressBook = {
*/
triggerParseAddMessage: function(message) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
// parse the new message content
- var newCard = com.synckolab.addressbookTools.parseMessageContent(message.fileContent);
+ var newCard = synckolab.addressbookTools.parseMessageContent(message.fileContent);
// get the dbfile from the local disk
- var cUid = com.synckolab.addressbookTools.getUID(newCard);
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(message.config, cUid);
+ var cUid = synckolab.addressbookTools.getUID(newCard);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(message.config, cUid);
// check if the entry is in the address book
var curCard = null;
@@ -424,7 +423,7 @@ com.synckolab.AddressBook = {
while (cards.hasMoreElements())
{
var cCard = cards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
- if(com.synckolab.addressbookTools.getUID(cCard) === cUid) {
+ if(synckolab.addressbookTools.getUID(cCard) === cUid) {
curCard = cCard;
break;
}
@@ -441,22 +440,22 @@ com.synckolab.AddressBook = {
}
catch (e)
{
- com.synckolab.tools.logMessage("unable to delete card: " + curCard.uid, com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("unable to delete card: " + curCard.uid, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return;
}
}
// write the pojo into a file for faster comparison in later sync
- com.synckolab.tools.writeSyncDBFile(idxEntry, newCard);
+ synckolab.tools.writeSyncDBFile(idxEntry, newCard);
- com.synckolab.tools.logMessage("card is new, add to address book: " + cUid, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("card is new, add to address book: " + cUid, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// convert to a thunderbird object and add to the address book
if (newCard.type === "maillist")
{
// add mailing lists - add list of currently added cards
if(!message.config.cardDb) {
- message.config.cardDb = new com.synckolab.hashMap();
+ message.config.cardDb = new synckolab.hashMap();
var lCards = message.config.addressBook.childCards;
var card = null;
// read all cards
@@ -466,34 +465,34 @@ com.synckolab.AddressBook = {
card = card.QueryInterface(Components.interfaces.nsIAbCard);
// create a UUID if it does not exist!
- var cUID = com.synckolab.addressbookTools.getUID(card);
+ var cUID = synckolab.addressbookTools.getUID(card);
if (cUID === null || cUID === "")
{
- cUID = "sk-vc-" + com.synckolab.tools.text.randomVcardId();
- com.synckolab.addressbookTools.setUID(card, cUID);
+ cUID = "sk-vc-" + synckolab.tools.text.randomVcardId();
+ synckolab.addressbookTools.setUID(card, cUID);
message.config.addressBook.modifyCard(card);
}
message.config.cardDb.put(cUID, card);
}
}
- message.config.addressBook.addMailList(com.synckolab.addressbookTools.createTBirdObject(newCard, message.config.cardDb));
+ message.config.addressBook.addMailList(synckolab.addressbookTools.createTBirdObject(newCard, message.config.cardDb));
// also add to the hash-database
//this.gCardDB.put(this.tools.getUID(newCard), newCard);
}
else
{
// also copy the image
- var pNameA = com.synckolab.addressbookTools.getCardProperty(newCard, "PhotoName");
+ var pNameA = synckolab.addressbookTools.getCardProperty(newCard, "PhotoName");
if (pNameA && pNameA !== "" && pNameA !== "null")
{
// in case the copy failed - clear the photoname
- if (com.synckolab.addressbookTools.copyImage(pNameA) === false) {
- com.synckolab.addressbookTools.setCardProperty(newCard, "PhotoName", "");
+ if (synckolab.addressbookTools.copyImage(pNameA) === false) {
+ synckolab.addressbookTools.setCardProperty(newCard, "PhotoName", "");
}
}
- message.config.addressBook.addCard(com.synckolab.addressbookTools.createTBirdObject(newCard));
+ message.config.addressBook.addCard(synckolab.addressbookTools.createTBirdObject(newCard));
// clean out old cardDb
message.config.cardDb = null;
}
@@ -506,22 +505,22 @@ com.synckolab.AddressBook = {
*/
triggerParseDeleteMessage: function(message) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
// parse the new message content
- var newCard = com.synckolab.addressbookTools.parseMessageContent(message.fileContent);
+ var newCard = synckolab.addressbookTools.parseMessageContent(message.fileContent);
// find the entry in the address book and remove it
- var cId = com.synckolab.addressbookTools.getUID(newCard);
+ var cId = synckolab.addressbookTools.getUID(newCard);
var cards = message.config.addressBook.childCards;
var deleteList = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
while (cards.hasMoreElements())
{
var cCard = cards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
- if(com.synckolab.addressbookTools.getUID(cCard) === cId) {
- com.synckolab.tools.logMessage("found card to delete: " + cId, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ if(synckolab.addressbookTools.getUID(cCard) === cId) {
+ synckolab.tools.logMessage("found card to delete: " + cId, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
deleteList.appendElement(cCard, false);
break;
}
@@ -533,19 +532,19 @@ com.synckolab.AddressBook = {
}
catch (e)
{
- com.synckolab.tools.logMessage("unable to delete card: " + cId, com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("unable to delete card: " + cId, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return;
}
// get the dbfile from the local disk
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(message.config, cId);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(message.config, cId);
if (idxEntry.exists()) {
idxEntry.remove(true);
}
// also delete image
- var pNameA = com.synckolab.addressbookTools.getCardProperty(newCard, "PhotoName");
+ var pNameA = synckolab.addressbookTools.getCardProperty(newCard, "PhotoName");
if (pNameA && pNameA !== "" && pNameA !== "null")
{
// delete actual image
@@ -566,7 +565,7 @@ com.synckolab.AddressBook = {
}
}
- com.synckolab.tools.logMessage("deleting card: " + cId, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("deleting card: " + cId, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
},
@@ -615,9 +614,9 @@ com.synckolab.AddressBook = {
this.curItemInListId = this.doc.createElement("treecell");
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
- this.curItemInListId.setAttribute("label", com.synckolab.global.strBundle.getString("unknown"));
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("parsing"));
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("unknown"));
+ this.curItemInListId.setAttribute("label", synckolab.global.strBundle.getString("unknown"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("parsing"));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("unknown"));
this.curItemInList.appendChild(this.curItemInListId);
this.curItemInList.appendChild(this.curItemInListStatus);
@@ -628,7 +627,7 @@ com.synckolab.AddressBook = {
var curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
// parse the new item
@@ -636,15 +635,15 @@ com.synckolab.AddressBook = {
if (newCard && newCard.isMailList)
{
- com.synckolab.tools.logMessage("got mailing list " + this.tools.getUID(newCard), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("got mailing list " + this.tools.getUID(newCard), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
/*
if (newCard && newCard.isMailList)
{
// skip mailing lists
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(newCard));
- this.curItemInListId.setAttribute("label", com.synckolab.global.strBundle.getString("noChange"));
- com.synckolab.tools.logMessage("skipping mailing lists!", com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(newCard));
+ this.curItemInListId.setAttribute("label", synckolab.global.strBundle.getString("noChange"));
+ synckolab.tools.logMessage("skipping mailing lists!", synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return null;
}
*/
@@ -655,15 +654,15 @@ com.synckolab.AddressBook = {
// remember that we did this uid already
this.folderMessageUids.push(this.gCurUID);
- com.synckolab.tools.logMessage("got card from message: " + this.gCurUID, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("got card from message: " + this.gCurUID, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// update list item
this.curItemInListId.setAttribute("label", this.gCurUID);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("checking"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("checking"));
// since we disabled mailing list - wont come here
if (newCard.type === "maillist") {
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getCardProperty(newCard, "Name"));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getCardProperty(newCard, "Name"));
} else if (this.tools.getCardProperty(newCard, "DisplayName") !== "") {
this.curItemInListContent.setAttribute("label", this.tools.getCardProperty(newCard, "DisplayName") +
" <" + this.tools.getCardProperty(newCard, "PrimaryEmail","---") + ">");
@@ -677,8 +676,8 @@ com.synckolab.AddressBook = {
var foundCard = this.gCardDB.get(this.gCurUID);
// get the dbfile from the local disk
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(newCard));
- com.synckolab.tools.logMessage("got entry from db: " + foundCard, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(newCard));
+ synckolab.tools.logMessage("got entry from db: " + foundCard, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// a new card or locally deleted
if (foundCard === null)
@@ -689,20 +688,20 @@ com.synckolab.AddressBook = {
if (!idxEntry.exists() || this.forceLocalCopy)
{
// write the pojo into a file for faster comparison in later sync
- com.synckolab.tools.writeSyncDBFile(idxEntry, newCard);
+ synckolab.tools.writeSyncDBFile(idxEntry, newCard);
// convert to a thunderbird object and add to the address book
if (newCard.type === "maillist")
{
- com.synckolab.tools.logMessage("list is new, add to address book: " + this.tools.getUID(newCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("list is new, add to address book: " + this.tools.getUID(newCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// add mailing lists- pass the gCardDB with its nsIAbCard
- this.gConfig.addressBook.addMailList(com.synckolab.addressbookTools.createTBirdObject(newCard, this.gCardDB));
+ this.gConfig.addressBook.addMailList(synckolab.addressbookTools.createTBirdObject(newCard, this.gCardDB));
// also add to the hash-database
this.gCardDB.put(this.tools.getUID(newCard), newCard);
}
else
{
- com.synckolab.tools.logMessage("card is new, add to address book: " + this.tools.getUID(newCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("card is new, add to address book: " + this.tools.getUID(newCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// also copy the image
var pNameA = this.tools.getCardProperty(newCard, "PhotoName");
if (pNameA && pNameA !== "" && pNameA !== "null")
@@ -713,23 +712,23 @@ com.synckolab.AddressBook = {
}
}
- var abCard = com.synckolab.addressbookTools.createTBirdObject(newCard);
+ var abCard = synckolab.addressbookTools.createTBirdObject(newCard);
this.gConfig.addressBook.addCard(abCard);
// also add to the hash-database
this.gCardDB.put(this.tools.getUID(newCard), abCard);
}
//update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localAdd"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localAdd"));
// new card added - we are done
return null;
}
else
{
- com.synckolab.tools.logMessage("card deleted locally: " + this.tools.getUID(newCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("card deleted locally: " + this.tools.getUID(newCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
//update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("deleteOnServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("deleteOnServer"));
try
{
@@ -748,49 +747,49 @@ com.synckolab.AddressBook = {
// this card is already in the address book
{
// read the current card from the sync db (might be null)
- var cCard = com.synckolab.tools.readSyncDBFile(idxEntry);
+ var cCard = synckolab.tools.readSyncDBFile(idxEntry);
var cCard_equals_foundCard = false, cCard_equals_newCard = false, foundCard_equals_newCard = false;
// Streamline card comparisons
if (cCard && this.tools.equalsContact(cCard, foundCard)) {
cCard_equals_foundCard = true;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js cCard equals foundCard", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js cCard equals foundCard", synckolab.global.LOG_DEBUG);
} else {
cCard_equals_foundCard = false;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js cCard NOT EQUALS foundCard\n ", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js cCard NOT EQUALS foundCard\n ", synckolab.global.LOG_DEBUG);
}
if (cCard && this.tools.equalsContact(cCard, newCard)) {
cCard_equals_newCard = true;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js cCard equals newCard", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js cCard equals newCard", synckolab.global.LOG_DEBUG);
} else {
cCard_equals_newCard = false;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js cCard DOES NOT equal newCard", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js cCard DOES NOT equal newCard", synckolab.global.LOG_DEBUG);
}
if (this.tools.equalsContact(foundCard, newCard)) {
foundCard_equals_newCard = true;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js foundCard equals newCard", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js foundCard equals newCard", synckolab.global.LOG_DEBUG);
} else {
foundCard_equals_newCard = false;
- com.synckolab.tools.logMessage("In parse Message in addressbook.js foundCard DOES NOT equal newCard", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js foundCard DOES NOT equal newCard", synckolab.global.LOG_DEBUG);
}
// compare each card with each other
if ((idxEntry.exists() && !cCard_equals_foundCard && !cCard_equals_newCard) || (!idxEntry.exists() && !foundCard_equals_newCard))
{
//local and server were both updated, ut oh, what do we want to do?
- com.synckolab.tools.logMessage("Conflicts detected, testing for autoresolve.", com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Conflicts detected, testing for autoresolve.", synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
// This function returns an array on conflicting fields
- var conflicts = com.synckolab.addressbookTools.contactConflictTest(newCard, foundCard);
+ var conflicts = synckolab.addressbookTools.contactConflictTest(newCard, foundCard);
var bUpdateLocal = false;
var bUpdateServer = false;
//If there were no conflicts found, skip dialog and update the local copy (Changes to the way the SHA are calculated could cause this)
if (conflicts.length > 0) {
- com.synckolab.tools.logMessage("Conflicts length is greater than 0.", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Conflicts length is greater than 0.", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
//Holds the users response, must be an object so that we can pass by reference
var conflictResolution = {};
@@ -821,17 +820,17 @@ com.synckolab.AddressBook = {
switch (conflictResolution.result) {
case 0 :
//User clicked Cancel or X, we move to next record and user can deal with this issue on next sync
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("conflict") + ": skipped");
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("conflict") + ": skipped");
break;
case 1 :
//User chose to keep all server values
bUpdateLocal = true;
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("conflict") + ": " + com.synckolab.global.strBundle.getString("localUpdate"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("conflict") + ": " + synckolab.global.strBundle.getString("localUpdate"));
break;
case 2 :
//User chose to keep all local values
bUpdateServer = true;
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("conflict") + ": " + com.synckolab.global.strBundle.getString("updateOnServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("conflict") + ": " + synckolab.global.strBundle.getString("updateOnServer"));
break;
case 3 :
//User chose a mix of values, therefore, both local and server need updating
@@ -839,16 +838,16 @@ com.synckolab.AddressBook = {
//newCard and foundCard both already contain the new values
bUpdateLocal = true;
bUpdateServer = true;
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("conflict") + ": both updated");
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("conflict") + ": both updated");
break;
}
} else {
//cards values are different, however, no apparent differences
//Changes to the way the SHA (code revisions) are calculated could cause this
- com.synckolab.tools.logMessage("Contacts differ, however, assumed no change, update local" + this.tools.getUID(newCard), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Contacts differ, however, assumed no change, update local" + this.tools.getUID(newCard), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
bUpdateLocal = true;
- this.curItemInListStatus.setAttribute("label", "Auto Conflict Resolved : " + com.synckolab.global.strBundle.getString("localUpdate"));
+ this.curItemInListStatus.setAttribute("label", "Auto Conflict Resolved : " + synckolab.global.strBundle.getString("localUpdate"));
}
if (bUpdateLocal) {
@@ -873,15 +872,15 @@ com.synckolab.AddressBook = {
}
// add the new one
- this.gConfig.addressBook.addCard(com.synckolab.addressbookTools.createTBirdObject(newCard));
+ this.gConfig.addressBook.addCard(synckolab.addressbookTools.createTBirdObject(newCard));
}
catch (de)
{
- com.synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, newCard);
+ synckolab.tools.writeSyncDBFile(idxEntry, newCard);
}
if (bUpdateServer) {
@@ -889,7 +888,7 @@ com.synckolab.AddressBook = {
abcontent = this.tools.card2Message(foundCard, this.gConfig.email, this.gConfig.format);
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
return abcontent;
}
return null; // Return null, we either updated nothing or updated only local
@@ -899,13 +898,13 @@ com.synckolab.AddressBook = {
if (!idxEntry.exists() || (cCard_equals_foundCard && !cCard_equals_newCard))
{
if (!idxEntry.exists()) {
- com.synckolab.tools.logMessage("In parse Message in addressbook.js idxEntry does not exist", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message in addressbook.js idxEntry does not exist", synckolab.global.LOG_DEBUG);
}
if(foundCard_equals_newCard){
- com.synckolab.tools.logMessage("no change, but sync file missing: " + this.tools.getUID(foundCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("no change, but sync file missing: " + this.tools.getUID(foundCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
} else {
- com.synckolab.tools.logMessage("server changed: " + this.tools.getUID(foundCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("server changed: " + this.tools.getUID(foundCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
// server changed - update local
@@ -918,10 +917,10 @@ com.synckolab.AddressBook = {
//delMailListlist.appendElement(foundCard, false);
//this.gConfig.addressBook.deleteCards(delMailListlist);
this.gConfig.addressBook.deleteDirectory(foundCard);
- this.gConfig.addressBook.addMailList(com.synckolab.addressbookTools.createTBirdObject(newCard, this.gCardDB));
+ this.gConfig.addressBook.addMailList(synckolab.addressbookTools.createTBirdObject(newCard, this.gCardDB));
} catch (delMailList)
{
- com.synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
}
else
@@ -944,26 +943,26 @@ com.synckolab.AddressBook = {
}
}
- this.gConfig.addressBook.addCard(com.synckolab.addressbookTools.createTBirdObject(newCard));
+ this.gConfig.addressBook.addCard(synckolab.addressbookTools.createTBirdObject(newCard));
}
catch (delocalUpdate)
{
- com.synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("problem with local update for - skipping" + this.tools.getUID(foundCard), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
}
- com.synckolab.tools.logMessage("write sync db " + this.tools.getUID(foundCard), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("write sync db " + this.tools.getUID(foundCard), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, newCard);
+ synckolab.tools.writeSyncDBFile(idxEntry, newCard);
// update list item
if(foundCard_equals_newCard){
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("noChange"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("noChange"));
}
else {
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localUpdate"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localUpdate"));
}
return null;
}
@@ -971,26 +970,26 @@ com.synckolab.AddressBook = {
// is the db file equals server, but not local.. we got a local change
if (idxEntry.exists() && !cCard_equals_foundCard && cCard_equals_newCard)
{
- com.synckolab.tools.logMessage("client changed " + this.tools.getUID(foundCard) + " - " + cCard.primaryEmail, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("client changed " + this.tools.getUID(foundCard) + " - " + cCard.primaryEmail, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("updateOnServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("updateOnServer"));
// remember this message for update - generate mail message (incl. extra fields)
abcontent = this.tools.card2Message(foundCard, this.gConfig.email, this.gConfig.format);
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
return abcontent;
}
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("noChange"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("noChange"));
}
}
else
{
- this.curItemInListId.setAttribute("label", com.synckolab.global.strBundle.getString("unparseable"));
- com.synckolab.tools.logMessage("unable to parse message, skipping", com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ this.curItemInListId.setAttribute("label", synckolab.global.strBundle.getString("unparseable"));
+ synckolab.tools.logMessage("unable to parse message, skipping", synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
return null;
@@ -1013,7 +1012,7 @@ com.synckolab.AddressBook = {
if (!this.gCards.hasMoreElements())
{
// we are done
- com.synckolab.tools.logMessage("Finished syncing adress book", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Finished syncing adress book", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return "done";
}
@@ -1024,7 +1023,7 @@ com.synckolab.AddressBook = {
catch (ext)
{
// we are done
- com.synckolab.tools.logMessage("Bad - Finished syncing adress book", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Bad - Finished syncing adress book", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return "done";
}
@@ -1036,7 +1035,7 @@ com.synckolab.AddressBook = {
if (cur.isMailList)
{
- com.synckolab.tools.logMessage("Convert Mailing list to nsIABDirectory", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Convert Mailing list to nsIABDirectory", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
curItem = Components.classes["@mozilla.org/abmanager;1"].getService(Components.interfaces.nsIAbManager).getDirectory(cur.mailListURI);
}
@@ -1062,11 +1061,11 @@ com.synckolab.AddressBook = {
// look at new card
// generate a unique id (will random be enough for the future?)
- com.synckolab.addressbookTools.setUID(curItem, "sk-vc-" + com.synckolab.tools.text.randomVcardId());
+ synckolab.addressbookTools.setUID(curItem, "sk-vc-" + synckolab.tools.text.randomVcardId());
if (cur.isMailList) {
- com.synckolab.tools.logMessage("adding unsaved list: " + this.tools.getUID(curItem), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved list: " + this.tools.getUID(curItem), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
} else {
- com.synckolab.tools.logMessage("adding unsaved card: " + this.tools.getUID(curItem), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("adding unsaved card: " + this.tools.getUID(curItem), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
this.gConfig.addressBook.modifyCard(cur);
@@ -1077,9 +1076,9 @@ com.synckolab.AddressBook = {
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
this.curItemInListId.setAttribute("label", this.tools.getUID(curItem));
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("addToServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("addToServer"));
if (curItem.isMailList) {
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getCardProperty(curItem, "Name"));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getCardProperty(curItem, "Name"));
} else {
this.curItemInListContent.setAttribute("label", cur.firstName + " " + curItem.lastName + " <" + curItem.primaryEmail + ">");
}
@@ -1093,17 +1092,17 @@ com.synckolab.AddressBook = {
var curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
// and write the message
- abcontent = com.synckolab.addressbookTools.card2Message(curItem, this.gConfig.email, this.gConfig.format);
- com.synckolab.tools.logMessage("New Card " + this.tools.getUID(curItem), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ abcontent = synckolab.addressbookTools.card2Message(curItem, this.gConfig.email, this.gConfig.format);
+ synckolab.tools.logMessage("New Card " + this.tools.getUID(curItem), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// get the dbfile from the local disk
- idxEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
+ idxEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
// write the current content in the sync-db file (parse to json object first)
- com.synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
}
else
{
@@ -1114,7 +1113,7 @@ com.synckolab.AddressBook = {
{
if (this.tools.getUID(curItem) === this.folderMessageUids[i] && this.tools.getUID(curItem))
{
- com.synckolab.tools.logMessage("we got this contact already: " + this.tools.getUID(curItem), com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("we got this contact already: " + this.tools.getUID(curItem), synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
alreadyProcessed = true;
break;
}
@@ -1126,7 +1125,7 @@ com.synckolab.AddressBook = {
if (!alreadyProcessed)
{
// get the dbfile from the local disk
- idxEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
+ idxEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
if (this.tools.getUID(curItem) === null)
{
alert("UID is NULL???" + curItem.custom4);
@@ -1154,9 +1153,9 @@ com.synckolab.AddressBook = {
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
this.curItemInListId.setAttribute("label", this.tools.getUID(curItem));
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localDelete"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localDelete"));
if (curItem.isMailList) {
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(curItem));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(curItem));
} else {
this.curItemInListContent.setAttribute("label", curItem.firstName + " " + curItem.lastName + " <" + curItem.primaryEmail + ">");
}
@@ -1170,7 +1169,7 @@ com.synckolab.AddressBook = {
var curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
// also remove the local db file since we deleted the contact on the server
@@ -1187,9 +1186,9 @@ com.synckolab.AddressBook = {
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
this.curItemInListId.setAttribute("label", this.tools.getUID(curItem));
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("addToServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("addToServer"));
if (curItem.isMailList) {
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(curItem));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("mailingList") + " " + this.tools.getUID(curItem));
} else {
this.curItemInListContent.setAttribute("label", curItem.firstName + " " + curItem.lastName + " <" + curItem.primaryEmail + ">");
}
@@ -1203,17 +1202,17 @@ com.synckolab.AddressBook = {
var curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
// and write the message
- abcontent = com.synckolab.addressbookTools.card2Message(curItem, this.gConfig.email, this.gConfig.format);
- com.synckolab.tools.logMessage("New Card " + this.tools.getUID(curItem), com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ abcontent = synckolab.addressbookTools.card2Message(curItem, this.gConfig.email, this.gConfig.format);
+ synckolab.tools.logMessage("New Card " + this.tools.getUID(curItem), synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// get the dbfile from the local disk
- idxEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
+ idxEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, this.tools.getUID(curItem));
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(com.synckolab.tools.stripMailHeader(abcontent)));
+ synckolab.tools.writeSyncDBFile(idxEntry, this.tools.parseMessageContent(synckolab.tools.stripMailHeader(abcontent)));
}
}
}
diff --git a/src/chrome/content/synckolab/addressbookTools.js b/src/chrome/content/synckolab/addressbookTools.js
index 693aee8..6cdbaf7 100644
--- a/src/chrome/content/synckolab/addressbookTools.js
+++ b/src/chrome/content/synckolab/addressbookTools.js
@@ -31,17 +31,14 @@
* ***** END LICENSE BLOCK ***** */
"use strict";
-if (!com)
- var com = {};
-if (!com.synckolab)
- com.synckolab = {};
+if (!synckolab) var synckolab = {};
/* ----- general functions to access calendar and events ----- */
-com.synckolab.addressbookTools = {
+synckolab.addressbookTools = {
// package shortcuts:
- global : com.synckolab.global,
- tools : com.synckolab.tools,
+ global : synckolab.global,
+ tools : synckolab.tools,
// make sure the listener is only registered ONCE
listenerRegistered: false,
@@ -105,7 +102,7 @@ com.synckolab.addressbookTools = {
case "description":
break;
default:
- com.synckolab.tools.logMessage("ERROR getting " + prop + " from list", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("ERROR getting " + prop + " from list", synckolab.global.LOG_DEBUG);
}
return card[prop] || def;
@@ -242,14 +239,14 @@ com.synckolab.addressbookTools = {
case "AllowRemoteContent":
return card.allowRemoteContent;
default:
- com.synckolab.tools.logMessage("Unable to get property: " + prop, com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Unable to get property: " + prop, synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return def;
}
}
},
haveCardProperty : function (card, prop) {
- return (com.synckolab.tools.text.checkExist(this.getCardProperty(card, prop)));
+ return (synckolab.tools.text.checkExist(this.getCardProperty(card, prop)));
},
/**
@@ -266,12 +263,12 @@ com.synckolab.addressbookTools = {
try {
// sk always uses dirName
if (card.synckolab) {
- return com.synckolab.tools.text.fixNameToMiniCharset(this.getCardProperty(card, "DisplayName"));
+ return synckolab.tools.text.fixNameToMiniCharset(this.getCardProperty(card, "DisplayName"));
}
// tbird is more creative
- return com.synckolab.tools.text.fixNameToMiniCharset(this.getCardProperty(card, "Name"));
+ return synckolab.tools.text.fixNameToMiniCharset(this.getCardProperty(card, "Name"));
} catch (err) {
- com.synckolab.tools.logMessage("Error in getUID. ListNickName: '" + card.listNickName + "'\n\nStack:\n" + err.stack, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Error in getUID. ListNickName: '" + card.listNickName + "'\n\nStack:\n" + err.stack, synckolab.global.LOG_DEBUG);
throw err;
}
}
@@ -303,21 +300,21 @@ com.synckolab.addressbookTools = {
* get the address books form the address-book provider
* @return a collection of address books
*/
-com.synckolab.addressbookTools.getABDirectory = function (listener) {
+synckolab.addressbookTools.getABDirectory = function (listener) {
// tbird >= 7
try {
var abManager = Components.classes["@mozilla.org/abmanager;1"].getService(Components.interfaces.nsIAbManager);
/* - ignore ab listener: if you change something locally - sync manual! */
- if (listener && !com.synckolab.addressbookTools.listenerRegistered) {
+ if (listener && !synckolab.addressbookTools.listenerRegistered) {
abManager.addAddressBookListener(listener, 0xFFFFFFFF); // all
- com.synckolab.addressbookTools.listenerRegistered = true;
+ synckolab.addressbookTools.listenerRegistered = true;
}
return abManager.directories;
} catch (ex) {
// tbird < 7
- var directory = com.synckolab.global.rdf.GetResource("moz-abdirectory://").QueryInterface(Components.interfaces.nsIAbDirectory);
+ var directory = synckolab.global.rdf.GetResource("moz-abdirectory://").QueryInterface(Components.interfaces.nsIAbDirectory);
return directory.childNodes;
}
};
@@ -327,7 +324,7 @@ com.synckolab.addressbookTools.getABDirectory = function (listener) {
* @prop the name of the property (String)
* @value the value to set the property to, null will be changed to an empty string ("")
*/
-com.synckolab.addressbookTools.setCardProperty = function (card, prop, value, extra) {
+synckolab.addressbookTools.setCardProperty = function (card, prop, value, extra) {
if (card === null) {
throw ("Unable to process null-card: " + prop);
}
@@ -519,7 +516,7 @@ com.synckolab.addressbookTools.setCardProperty = function (card, prop, value, ex
case "Custom4":
break; // ignore
default:
- com.synckolab.tools.logMessage("Unable to set property: " + prop + " (reason: not found): " + value, com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Unable to set property: " + prop + " (reason: not found): " + value, synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return;
}
}
@@ -530,7 +527,7 @@ com.synckolab.addressbookTools.setCardProperty = function (card, prop, value, ex
* @param cards childCards - the list of cards
* @param vId string - the custom4 field (card id)
*/
-com.synckolab.addressbookTools.findCard = function (cards, vId, directory) {
+synckolab.addressbookTools.findCard = function (cards, vId, directory) {
// nothing found - try mailing lists
var card = cards.get(vId);
if (card) {
@@ -559,29 +556,40 @@ com.synckolab.addressbookTools.findCard = function (cards, vId, directory) {
* @param xml a dom node of a card or a string with the xml
* @param card the card object to update
*/
-com.synckolab.addressbookTools.xml2Card = function (xml, card) {
+synckolab.addressbookTools.xml2Card = function (xml, card) {
var cur;
// if xml has a nodeType attribute - its already a node
if (xml.indexOf && !xml.nodeName) {
- com.synckolab.tools.logMessage("parsing the XML content into card", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("parsing the XML content into card", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// check if we have to decode quoted printable
if (xml.indexOf(" version=3D") !== -1) {
// we know from the version
- xml = com.synckolab.tools.text.quoted.decode(xml);
+ xml = synckolab.tools.text.quoted.decode(xml);
}
- xml = com.synckolab.tools.text.utf8.decode(xml);
+ //xml = synckolab.tools.text.utf8.decode(xml);
// potential fix: .replace(/&/g, "&amp;")
// convert the string to xml
- var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].getService(Components.interfaces.nsIDOMParser);
- var doc = parser.parseFromString(xml, "text/xml");
+ var doc = synckolab.tools.parseXml(xml);
+
+ if (doc === null) {
+ // so this message has no valid XML part :-(
+ synckolab.tools.logMessage("Error parsing the XML content of this message.\n" + xml, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
+ return null;
+ }
var topNode = doc.firstChild;
+
+ // workaround for parsers that create a node for whitespace
+ if(topNode.nodeType === Node.TEXT_NODE) {
+ topNode = topNode.nextSibling;
+ }
+
if (topNode.nodeName === "parsererror") {
// so this message has no valid XML part :-(
- com.synckolab.tools.logMessage("Error parsing the XML content of this message.\n" + xml, com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Error parsing the XML content of this message.\n" + xml, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return null;
}
if ((topNode.nodeType !== Node.ELEMENT_NODE) || (topNode.nodeName.toUpperCase() !== "CONTACT")) {
@@ -590,14 +598,14 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
return this.Xml2List(topNode, card);
}
// this can't be an event in Kolab XML format
- com.synckolab.tools.logMessage("This message doesn't contain a contact in Kolab XML format (" + topNode.nodeName + ").\n" + xml, com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("This message doesn't contain a contact in Kolab XML format (" + topNode.nodeName + ").\n" + xml, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return null;
}
-
- cur = new com.synckolab.Node(doc.firstChild.firstChild);
+
+ cur = new synckolab.Node(topNode.firstChild);
} else {
- com.synckolab.tools.logMessage("parsing dom tree into card.", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
- cur = new com.synckolab.Node(xml.firstChild);
+ synckolab.tools.logMessage("parsing dom tree into card.", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
+ cur = new synckolab.Node(xml.firstChild);
}
var found = false;
@@ -645,20 +653,20 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
// 1: plaintext
// 2: html
var format = cur.getFirstData().toUpperCase();
- this.setCardProperty(card, "PreferMailFormat", com.synckolab.addressbookTools.MAIL_FORMAT_UNKNOWN);
+ this.setCardProperty(card, "PreferMailFormat", synckolab.addressbookTools.MAIL_FORMAT_UNKNOWN);
switch (format) {
case 'PLAINTEXT':
case 'TEXT':
case 'TXT':
case 'PLAIN':
case '1':
- this.setCardProperty(card, "PreferMailFormat", com.synckolab.addressbookTools.MAIL_FORMAT_PLAINTEXT);
+ this.setCardProperty(card, "PreferMailFormat", synckolab.addressbookTools.MAIL_FORMAT_PLAINTEXT);
break;
case 'HTML':
case 'RICHTEXT':
case 'RICH':
case '2':
- this.setCardProperty(card, "PreferMailFormat", com.synckolab.addressbookTools.MAIL_FORMAT_HTML);
+ this.setCardProperty(card, "PreferMailFormat", synckolab.addressbookTools.MAIL_FORMAT_HTML);
}
break;
@@ -680,7 +688,7 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
case "SMTP-ADDRESS":
case "EMAIL":
- //com.synckolab.tools.logMessage("email: " + email + " - " + cur.getXmlResult("SMTP-ADDRESS", ""), com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ //synckolab.tools.logMessage("email: " + email + " - " + cur.getXmlResult("SMTP-ADDRESS", ""), synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
switch (email) {
case 0:
this.setCardProperty(card, "PrimaryEmail", cur.getXmlResult("SMTP-ADDRESS", ""));
@@ -827,7 +835,7 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
var cnotes = cur.getFirstData();
this.setCardProperty(card, "Notes", cnotes.replace(/\\n/g, "\n"));
- com.synckolab.tools.logMessage("cur.firstchild.data.length=" + cur.firstChild.data.length + " - cnotes=" + cnotes.length + " - card.notes=" + this.getCardProperty(card, "Notes").length, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("cur.firstchild.data.length=" + cur.firstChild.data.length + " - cnotes=" + cnotes.length + " - card.notes=" + this.getCardProperty(card, "Notes").length, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
found = true;
break;
case "DEPARTMENT":
@@ -907,7 +915,7 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
}
if (cur.nodeName !== "product-id" && cur.nodeName !== "sensitivity") {
// remember other fields
- com.synckolab.tools.logMessage("FIELD not found: " + cur.nodeName + "=" + cur.getFirstData(), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("FIELD not found: " + cur.nodeName + "=" + cur.getFirstData(), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
this.setCardProperty(card, cur.nodeName, cur.getFirstData(), true);
}
break;
@@ -925,9 +933,9 @@ com.synckolab.addressbookTools.xml2Card = function (xml, card) {
return null;
};
-com.synckolab.addressbookTools.list2Pojo = function (card) {
+synckolab.addressbookTools.list2Pojo = function (card) {
var pojo = {
- synckolab : com.synckolab.config.version, // synckolab version
+ synckolab : synckolab.config.version, // synckolab version
type : "maillist", // a contact
isMailList : true,
ts : new Date().getTime(), // the current time
@@ -958,7 +966,7 @@ com.synckolab.addressbookTools.list2Pojo = function (card) {
pojo.contacts.push(cardObj);
}
} else {
- com.synckolab.tools.logMessage("lists not supported ", com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("lists not supported ", synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return null;
}
@@ -971,27 +979,27 @@ com.synckolab.addressbookTools.list2Pojo = function (card) {
* @param card nsIAbCard: the adress book list card
* @param fields Array: all the fields not being held in the default card
*/
-com.synckolab.addressbookTools.list2Xml = function (card, fields) {
+synckolab.addressbookTools.list2Xml = function (card, fields) {
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
xml += "<distribution-list version=\"1.0\" >\n";
xml += " <product-id>SyncKolab, Kolab resource</product-id>\n";
xml += " <uid>" + this.getUID(card) + "</uid>\n";
- xml += " <creation-date>" + com.synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + com.synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</creation-date>\n";
- xml += " <last-modification-date>" + com.synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + com.synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</last-modification-date>\n";
+ xml += " <creation-date>" + synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</creation-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</last-modification-date>\n";
// default: public - tbird doesnt know of other types of list like private
xml += " <sensitivity>public</sensitivity>\n";
- xml += " <name>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "DisplayName")) + "</name>\n";
+ xml += " <name>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "DisplayName")) + "</name>\n";
if (this.haveCardProperty(card, "Notes")) {
- xml += " <body>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "Notes")) + "</body>\n";
+ xml += " <body>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "Notes")) + "</body>\n";
}
if (this.haveCardProperty(card, "NickName")) {
- xml += " <nickname>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "NickName")) + "</nickname>\n";
+ xml += " <nickname>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "NickName")) + "</nickname>\n";
}
- com.synckolab.tools.logMessage("going through child cards", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("going through child cards", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
var cList = this.abListObject(card);
var lCards = cList.childCards;
if (lCards) {
@@ -1003,36 +1011,36 @@ com.synckolab.addressbookTools.list2Xml = function (card, fields) {
// get the uid or generate it
var uid = this.getUID(cur);
if (!uid) {
- uid = "sk-vc-" + com.synckolab.tools.text.randomVcardId();
- com.synckolab.addressbookTools.setUID(cur, uid);
+ uid = "sk-vc-" + synckolab.tools.text.randomVcardId();
+ synckolab.addressbookTools.setUID(cur, uid);
}
xml += " <member>\n";
if (this.haveCardProperty(cur, "DisplayName")) {
- xml += " " + com.synckolab.tools.text.nodeWithContent("display-name", this.getCardProperty(cur, "DisplayName"), false);
+ xml += " " + synckolab.tools.text.nodeWithContent("display-name", this.getCardProperty(cur, "DisplayName"), false);
}
if (this.haveCardProperty(cur, "PrimaryEmail")) {
- xml += " " + com.synckolab.tools.text.nodeWithContent("smtp-address", this.getCardProperty(cur, "PrimaryEmail"), false);
+ xml += " " + synckolab.tools.text.nodeWithContent("smtp-address", this.getCardProperty(cur, "PrimaryEmail"), false);
} else if (this.haveCardProperty(cur, "SecondEmail")) {
- xml += " " + com.synckolab.tools.text.nodeWithContent("smtp-address", this.getCardProperty(cur, "SecondEmail"), false);
+ xml += " " + synckolab.tools.text.nodeWithContent("smtp-address", this.getCardProperty(cur, "SecondEmail"), false);
} else {
- com.synckolab.tools.logMessage("List entry without an email!" + this.getUID(cur), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("List entry without an email!" + this.getUID(cur), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
- xml += " " + com.synckolab.tools.text.nodeWithContent("uid", uid, false);
+ xml += " " + synckolab.tools.text.nodeWithContent("uid", uid, false);
xml += " </member>\n";
}
} else {
- com.synckolab.tools.logMessage("lists not supported " + xml, com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("lists not supported " + xml, synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return null;
}
} else {
- com.synckolab.tools.logMessage("lists not supported " + xml, com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("lists not supported " + xml, synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
return null;
}
xml += "</distribution-list>\n";
- com.synckolab.tools.logMessage("list: " + xml, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("list: " + xml, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return xml;
};
@@ -1043,27 +1051,27 @@ com.synckolab.addressbookTools.list2Xml = function (card, fields) {
* @param card nsIAbCard: the adress book list card
* @param fields Array: all the fields not being held in the default card
*/
-com.synckolab.addressbookTools.list2Vcard = function (card, fields) {
+synckolab.addressbookTools.list2Vcard = function (card, fields) {
// save the date in microseconds
// Date: Fri, 17 Dec 2004 15:06:42 +0100
var cdate = new Date(this.getCardProperty(card, "LastModifiedDate") * 1000);
var sTime = (cdate.getHours() < 10 ? "0" : "") + cdate.getHours() + ":" + (cdate.getMinutes() < 10 ? "0" : "") + cdate.getMinutes() + ":" + (cdate.getSeconds() < 10 ? "0" : "") + cdate.getSeconds();
- var sdate = "DATE: " + com.synckolab.tools.text.getDayString(cdate.getDay()) + ", " +
- cdate.getDate() + " " + com.synckolab.tools.text.getMonthString(cdate.getMonth()) + " " +
+ var sdate = "DATE: " + synckolab.tools.text.getDayString(cdate.getDay()) + ", " +
+ cdate.getDate() + " " + synckolab.tools.text.getMonthString(cdate.getMonth()) + " " +
cdate.getFullYear() + " " + sTime + " " + (((cdate.getTimezoneOffset() / 60) < 0) ? "-" : "+") +
(((cdate.getTimezoneOffset() / 60) < 10) ? "0" : "") + cdate.getTimezoneOffset() + "\n";
var msg = "BEGIN:VCARD\n";
msg += "UID:" + this.getUID(card) + "\n";
- msg += "FN:" + com.synckolab.tools.text.quoted.encode(card.displayName) + "\n";
+ msg += "FN:" + synckolab.tools.text.quoted.encode(card.displayName) + "\n";
if (this.haveCardProperty(card, "Notes")) {
- msg += 'NOTE:' + com.synckolab.tools.text.quoted.encode(this.getCardProperty(card, "Notes")) + "\n";
+ msg += 'NOTE:' + synckolab.tools.text.quoted.encode(this.getCardProperty(card, "Notes")) + "\n";
}
if (this.haveCardProperty(card, "NickName")) {
- msg += "NICK:" + com.synckolab.tools.text.quoted.encode(this.getCardProperty(card, "NickName")) + "\n";
+ msg += "NICK:" + synckolab.tools.text.quoted.encode(this.getCardProperty(card, "NickName")) + "\n";
}
var uidList = "";
@@ -1071,7 +1079,7 @@ com.synckolab.addressbookTools.list2Vcard = function (card, fields) {
var cList = card;
if (cList.addressLists) {
var total = cList.addressLists.length;
- com.synckolab.tools.logMessage("List has " + total + " contacts", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("List has " + total + " contacts", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
if (!total || total === 0) {
return null; // do not add a list without members
}
@@ -1099,7 +1107,7 @@ com.synckolab.addressbookTools.list2Vcard = function (card, fields) {
/**
* moves the temp image stored in /tmp/synckolab.img to its final position
*/
-com.synckolab.addressbookTools.copyImage = function (newName) {
+synckolab.addressbookTools.copyImage = function (newName) {
// wrong name - forget it
if (newName === null || newName === "" || newName === "null") {
return;
@@ -1126,7 +1134,7 @@ com.synckolab.addressbookTools.copyImage = function (newName) {
try {
file.moveTo(fileTo, newName);
} catch (ex) {
- com.synckolab.tools.logMessage("Unable to move file " + newName + "\n" + ex, com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Unable to move file " + newName + "\n" + ex, synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
}
// check if the file exists
@@ -1140,10 +1148,10 @@ com.synckolab.addressbookTools.copyImage = function (newName) {
* @param card nsIAbCard: the adress book card
* @param fields Array: all the fields not being held in the default card
*/
-com.synckolab.addressbookTools.card2Xml = function (card, fields) {
+synckolab.addressbookTools.card2Xml = function (card, fields) {
// translate the card: base64xml, xml, vcard
- //com.synckolab.tools.logMessage ("XML: \n" + card.translateTo("xml"), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB); - dont work is actually a HTML
- //com.synckolab.tools.logMessage ("VCARD: \n" + card.translateTo("vcard"), com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB); // converts a little too much and ignores uuid
+ //synckolab.tools.logMessage ("XML: \n" + card.translateTo("xml"), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB); - dont work is actually a HTML
+ //synckolab.tools.logMessage ("VCARD: \n" + card.translateTo("vcard"), synckolab.global.LOG_WARNING + synckolab.global.LOG_AB); // converts a little too much and ignores uuid
// debug for photo:
@@ -1151,53 +1159,53 @@ com.synckolab.addressbookTools.card2Xml = function (card, fields) {
var xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
xml += "<contact version=\"1.0\" >\n";
xml += " <product-id>SyncKolab, Kolab resource</product-id>\n";
- xml += " <uid>" + com.synckolab.tools.text.encode4XML(this.getUID(card)) + "</uid>\n";
- xml += com.synckolab.tools.text.nodeWithContent("categories", this.getCardProperty(card, "Category"), false);
- //xml += " <creation-date>"+com.synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"T"+com.synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"Z</creation-date>\n";
- xml += " <last-modification-date>" + com.synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + com.synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</last-modification-date>\n";
+ xml += " <uid>" + synckolab.tools.text.encode4XML(this.getUID(card)) + "</uid>\n";
+ xml += synckolab.tools.text.nodeWithContent("categories", this.getCardProperty(card, "Category"), false);
+ //xml += " <creation-date>"+synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"T"+synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"Z</creation-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "T" + synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate") * 1000)) + "Z</last-modification-date>\n";
// ??
xml += " <sensitivity>public</sensitivity>\n";
if (this.haveCardProperty(card, "Notes")) {
- xml += " <body>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "Notes")) + "</body>\n";
+ xml += " <body>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "Notes")) + "</body>\n";
}
if (this.haveCardProperty(card, "FirstName") || this.haveCardProperty(card, "LastName") || this.haveCardProperty(card, "DisplayName") || this.haveCardProperty(card, "NickName")) {
xml += " <name>\n";
if (this.haveCardProperty(card, "FirstName")) {
- xml += " <given-name>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "FirstName")) + "</given-name>\n";
+ xml += " <given-name>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "FirstName")) + "</given-name>\n";
}
// xml += " <middle-names>"+this.getCardProperty(card, "NickName")+"</middle-names>\n"; // not really correct...
if (this.haveCardProperty(card, "LastName")) {
- xml += " <last-name>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "LastName")) + "</last-name>\n";
+ xml += " <last-name>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "LastName")) + "</last-name>\n";
}
if (this.haveCardProperty(card, "DisplayName")) {
- xml += " <full-name>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "DisplayName")) + "</full-name>\n";
+ xml += " <full-name>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "DisplayName")) + "</full-name>\n";
displayName = this.getCardProperty(card, "DisplayName");
} else if (this.haveCardProperty(card, "FirstName") || this.haveCardProperty(card, "LastName")) {
displayName = this.getCardProperty(card, "FirstName") + " " + this.getCardProperty(card, "LastName");
- xml += com.synckolab.tools.text.nodeWithContent("full-name", displayName);
+ xml += synckolab.tools.text.nodeWithContent("full-name", displayName);
}
xml += " </name>\n";
}
- xml += com.synckolab.tools.text.nodeWithContent("organization", this.getCardProperty(card, "Company"), false);
- xml += com.synckolab.tools.text.nodeWithContent("web-page", this.getCardProperty(card, "WebPage1"), false);
+ xml += synckolab.tools.text.nodeWithContent("organization", this.getCardProperty(card, "Company"), false);
+ xml += synckolab.tools.text.nodeWithContent("web-page", this.getCardProperty(card, "WebPage1"), false);
// not really kolab.. but we need that somewhere
- xml += com.synckolab.tools.text.nodeWithContent("business-web-page", this.getCardProperty(card, "WebPage2"), false);
- xml += com.synckolab.tools.text.nodeWithContent("im-address", this.getCardProperty(card, "AimScreenName"), false);
- xml += com.synckolab.tools.text.nodeWithContent("department", this.getCardProperty(card, "Department"), false);
+ xml += synckolab.tools.text.nodeWithContent("business-web-page", this.getCardProperty(card, "WebPage2"), false);
+ xml += synckolab.tools.text.nodeWithContent("im-address", this.getCardProperty(card, "AimScreenName"), false);
+ xml += synckolab.tools.text.nodeWithContent("department", this.getCardProperty(card, "Department"), false);
//" <office-location>zuhaus</office-location>\n";
//" <profession>programmierer</profession>\n";
- xml += com.synckolab.tools.text.nodeWithContent("job-title", this.getCardProperty(card, "JobTitle"), false);
- xml += com.synckolab.tools.text.nodeWithContent("nick-name", this.getCardProperty(card, "NickName"), false);
+ xml += synckolab.tools.text.nodeWithContent("job-title", this.getCardProperty(card, "JobTitle"), false);
+ xml += synckolab.tools.text.nodeWithContent("nick-name", this.getCardProperty(card, "NickName"), false);
var adate;
if (this.haveCardProperty(card, "BirthYear") && this.haveCardProperty(card, "BirthMonth") && this.haveCardProperty(card, "BirthDay")) {
adate = this.getCardProperty(card, "BirthYear") + "-" + this.getCardProperty(card, "BirthMonth") + "-" + this.getCardProperty(card, "BirthDay");
- xml += com.synckolab.tools.text.nodeWithContent("birthday", adate, false);
+ xml += synckolab.tools.text.nodeWithContent("birthday", adate, false);
}
if (this.haveCardProperty(card, "AnniversaryYear") && this.haveCardProperty(card, "AnniversaryMonth") && this.haveCardProperty(card, "AnniversaryDay")) {
adate = this.getCardProperty(card, "AnniversaryYear") + "-" + this.getCardProperty(card, "AnniversaryMonth") + "-" + this.getCardProperty(card, "AnniversaryDay");
- xml += com.synckolab.tools.text.nodeWithContent("anniversary", adate, false);
+ xml += synckolab.tools.text.nodeWithContent("anniversary", adate, false);
}
if (this.haveCardProperty(card, "HomePhone")) {
xml += " <phone>\n";
@@ -1232,53 +1240,53 @@ com.synckolab.addressbookTools.card2Xml = function (card, fields) {
if (this.haveCardProperty(card, "PrimaryEmail")) {
xml += " <email type=\"primary\">\n";
- xml += " <display-name>" + com.synckolab.tools.text.encode4XML(displayName) + "</display-name>\n";
- xml += " <smtp-address>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "PrimaryEmail")) + "</smtp-address>\n";
+ xml += " <display-name>" + synckolab.tools.text.encode4XML(displayName) + "</display-name>\n";
+ xml += " <smtp-address>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "PrimaryEmail")) + "</smtp-address>\n";
xml += " </email>\n";
}
if (this.haveCardProperty(card, "SecondEmail")) {
xml += " <email>\n";
- xml += " <display-name>" + com.synckolab.tools.text.encode4XML(displayName) + "</display-name>\n";
- xml += " <smtp-address>" + com.synckolab.tools.text.encode4XML(this.getCardProperty(card, "SecondEmail")) + "</smtp-address>\n";
+ xml += " <display-name>" + synckolab.tools.text.encode4XML(displayName) + "</display-name>\n";
+ xml += " <smtp-address>" + synckolab.tools.text.encode4XML(this.getCardProperty(card, "SecondEmail")) + "</smtp-address>\n";
xml += " </email>\n";
}
// if the mail format is set...
- if (this.getCardProperty(card, "PreferMailFormat") && this.getCardProperty(card, "PreferMailFormat") !== com.synckolab.addressbookTools.MAIL_FORMAT_UNKNOWN) {
+ if (this.getCardProperty(card, "PreferMailFormat") && this.getCardProperty(card, "PreferMailFormat") !== synckolab.addressbookTools.MAIL_FORMAT_UNKNOWN) {
if (Number(this.getCardProperty(card, "PreferMailFormat")) === this.MAIL_FORMAT_PLAINTEXT) {
- xml += com.synckolab.tools.text.nodeWithContent("prefer-mail-format", "text", false);
+ xml += synckolab.tools.text.nodeWithContent("prefer-mail-format", "text", false);
} else if (Number(this.getCardProperty(card, "PreferMailFormat")) === this.MAIL_FORMAT_HTML) {
- xml += com.synckolab.tools.text.nodeWithContent("prefer-mail-format", "html", false);
+ xml += synckolab.tools.text.nodeWithContent("prefer-mail-format", "html", false);
}
}
if (this.haveCardProperty(card, "HomeAddress") || this.haveCardProperty(card, "HomeAddress2") || this.haveCardProperty(card, "HomeCity") || this.haveCardProperty(card, "HomeState") || this.haveCardProperty(card, "HomeZipCode") || this.haveCardProperty(card, "HomeCountry")) {
xml += " <address>\n";
xml += " <type>home</type>\n";
- xml += com.synckolab.tools.text.nodeWithContent("street", this.getCardProperty(card, "HomeAddress"), false);
- xml += com.synckolab.tools.text.nodeWithContent("street2", this.getCardProperty(card, "HomeAddress2"), false);
- xml += com.synckolab.tools.text.nodeWithContent("locality", this.getCardProperty(card, "HomeCity"), false);
- xml += com.synckolab.tools.text.nodeWithContent("region", this.getCardProperty(card, "HomeState"), false);
- xml += com.synckolab.tools.text.nodeWithContent("postal-code", this.getCardProperty(card, "HomeZipCode"), false);
- xml += com.synckolab.tools.text.nodeWithContent("country", this.getCardProperty(card, "HomeCountry"), false);
+ xml += synckolab.tools.text.nodeWithContent("street", this.getCardProperty(card, "HomeAddress"), false);
+ xml += synckolab.tools.text.nodeWithContent("street2", this.getCardProperty(card, "HomeAddress2"), false);
+ xml += synckolab.tools.text.nodeWithContent("locality", this.getCardProperty(card, "HomeCity"), false);
+ xml += synckolab.tools.text.nodeWithContent("region", this.getCardProperty(card, "HomeState"), false);
+ xml += synckolab.tools.text.nodeWithContent("postal-code", this.getCardProperty(card, "HomeZipCode"), false);
+ xml += synckolab.tools.text.nodeWithContent("country", this.getCardProperty(card, "HomeCountry"), false);
xml += " </address>\n";
}
if (this.haveCardProperty(card, "WorkAddress") || this.haveCardProperty(card, "WorkAddress2") || this.haveCardProperty(card, "WorkCity") || this.haveCardProperty(card, "WorkState") || this.haveCardProperty(card, "WorkZipCode") || this.haveCardProperty(card, "WorkCountry")) {
xml += " <address>\n";
xml += " <type>business</type>\n";
- xml += com.synckolab.tools.text.nodeWithContent("street", this.getCardProperty(card, "WorkAddress"), false);
- xml += com.synckolab.tools.text.nodeWithContent("street2", this.getCardProperty(card, "WorkAddress2"), false);
- xml += com.synckolab.tools.text.nodeWithContent("locality", this.getCardProperty(card, "WorkCity"), false);
- xml += com.synckolab.tools.text.nodeWithContent("region", this.getCardProperty(card, "WorkState"), false);
- xml += com.synckolab.tools.text.nodeWithContent("postal-code", this.getCardProperty(card, "WorkZipCode"), false);
- xml += com.synckolab.tools.text.nodeWithContent("country", this.getCardProperty(card, "WorkCountry"), false);
+ xml += synckolab.tools.text.nodeWithContent("street", this.getCardProperty(card, "WorkAddress"), false);
+ xml += synckolab.tools.text.nodeWithContent("street2", this.getCardProperty(card, "WorkAddress2"), false);
+ xml += synckolab.tools.text.nodeWithContent("locality", this.getCardProperty(card, "WorkCity"), false);
+ xml += synckolab.tools.text.nodeWithContent("region", this.getCardProperty(card, "WorkState"), false);
+ xml += synckolab.tools.text.nodeWithContent("postal-code", this.getCardProperty(card, "WorkZipCode"), false);
+ xml += synckolab.tools.text.nodeWithContent("country", this.getCardProperty(card, "WorkCountry"), false);
xml += " </address>\n";
}
// photo name = photo - this is an attachment (handled outside)
- xml += com.synckolab.tools.text.nodeWithContent("picture", this.getCardProperty(card, "PhotoName"), false);
+ xml += synckolab.tools.text.nodeWithContent("picture", this.getCardProperty(card, "PhotoName"), false);
// we can probably ignore that
var ptype = this.getCardProperty(card, "PhotoType");
@@ -1288,18 +1296,18 @@ com.synckolab.addressbookTools.card2Xml = function (card, fields) {
* found in ~profil/Photos/FILENAME
* 2. create an attachment name FILENAME with the content (base64 encoded)
*/
- xml += com.synckolab.tools.text.nodeWithContent("picture-uri", this.getCardProperty(card, "PhotoURI"), false); // we can distinguish between file: and http: anyways
+ xml += synckolab.tools.text.nodeWithContent("picture-uri", this.getCardProperty(card, "PhotoURI"), false); // we can distinguish between file: and http: anyways
}
- //xml += com.synckolab.tools.text.nodeWithContent("preferred-address", this.getCardProperty(card, "DefaultAddress"), false); @deprecated
- xml += com.synckolab.tools.text.nodeWithContent("custom1", this.getCardProperty(card, "Custom1"), false);
- xml += com.synckolab.tools.text.nodeWithContent("custom2", this.getCardProperty(card, "Custom2"), false);
- xml += com.synckolab.tools.text.nodeWithContent("custom3", this.getCardProperty(card, "Custom3"), false);
- xml += com.synckolab.tools.text.nodeWithContent("custom4", this.getCardProperty(card, "Custom4"), false);
+ //xml += synckolab.tools.text.nodeWithContent("preferred-address", this.getCardProperty(card, "DefaultAddress"), false); @deprecated
+ xml += synckolab.tools.text.nodeWithContent("custom1", this.getCardProperty(card, "Custom1"), false);
+ xml += synckolab.tools.text.nodeWithContent("custom2", this.getCardProperty(card, "Custom2"), false);
+ xml += synckolab.tools.text.nodeWithContent("custom3", this.getCardProperty(card, "Custom3"), false);
+ xml += synckolab.tools.text.nodeWithContent("custom4", this.getCardProperty(card, "Custom4"), false);
if (this.getCardProperty(card, "AllowRemoteContent")) {
- xml += com.synckolab.tools.text.nodeWithContent("allow-remote-content", "true", false);
+ xml += synckolab.tools.text.nodeWithContent("allow-remote-content", "true", false);
} else {
- xml += com.synckolab.tools.text.nodeWithContent("allow-remote-content", "false", false);
+ xml += synckolab.tools.text.nodeWithContent("allow-remote-content", "false", false);
}
// add extra/missing fields
@@ -1315,8 +1323,8 @@ com.synckolab.addressbookTools.card2Xml = function (card, fields) {
/**
* Generate a sha1 key out of a vcard - used for database
*/
-com.synckolab.addressbookTools.genConSha1 = function (card) {
- return com.synckolab.tools.sha1.hex_sha1(this.getCardProperty(card, "AimScreenName") + ":" + this.getCardProperty(card, "AnniversaryDay") + ":" + this.getCardProperty(card, "AnniversaryMonth") + ":" + this.getCardProperty(card, "AnniversaryYear") + ":" + this.getCardProperty(card, "BirthDay") +
+synckolab.addressbookTools.genConSha1 = function (card) {
+ return synckolab.tools.sha1.hex_sha1(this.getCardProperty(card, "AimScreenName") + ":" + this.getCardProperty(card, "AnniversaryDay") + ":" + this.getCardProperty(card, "AnniversaryMonth") + ":" + this.getCardProperty(card, "AnniversaryYear") + ":" + this.getCardProperty(card, "BirthDay") +
":" + this.getCardProperty(card, "BirthMonth") + ":" + this.getCardProperty(card, "BirthYear") + ":" + this.getCardProperty(card, "CardType") + ":" + this.getCardProperty(card, "Category") + ":" + this.getCardProperty(card, "CellularNumber") +
":" + this.getCardProperty(card, "CellularNumberType") + ":" + this.getCardProperty(card, "Company") + ":" + this.getCardProperty(card, "Custom1") + ":" + this.getCardProperty(card, "Custom2") + ":" + this.getCardProperty(card, "Custom3") + ":" + this.getCardProperty(card, "Custom4") + ":" +
//this.getCardProperty(card, "DefaultAddress") + ":" + @deprecated
@@ -1336,7 +1344,7 @@ com.synckolab.addressbookTools.genConSha1 = function (card) {
* It takes note of most fields (except custom4)
*
*/
-com.synckolab.addressbookTools.equalsContact = function (a, b) {
+synckolab.addressbookTools.equalsContact = function (a, b) {
//Fields to look for
var fieldsArray;
// remember the numeric field
@@ -1344,12 +1352,12 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
// if one does not exist - they are definitely different!
if (!a || !b) {
- com.synckolab.tools.logMessage("not equals: " + (a?"a":"b") + " does not exist" , com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("not equals: " + (a?"a":"b") + " does not exist" , synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return false;
}
if (a.isMailList !== b.isMailList) {
- com.synckolab.tools.logMessage("not equals isMailList: '" + (a.isMailList ? "true" : "false") + "' vs. '" + (b.isMailList ? "true" : "false") + "'", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("not equals isMailList: '" + (a.isMailList ? "true" : "false") + "' vs. '" + (b.isMailList ? "true" : "false") + "'", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return false;
}
@@ -1394,7 +1402,7 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
if (sa === null && sb === null) {
continue;
} else {
- com.synckolab.tools.logMessage("not equals " + fieldsArray[i] + " '" + sa + "' vs. '" + sb + "'", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("not equals " + fieldsArray[i] + " '" + sa + "' vs. '" + sb + "'", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return false;
}
}
@@ -1409,28 +1417,28 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
}
}
- com.synckolab.tools.logMessage("not equals " + fieldsArray[i] + " '" + sa + "' vs. '" + sb + "'", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("not equals " + fieldsArray[i] + " '" + sa + "' vs. '" + sb + "'", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return false;
}
}
if (a.isMailList) {
- com.synckolab.tools.logMessage("start comparing mailing lists!", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("start comparing mailing lists!", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// convert lists to simple object
if (!a.synckolab) {
- a = com.synckolab.addressbookTools.list2Pojo(a);
+ a = synckolab.addressbookTools.list2Pojo(a);
}
if (!b.synckolab) {
- b = com.synckolab.addressbookTools.list2Pojo(b);
+ b = synckolab.addressbookTools.list2Pojo(b);
}
- com.synckolab.tools.logMessage(a.toSource() + " vs. " + b.toSource(), com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage(a.toSource() + " vs. " + b.toSource(), synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
// length needs to be equal
if (a.contacts && b.contacts && a.contacts.length !== b.contacts.length) {
- com.synckolab.tools.logMessage("different amount of contacts in each list", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("different amount of contacts in each list", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return false;
}
@@ -1449,7 +1457,7 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
}
if(aContacts.length !== bContacts.length) {
- com.synckolab.tools.logMessage("different amount of contacts in each list (a:"+aContacts.length +" b: " + bContacts.length+")", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("different amount of contacts in each list (a:"+aContacts.length +" b: " + bContacts.length+")", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return false;
}
@@ -1465,14 +1473,14 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
}
// break at the first contact that has not been found
if (!found) {
- com.synckolab.tools.logMessage("contact: " + bContacts[i].UUID + " not in both lists!", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("contact: " + bContacts[i].UUID + " not in both lists!", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return false;
}
}
// if there are any childcards left - return
if (aContacts.length > 0) {
- com.synckolab.tools.logMessage("still " + aContacts.length + " contacts in a", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("still " + aContacts.length + " contacts in a", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return false;
}
// listst are equals
@@ -1482,7 +1490,7 @@ com.synckolab.addressbookTools.equalsContact = function (a, b) {
return true;
};
-com.synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards) {
+synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards) {
var beginVCard = false;
card.type = "maillist";
@@ -1504,7 +1512,7 @@ com.synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards)
tok[1] += ":" + tok[j];
}
- com.synckolab.tools.logMessage("parsing: " + lines[i], com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("parsing: " + lines[i], synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
var found;
switch (tok[0].toUpperCase()) {
case "DATE":
@@ -1555,9 +1563,9 @@ com.synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards)
}
}
var newCard = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
- com.synckolab.addressbookTools.message2Card(lines, newCard, null, cStart, i);
+ synckolab.addressbookTools.message2Card(lines, newCard, null, cStart, i);
// check if we know this card already :) - ONLY cards
- var gotCard = com.synckolab.addressbookTools.findCard(cards, this.getUID(newCard), null);
+ var gotCard = synckolab.addressbookTools.findCard(cards, this.getUID(newCard), null);
if (gotCard) {
card.addressLists.appendElement(gotCard);
} else {
@@ -1572,7 +1580,7 @@ com.synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards)
break;
default:
- com.synckolab.tools.logMessage("VL FIELD not found: " + tok[0] + ":" + tok[1], com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("VL FIELD not found: " + tok[0] + ":" + tok[1], synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
//extraFields.addField(tok[0], tok[1]);
break;
} // end switch
@@ -1586,11 +1594,11 @@ com.synckolab.addressbookTools.vList2Card = function (uids, lines, card, cards)
* @param topNode the node to parse
* @param card the card object
*/
-com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
+synckolab.addressbookTools.Xml2List = function (topNode, card) {
card.type = "maillist";
card.isMailList = true;
- var cur = new com.synckolab.Node(topNode.firstChild);
+ var cur = new synckolab.Node(topNode.firstChild);
var found = false;
var email = 0;
@@ -1643,7 +1651,7 @@ com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
card.contacts = [];
}
var member = {
- synckolab : com.synckolab.config.version, // synckolab version
+ synckolab : synckolab.config.version, // synckolab version
listMember : true,
type : "contact", // a contact
isMailList : false,
@@ -1651,8 +1659,8 @@ com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
// the current time
};
// parse the whole card
- com.synckolab.addressbookTools.xml2Card(cur, member);
- com.synckolab.tools.logMessage("FOUND CARD: " + member.toSource(), com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.addressbookTools.xml2Card(cur, member);
+ synckolab.tools.logMessage("FOUND CARD: " + member.toSource(), synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
card.contacts.push(member);
// parse the member - take as much as we wan
@@ -1664,7 +1672,7 @@ com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
// ignore
break;
default:
- com.synckolab.tools.logMessage("Ignoring XML list FIELD not found: " + cur.nodeName, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Ignoring XML list FIELD not found: " + cur.nodeName, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
break;
}
@@ -1676,7 +1684,7 @@ com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
if (!found) {
return null;
}
- com.synckolab.tools.logMessage("finished parsing list: " + this.getUID(card) + "\n" + card.toSource(), com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("finished parsing list: " + this.getUID(card) + "\n" + card.toSource(), synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return card;
};
@@ -1684,19 +1692,19 @@ com.synckolab.addressbookTools.Xml2List = function (topNode, card) {
/**
* @return true if the message contains a list instead of a card
*/
-com.synckolab.addressbookTools.isMailList = function (message) {
+synckolab.addressbookTools.isMailList = function (message) {
if(message.synckolab) {
return message.type === "maillist";
}
if (message.indexOf("<?xml") !== -1 || message.indexOf("<?XML") !== -1) {
if (message.indexOf("<distribution-list") !== -1 || message.indexOf("<DISTRIBUTION-LIST") !== -1) {
- com.synckolab.tools.logMessage("is mail list returning true", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("is mail list returning true", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return true;
}
}
if (message.indexOf("X-LIST") !== -1 || message.indexOf("x-list") !== -1) {
- com.synckolab.tools.logMessage("is mail list returning true", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("is mail list returning true", synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
return true;
}
@@ -1714,10 +1722,10 @@ com.synckolab.addressbookTools.isMailList = function (message) {
* @param message string - a string with the vcard (make sure its trimmed from whitespace)
* @return the filled object or null if not parseable
*/
-com.synckolab.addressbookTools.parseMessageContent = function (message) {
+synckolab.addressbookTools.parseMessageContent = function (message) {
// fix for bug #16766: message has no properties
if (message === null) {
- return false;
+ return null;
}
// if fileContent contains a synckolab field its already parsed
@@ -1727,7 +1735,7 @@ com.synckolab.addressbookTools.parseMessageContent = function (message) {
// the pojo contains the synckolab version - this is used to identify the content
var card = {
- synckolab : com.synckolab.config.version, // synckolab version
+ synckolab : synckolab.config.version, // synckolab version
type : "contact", // a contact
isMailList : false,
ts : new Date().getTime()
@@ -1737,23 +1745,23 @@ com.synckolab.addressbookTools.parseMessageContent = function (message) {
// check for xml style
if (message.indexOf("<?xml") !== -1 || message.indexOf("<?XML") !== -1) {
if (this.xml2Card(message, card)) {
- card.sha1 = com.synckolab.addressbookTools.genConSha1(card);
+ card.sha1 = synckolab.addressbookTools.genConSha1(card);
return card;
}
} else {
- com.synckolab.tools.logMessage("VCARD/VLIST!", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("VCARD/VLIST!", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
// decode utf8
- message = com.synckolab.tools.text.utf8.decode(message);
+ message = synckolab.tools.text.utf8.decode(message);
// check for errors in the decoded message
if (message.indexOf("TYPE=3D") !== -1) {
- message = com.synckolab.tools.text.quoted.decode(message);
+ message = synckolab.tools.text.quoted.decode(message);
} else
// that still looks double decoded
if (message.indexOf("=C3=") !== -1) {
- message = com.synckolab.tools.text.utf8.decode(com.synckolab.tools.text.quoted.decode(message));
+ message = synckolab.tools.text.utf8.decode(synckolab.tools.text.quoted.decode(message));
}
// make an array of all lines for easier parsing
@@ -1762,7 +1770,7 @@ com.synckolab.addressbookTools.parseMessageContent = function (message) {
// check if we got a list
for ( var i = 0; i < lines.length; i++) {
if (lines[i].toUpperCase().indexOf("X-LIST") !== -1) {
- com.synckolab.tools.logMessage("parsing a list: " + message, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("parsing a list: " + message, synckolab.global.LOG_DEBUG + synckolab.global.LOG_AB);
if (!this.vList2Card(lines[i], lines, card)) {
return null;
}
@@ -1770,12 +1778,12 @@ com.synckolab.addressbookTools.parseMessageContent = function (message) {
}
}
- if (!com.synckolab.addressbookTools.message2Card(lines, card, 0, lines.length)) {
- com.synckolab.tools.logMessage("unparseable: " + message, com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ if (!synckolab.addressbookTools.message2Card(lines, card, 0, lines.length)) {
+ synckolab.tools.logMessage("unparseable: " + message, synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
return null;
}
- card.sha1 = com.synckolab.addressbookTools.genConSha1(card);
+ card.sha1 = synckolab.addressbookTools.genConSha1(card);
return card;
};
@@ -1784,7 +1792,7 @@ com.synckolab.addressbookTools.parseMessageContent = function (message) {
* @param base the base json object
* @return a thunderbird object (either nsIABCard or nsIAbDirectory)
*/
-com.synckolab.addressbookTools.createTBirdObject = function (base, cards) {
+synckolab.addressbookTools.createTBirdObject = function (base, cards) {
var card = null;
if (base.type === "contact") {
card = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
@@ -1834,7 +1842,7 @@ com.synckolab.addressbookTools.createTBirdObject = function (base, cards) {
* @param fields Array - extra fields to save with the card (may be null)
*
*/
-com.synckolab.addressbookTools.message2Card = function (lines, card, startI, endI) {
+synckolab.addressbookTools.message2Card = function (lines, card, startI, endI) {
// reset the card
this.setCardProperty(card, "AimScreenName", "");
this.setCardProperty(card, "AnniversaryDay", "");
@@ -2000,7 +2008,7 @@ com.synckolab.addressbookTools.message2Card = function (lines, card, startI, end
this.setCardProperty(card, "SecondEmail", tok[1]);
gotEmailSecondary = true;
} else {
- com.synckolab.tools.logMessage("additional email found: " + tok[1], com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("additional email found: " + tok[1], synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
this.setCardProperty(card, tok[0], tok[1], true);
}
@@ -2189,7 +2197,7 @@ com.synckolab.addressbookTools.message2Card = function (lines, card, startI, end
break;
default:
- com.synckolab.tools.logMessage("VC FIELD not found: " + tok[0] + ":" + tok[1], com.synckolab.global.LOG_WARNING + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("VC FIELD not found: " + tok[0] + ":" + tok[1], synckolab.global.LOG_WARNING + synckolab.global.LOG_AB);
this.setCardProperty(card, tok[0], tok[1], true);
} // end switch
}
@@ -2197,13 +2205,13 @@ com.synckolab.addressbookTools.message2Card = function (lines, card, startI, end
// invalid VCARD: no uid:
if (this.getUID(card) === null) {
// generate one
- this.setUID(card, "vc-" + com.synckolab.tools.text.randomVcardId());
+ this.setUID(card, "vc-" + synckolab.tools.text.randomVcardId());
}
return found;
};
-com.synckolab.addressbookTools.list2Human = function (card) {
+synckolab.addressbookTools.list2Human = function (card) {
var msg = "";
msg += "Name: " + this.getCardProperty(card, "DisplayName") + "\n";
if (this.haveCardProperty(card, "Notes")) {
@@ -2231,17 +2239,17 @@ com.synckolab.addressbookTools.list2Human = function (card) {
* If this is a card, it will use the uri and return the directory
* @return nsiABDirectory
*/
-com.synckolab.addressbookTools.abListObject = function (card) {
+synckolab.addressbookTools.abListObject = function (card) {
// nsiABDirectory has childCards
if (!card.mailListURI) {
return card;
}
- com.synckolab.tools.logMessage("getting list from manager:" + card.mailListURI, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("getting list from manager:" + card.mailListURI, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return Components.classes["@mozilla.org/abmanager;1"].getService(Components.interfaces.nsIAbManager).getDirectory(card.mailListURI);
};
-com.synckolab.addressbookTools.card2Human = function (card) {
+synckolab.addressbookTools.card2Human = function (card) {
var msg = "";
if (this.haveCardProperty(card, "FirstName") || this.haveCardProperty(card, "LastName")) {
@@ -2366,13 +2374,13 @@ com.synckolab.addressbookTools.card2Human = function (card) {
/**
* this returns a quoted encoded vcard
*/
-com.synckolab.addressbookTools.card2Vcard = function (card, fields) {
+synckolab.addressbookTools.card2Vcard = function (card, fields) {
// save the date in microseconds
// Date: Fri, 17 Dec 2004 15:06:42 +0100
var cdate = new Date(this.getCardProperty(card, "LastModifiedDate") * 1000);
var sTime = (cdate.getHours() < 10 ? "0" : "") + cdate.getHours() + ":" + (cdate.getMinutes() < 10 ? "0" : "") + cdate.getMinutes() + ":" + (cdate.getSeconds() < 10 ? "0" : "") + cdate.getSeconds();
- var sdate = "DATE: " + com.synckolab.tools.text.getDayString(cdate.getDay()) + ", " +
- cdate.getDate() + " " + com.synckolab.tools.text.getMonthString(cdate.getMonth()) + " " +
+ var sdate = "DATE: " + synckolab.tools.text.getDayString(cdate.getDay()) + ", " +
+ cdate.getDate() + " " + synckolab.tools.text.getMonthString(cdate.getMonth()) + " " +
cdate.getFullYear() + " " +
sTime + " " + (((cdate.getTimezoneOffset() / 60) < 0) ? "-" : "+") +
(((cdate.getTimezoneOffset() / 60) < 10) ? "0" : "") + cdate.getTimezoneOffset() + "\n";
@@ -2532,34 +2540,34 @@ com.synckolab.addressbookTools.card2Vcard = function (card, fields) {
* @param card nsIAbCard - the adress book card
* @param email String - the email of the current account
* @param format String - the format to use (Xml|VCard)
- * @param fields com.synckolab.database - a hashmap holding all the extra fields not in the card structure
+ * @param fields synckolab.database - a hashmap holding all the extra fields not in the card structure
*/
-com.synckolab.addressbookTools.card2Message = function (card, email, format, fields) {
+synckolab.addressbookTools.card2Message = function (card, email, format, fields) {
// it may be we do not have a uid - skip it then
if (this.getUID(card) === null || this.getUID(card).length < 2) {
return null;
}
- com.synckolab.tools.logMessage("creating message out of card... ", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("creating message out of card... ", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// for the kolab xml format
if (format === "Xml") {
// mailing list
if (card.isMailList) {
- return com.synckolab.tools.generateMail(this.getUID(card), email, "", "application/x-vnd.kolab.contact.distlist", true, com.synckolab.tools.text.utf8.encode(this.list2Xml(card, fields)), this.list2Human(card));
+ return synckolab.tools.generateMail(this.getUID(card), email, "", "application/x-vnd.kolab.contact.distlist", true, synckolab.tools.text.utf8.encode(this.list2Xml(card, fields)), this.list2Human(card));
} else {
- return com.synckolab.tools.generateMail(this.getUID(card), email, "", "application/x-vnd.kolab.contact", true, com.synckolab.tools.text.utf8.encode(this.card2Xml(card, fields)), this.card2Human(card), this.getCardProperty(card, "PhotoName"));
+ return synckolab.tools.generateMail(this.getUID(card), email, "", "application/x-vnd.kolab.contact", true, synckolab.tools.text.utf8.encode(this.card2Xml(card, fields)), this.card2Human(card), this.getCardProperty(card, "PhotoName"));
}
}
if (card.isMailList) {
- return com.synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/x-vcard.list", false, com.synckolab.tools.text.utf8.encode(this.list2Vcard(card, fields)), null);
+ return synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/x-vcard.list", false, synckolab.tools.text.utf8.encode(this.list2Vcard(card, fields)), null);
}
- return com.synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/vcard", false, com.synckolab.tools.text.utf8.encode(this.card2Vcard(card, fields)), null);
+ return synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/vcard", false, synckolab.tools.text.utf8.encode(this.card2Vcard(card, fields)), null);
/*
- return com.synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/vcard",
+ return synckolab.tools.generateMail(this.getUID(card), email, "vCard", "text/vcard",
false, decodeURIComponent(card.translateTo("vcard")), null);
- this works kinda... some fields ar emissing and others are wrong named in order to be compatible with kolab
*/
@@ -2569,7 +2577,7 @@ com.synckolab.addressbookTools.card2Message = function (card, email, format, fie
/*
* Replaces any ; or : with their equivalent char codes since these are reserved characters in vcard spec
*/
-com.synckolab.addressbookTools.encodeCardField = function (fieldValue) {
+synckolab.addressbookTools.encodeCardField = function (fieldValue) {
var safeStr;
safeStr = fieldValue.replace(/\=/g, "=3D");
safeStr = fieldValue.replace(/:/g, "=3A");
@@ -2579,7 +2587,7 @@ com.synckolab.addressbookTools.encodeCardField = function (fieldValue) {
/*
* Decodes a string encoded by encodeCardField
*/
-com.synckolab.addressbookTools.decodeCardField = function (fieldValue) {
+synckolab.addressbookTools.decodeCardField = function (fieldValue) {
var unsafeStr;
unsafeStr = fieldValue.replace(/\=3A/g, ":");
unsafeStr = fieldValue.replace(/\=3D/g, "=");
@@ -2587,7 +2595,7 @@ com.synckolab.addressbookTools.decodeCardField = function (fieldValue) {
};
//Returns an array of fields that are in conflict
-com.synckolab.addressbookTools.contactConflictTest = function (serverCard, localCard) {
+synckolab.addressbookTools.contactConflictTest = function (serverCard, localCard) {
var conflictArray = []; //conflictArray.length
//Fields to look for
diff --git a/src/chrome/content/synckolab/calendar.js b/src/chrome/content/synckolab/calendar.js
index 6335b58..fd1b323 100644
--- a/src/chrome/content/synckolab/calendar.js
+++ b/src/chrome/content/synckolab/calendar.js
@@ -45,12 +45,10 @@
*/
"use strict";
-if (!com)
- var com = {};
-if (!com.synckolab)
- com.synckolab = {};
+if (!synckolab)
+ var synckolab = {};
-com.synckolab.Calendar = {
+synckolab.Calendar = {
gConfig : null, // remember the configuration name
gCurUID : '', // save the last checked uid - for external use
@@ -77,18 +75,18 @@ com.synckolab.Calendar = {
* @param pref a nsIPrefBranch for reading of the configuration
*/
readConfig: function(config, pref) {
- if (!com.synckolab.calendarTools.isCalendarAvailable() || !config.enabled) {
+ if (!synckolab.calendarTools.isCalendarAvailable() || !config.enabled) {
return;
}
// uid -> filename database - main functions needs to know the name
// the current sync database filen (a file with uid:size:date:localfile)
- config.dbFile = com.synckolab.tools.file.getHashDataBaseFile(config);
+ config.dbFile = synckolab.tools.file.getHashDataBaseFile(config);
// get the correct calendar instance
- var calendars = com.synckolab.calendarTools.getCalendars();
+ var calendars = synckolab.calendarTools.getCalendars();
for ( var i = 0; i < calendars.length; i++) {
- if (calendars[i].name === config.source || com.synckolab.tools.text.fixNameToMiniCharset(calendars[i].name) === com.synckolab.tools.text.fixNameToMiniCharset(config.source)) {
+ if (calendars[i].name === config.source || synckolab.tools.text.fixNameToMiniCharset(calendars[i].name) === synckolab.tools.text.fixNameToMiniCharset(config.source)) {
config.calendar = calendars[i];
break;
}
@@ -97,7 +95,7 @@ com.synckolab.Calendar = {
// check if we want to add an observer to this calendar
if(config.calendar && config.syncListener) {
//add an calIObserver http://doxygen.db48x.net/mozilla-full/html/de/d2d/interfacecalIObserver.html
- com.synckolab.calendarTools.registerListener(config.calendar, {
+ synckolab.calendarTools.registerListener(config.calendar, {
onStartBatch: function() {},
onEndBatch: function() {},
onLoad: function() {},
@@ -110,15 +108,15 @@ com.synckolab.Calendar = {
*/
getConfig: function(name, isCal) {
// search through the configs
- for(var j = 0; j < com.synckolab.main.syncConfigs.length; j++) {
- if(com.synckolab.main.syncConfigs[j] &&
- (isCal && com.synckolab.main.syncConfigs[j].type === "calendar") ||
- (!isCal && com.synckolab.main.syncConfigs[j].type === "task")) {
- var curConfig = com.synckolab.main.syncConfigs[j];
- //com.synckolab.tools.logMessage("checking " + curConfig.contact.folderMsgURI + " vs. " + folder, com.synckolab.global.LOG_DEBUG);
+ for(var j = 0; j < synckolab.main.syncConfigs.length; j++) {
+ if(synckolab.main.syncConfigs[j] &&
+ (isCal && synckolab.main.syncConfigs[j].type === "calendar") ||
+ (!isCal && synckolab.main.syncConfigs[j].type === "task")) {
+ var curConfig = synckolab.main.syncConfigs[j];
+ //synckolab.tools.logMessage("checking " + curConfig.contact.folderMsgURI + " vs. " + folder, synckolab.global.LOG_DEBUG);
if(curConfig.enabled && curConfig.syncListener) {
- if(curConfig.source === name || com.synckolab.tools.text.fixNameToMiniCharset(curConfig.source) === com.synckolab.tools.text.fixNameToMiniCharset(name))
+ if(curConfig.source === name || synckolab.tools.text.fixNameToMiniCharset(curConfig.source) === synckolab.tools.text.fixNameToMiniCharset(name))
{
return curConfig;
}
@@ -136,8 +134,8 @@ com.synckolab.Calendar = {
OnStopRunningUrl: function ( url, exitCode )
{
- com.synckolab.tools.logMessage("Finished trigger", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
- com.synckolab.global.triggerRunning = false;
+ synckolab.tools.logMessage("Finished trigger", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
+ synckolab.global.triggerRunning = false;
}
}, msgWindow);
},
@@ -146,18 +144,18 @@ com.synckolab.Calendar = {
*/
onAddItem: function(cur) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
- var cConfig = this.getConfig(cur.calendar.name, com.synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
+ var cConfig = this.getConfig(cur.calendar.name, synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
if(!cConfig) {
return;
}
- com.synckolab.tools.logMessage("Calendar listener: added " + cur.id, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("Calendar listener: added " + cur.id, synckolab.global.LOG_INFO + synckolab.global.LOG_CAL);
- var cEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
+ var cEntry = synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
// skip if we have this one already
if (cEntry.exists() && !this.forceServerCopy) {
@@ -165,19 +163,19 @@ com.synckolab.Calendar = {
}
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cur.id)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cur.id)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
- com.synckolab.tools.logMessage("nextUpdate really writes event:" + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("nextUpdate really writes event:" + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// and now really write the message
var msg = null;
var clonedEvent = cur;
- clonedEvent = com.synckolab.calendarTools.event2json(cur, cConfig.type === "task");
+ clonedEvent = synckolab.calendarTools.event2json(cur, cConfig.type === "task");
if (cConfig.format === "Xml") {
- msg = com.synckolab.calendarTools.event2kolabXmlMsg(clonedEvent, cConfig.email, cConfig.type === "task");
+ msg = synckolab.calendarTools.event2kolabXmlMsg(clonedEvent, cConfig.email, cConfig.type === "task");
} else {
var calComp = Components.classes["@mozilla.org/calendar/ics-service;1"].getService(Components.interfaces.calIICSService).createIcalComponent("VCALENDAR");
calComp.version = "2.0";
@@ -185,30 +183,30 @@ com.synckolab.Calendar = {
calComp.addSubcomponent(cur.icalComponent);
if (cConfig.type === "task") {
- msg = com.synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/todo", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/todo", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
} else {
- msg = com.synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/calendar", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/calendar", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
}
}
- com.synckolab.tools.logMessage("New event:\n" + msg, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("New event:\n" + msg, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// add the new event into the db
- cEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
- com.synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
+ cEntry = synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
+ synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
- com.synckolab.tools.logMessage("Writing entry to imap" , com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Writing entry to imap" , synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
var listener = this;
- com.synckolab.main.writeImapMessage(msg, cConfig,
+ synckolab.main.writeImapMessage(msg, cConfig,
{
OnProgress: function (progress, progressMax) {},
OnStartCopy: function () { },
SetMessageKey: function (key) {},
OnStopCopy: function (status) {
// update folder information from imap and make sure we got everything
- com.synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
listener.finishMsgfolderChange(cConfig.folder);
}
});
@@ -219,20 +217,20 @@ com.synckolab.Calendar = {
*/
onModifyItem: function(cur, aOldItem) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
- var cConfig = this.getConfig(cur.calendar.name, com.synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
+ var cConfig = this.getConfig(cur.calendar.name, synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
if(!cConfig) {
return;
}
- com.synckolab.tools.logMessage("Calendar listener: modified " + aOldItem.id + " with " + cur.id, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("Calendar listener: modified " + aOldItem.id + " with " + cur.id, synckolab.global.LOG_INFO + synckolab.global.LOG_CAL);
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cur.id)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cur.id)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
@@ -241,10 +239,10 @@ com.synckolab.Calendar = {
// and now really write the message
var msg = null;
var clonedEvent = cur;
- clonedEvent = com.synckolab.calendarTools.event2json(cur, cConfig.type === "task");
+ clonedEvent = synckolab.calendarTools.event2json(cur, cConfig.type === "task");
if (cConfig.format === "Xml") {
- msg = com.synckolab.calendarTools.event2kolabXmlMsg(clonedEvent, cConfig.email, cConfig.type === "task");
+ msg = synckolab.calendarTools.event2kolabXmlMsg(clonedEvent, cConfig.email, cConfig.type === "task");
} else {
var calComp = Components.classes["@mozilla.org/calendar/ics-service;1"].getService(Components.interfaces.calIICSService).createIcalComponent("VCALENDAR");
calComp.version = "2.0";
@@ -252,9 +250,9 @@ com.synckolab.Calendar = {
calComp.addSubcomponent(cur.icalComponent);
if (cConfig.type === "task") {
- msg = com.synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/todo", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/todo", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
} else {
- msg = com.synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/calendar", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, cConfig.email, "iCal", "text/calendar", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
}
}
@@ -264,10 +262,10 @@ com.synckolab.Calendar = {
// finally update imap
// find the correct message to the given uid
if(cConfig.msgList.length() === 0) {
- com.synckolab.tools.fillMessageLookup(cConfig.msgList, config, com.synckolab.addressbookTools.parseMessageContent);
+ synckolab.tools.fillMessageLookup(cConfig.msgList, config, synckolab.addressbookTools.parseMessageContent);
}
- var cEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
+ var cEntry = synckolab.tools.file.getSyncDbFile(cConfig, cur.id);
// get and delete the message
var cmsg = cConfig.msgList.get(cUID);
@@ -275,28 +273,28 @@ com.synckolab.Calendar = {
var list = null;
// use mutablearray
list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
- com.synckolab.tools.logMessage("deleting [" + cUID + "]");
+ synckolab.tools.logMessage("deleting [" + cUID + "]");
list.appendElement(cmsg, false);
cConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
cEntry.remove(false);
}
- com.synckolab.tools.logMessage("New event:\n" + msg, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("New event:\n" + msg, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// add the new event into the db
- com.synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
+ synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
- com.synckolab.tools.logMessage("Writing entry to imap" , com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
- com.synckolab.global.triggerRunning = true;
+ synckolab.tools.logMessage("Writing entry to imap" , synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
+ synckolab.global.triggerRunning = true;
var listener = this;
- com.synckolab.main.writeImapMessage(msg, cConfig,
+ synckolab.main.writeImapMessage(msg, cConfig,
{
OnProgress: function (progress, progressMax) {},
OnStartCopy: function () { },
SetMessageKey: function (key) {},
OnStopCopy: function (status) {
// update folder information from imap and make sure we got everything
- com.synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("Finished writing contact entry to imap - compacting", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
listener.finishMsgfolderChange(cConfig.folder);
}
});
@@ -306,30 +304,30 @@ com.synckolab.Calendar = {
*/
onDeleteItem: function(cur) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
- var cConfig = this.getConfig(cur.calendar.name, com.synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
+ var cConfig = this.getConfig(cur.calendar.name, synckolab.tools.instanceOf(cur, Components.interfaces.calIEvent));
if(!cConfig) {
return;
}
var cUID = cur.id;
- com.synckolab.tools.logMessage("Calendar listener: deleted " + cur.id, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("Calendar listener: deleted " + cur.id, synckolab.global.LOG_INFO + synckolab.global.LOG_CAL);
// remember that we just worked with this one
- if(com.synckolab.config.checkIdProcessed(cConfig, cur.id)) {
- com.synckolab.tools.logMessage("skipping because recently processed", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ if(synckolab.config.checkIdProcessed(cConfig, cur.id)) {
+ synckolab.tools.logMessage("skipping because recently processed", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
return;
}
// find the correct message to the given uid
if(cConfig.msgList.length() === 0) {
- com.synckolab.tools.fillMessageLookup(cConfig.msgList, config, com.synckolab.addressbookTools.parseMessageContent);
+ synckolab.tools.fillMessageLookup(cConfig.msgList, config, synckolab.addressbookTools.parseMessageContent);
}
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
// remember that we just added this one
cConfig.recentProcessed.push(cur.id);
@@ -340,12 +338,12 @@ com.synckolab.Calendar = {
var list = null;
// use mutablearray
list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
- com.synckolab.tools.logMessage("deleting [" + cUID + "]");
+ synckolab.tools.logMessage("deleting [" + cUID + "]");
list.appendElement(msg, false);
cConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
// also remove sync db file
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(cConfig, cUID);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(cConfig, cUID);
idxEntry.remove(false);
}
@@ -363,9 +361,9 @@ com.synckolab.Calendar = {
*/
init : function (config, itemList, document) {
// package shortcuts:
- com.synckolab.global = com.synckolab.global;
- this.tools = com.synckolab.tools;
- this.calTools = com.synckolab.calendarTools;
+ synckolab.global = synckolab.global;
+ this.tools = synckolab.tools;
+ this.calTools = synckolab.calendarTools;
// ui stuff
this.itemList = itemList;
@@ -375,7 +373,7 @@ com.synckolab.Calendar = {
// clean out recently processed - we are in manual mode
this.gConfig.recentProcessed = [];
- com.synckolab.tools.logMessage("Initialising calendar config: " + this.gConfig.name, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Initialising calendar config: " + this.gConfig.name, synckolab.global.LOG_INFO);
this.forceServerCopy = false;
this.forceLocalCopy = false;
@@ -383,7 +381,7 @@ com.synckolab.Calendar = {
this.folderMessageUids = []; // the checked uids - for better sync
// remember all the items we already worked with
- this.gCalDB = new com.synckolab.hashMap();
+ this.gCalDB = new synckolab.hashMap();
// make sure its up-to date: call refresh
this.gConfig.calendar.refresh();
@@ -391,7 +389,7 @@ com.synckolab.Calendar = {
init2 : function (nextFunc, sync) {
- com.synckolab.tools.logMessage("Init2 for " + this.gConfig.type, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Init2 for " + this.gConfig.type, synckolab.global.LOG_DEBUG);
// get ALL the items from calendar - when done call nextfunc
this.gEvents.nextFunc = nextFunc;
this.gEvents.events = [];
@@ -424,14 +422,14 @@ com.synckolab.Calendar = {
sync : '',
ready : false,
onOperationComplete : function (aCalendar, aStatus, aOperator, aId, aDetail) {
- com.synckolab.tools.logMessage("operation " + com.synckolab.Calendar.gConfig.type + ": status=" + aStatus + " Op=" + aOperator + " Detail=" + aDetail, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("operation " + synckolab.Calendar.gConfig.type + ": status=" + aStatus + " Op=" + aOperator + " Detail=" + aDetail, synckolab.global.LOG_DEBUG + synckolab.global.LOG_CAL);
if (aStatus === 2152333316) {
- com.synckolab.tools.logMessage(com.synckolab.Calendar.gConfig.type + ": duplicate id - for additem", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage(synckolab.Calendar.gConfig.type + ": duplicate id - for additem", synckolab.global.LOG_INFO + synckolab.global.LOG_CAL);
}
this.ready = true;
},
onGetResult : function (aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
- com.synckolab.tools.logMessage("got results: " + aCount + " items", com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("got results: " + aCount + " items", synckolab.global.LOG_DEBUG + synckolab.global.LOG_CAL);
for ( var i = 0; i < aCount; i++) {
this.events.push(aItems[i]);
}
@@ -443,25 +441,25 @@ com.synckolab.Calendar = {
*/
triggerParseAddMessage: function(message) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
// parse the content
- var newEvent = com.synckolab.calendarTools.message2json(message.fileContent, message.config.type === "task");
+ var newEvent = synckolab.calendarTools.message2json(message.fileContent, message.config.type === "task");
// get the dbfile from the local disk
var cUid = newEvent.uid;
- var cEntry = com.synckolab.tools.file.getSyncDbFile(message.config, cUid);
+ var cEntry = synckolab.tools.file.getSyncDbFile(message.config, cUid);
// write the pojo into a file for faster comparison in later sync
- com.synckolab.tools.writeSyncDBFile(cEntry, newEvent);
+ synckolab.tools.writeSyncDBFile(cEntry, newEvent);
- com.synckolab.tools.logMessage("event is new, add to calendar: " + cUid, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("event is new, add to calendar: " + cUid, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// add the new event
try {
- var tmpEventObj = com.synckolab.calendarTools.json2event(newEvent, message.config.calendar);
+ var tmpEventObj = synckolab.calendarTools.json2event(newEvent, message.config.calendar);
// update the newEvent timestamp so it wont display a window
var lastAckTime = Components.classes["@mozilla.org/calendar/datetime;1"].createInstance(Components.interfaces.calIDateTime);
lastAckTime.jsDate = new Date();
@@ -476,9 +474,9 @@ com.synckolab.Calendar = {
message.config.calendar.addItem(tmpEventObj, null);
message.config.calendar.refresh();
- com.synckolab.tools.logMessage("added locally:" + cUid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("added locally:" + cUid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
} catch (addEx) {
- com.synckolab.tools.logMessage("unable to add item:" + cUid + "\n" + addEx, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERR);
+ synckolab.tools.logMessage("unable to add item:" + cUid + "\n" + addEx, synckolab.global.LOG_CAL + synckolab.global.LOG_ERR);
}
},
@@ -487,20 +485,20 @@ com.synckolab.Calendar = {
*/
triggerParseDeleteMessage: function(message) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
- var messageFields = new com.synckolab.dataBase();
+ var messageFields = new synckolab.dataBase();
// parse the content
- var newEvent = com.synckolab.calendarTools.message2json(message.fileContent, message.config.type === "task");
+ var newEvent = synckolab.calendarTools.message2json(message.fileContent, message.config.type === "task");
// remember current uid
var cUID = newEvent.uid;
// get the dbfile from the local disk
- var cEntry = com.synckolab.tools.file.getSyncDbFile(message.config, cUID);
+ var cEntry = synckolab.tools.file.getSyncDbFile(message.config, cUID);
// this might actually be a duplicate clean - make sure no second message with that uid exists
var filter = 0;
@@ -516,13 +514,13 @@ com.synckolab.Calendar = {
eventId: cUID,
calObj: message.config.calendar,
onOperationComplete : function (aCalendar, aStatus, aOperator, aId, aDetail) {
- com.synckolab.tools.logMessage("operation " + com.synckolab.Calendar.gConfig.type + ": status=" + aStatus + " Op=" + aOperator + " Detail=" + aDetail, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("operation " + synckolab.Calendar.gConfig.type + ": status=" + aStatus + " Op=" + aOperator + " Detail=" + aDetail, synckolab.global.LOG_DEBUG + synckolab.global.LOG_CAL);
if (aStatus === 2152333316) {
- com.synckolab.tools.logMessage(com.synckolab.Calendar.gConfig.type + ": duplicate id - for additem", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage(synckolab.Calendar.gConfig.type + ": duplicate id - for additem", synckolab.global.LOG_INFO + synckolab.global.LOG_CAL);
}
},
onGetResult : function (aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
- com.synckolab.tools.logMessage("got results: " + aCount + " items - looking for "+ this.eventId, com.synckolab.global.LOG_DEBUG + com.synckolab.global.LOG_CAL);
+ synckolab.tools.logMessage("got results: " + aCount + " items - looking for "+ this.eventId, synckolab.global.LOG_DEBUG + synckolab.global.LOG_CAL);
var workItem;
for ( var i = 0; i < aCount; i++) {
if(aItems[i].id === this.eventId) {
@@ -557,9 +555,9 @@ com.synckolab.Calendar = {
for ( var i = 0; i < this.gEvents.events.length; i++) {
this.gCalDB.put(this.gEvents.events[i].id, this.gEvents.events[i]);
}
- com.synckolab.tools.logMessage("Indexed " + this.gCalDB.length() + " Entries", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Indexed " + this.gCalDB.length() + " Entries", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
- com.synckolab.tools.logMessage("Getting items for " + this.gConfig.type, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Getting items for " + this.gConfig.type, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
return true;
},
@@ -582,9 +580,9 @@ com.synckolab.Calendar = {
this.curItemInListId = this.doc.createElement("treecell");
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
- this.curItemInListId.setAttribute("label", com.synckolab.global.strBundle.getString("unknown"));
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("parsing"));
- this.curItemInListContent.setAttribute("label", com.synckolab.global.strBundle.getString("unknown"));
+ this.curItemInListId.setAttribute("label", synckolab.global.strBundle.getString("unknown"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("parsing"));
+ this.curItemInListContent.setAttribute("label", synckolab.global.strBundle.getString("unknown"));
this.curItemInList.appendChild(this.curItemInListId);
this.curItemInList.appendChild(this.curItemInListStatus);
@@ -595,7 +593,7 @@ com.synckolab.Calendar = {
var curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
// parse the content
@@ -603,11 +601,11 @@ com.synckolab.Calendar = {
// if we didnt get a valid event (emtpy or without uid) - skip
if (newEvent === null || !newEvent.uid) {
- this.curItemInListId.setAttribute("label", com.synckolab.global.strBundle.getString("unparseable"));
+ this.curItemInListId.setAttribute("label", synckolab.global.strBundle.getString("unparseable"));
return null;
}
- com.synckolab.tools.logMessage("parsed event (message2Event) \n" + newEvent.toSource(), com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("parsed event (message2Event) \n" + newEvent.toSource(), synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
var tmpEventObj;
@@ -616,7 +614,7 @@ com.synckolab.Calendar = {
// update list item
this.curItemInListId.setAttribute("label", newEvent.uid);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("checking"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("checking"));
var info = newEvent.title;
var i;
var msg;
@@ -631,8 +629,8 @@ com.synckolab.Calendar = {
// check for duplicate events
for (i = 0; i < this.folderMessageUids.length; i++) {
if (newEvent.uid === this.folderMessageUids[i]) {
- com.synckolab.tools.logMessage("event is is already parsed.. deleting duplicate: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("deleteOnServer"));
+ synckolab.tools.logMessage("event is is already parsed.. deleting duplicate: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("deleteOnServer"));
return "DELETEME";
}
}
@@ -641,26 +639,26 @@ com.synckolab.Calendar = {
this.folderMessageUids.push(newEvent.uid);
// get event from calendar based on the uid - and convert to json
- foundEvent = com.synckolab.calendarTools.event2json(this.calTools.findEvent(this.gCalDB, newEvent.uid), this.gConfig.type === "task");
+ foundEvent = synckolab.calendarTools.event2json(this.calTools.findEvent(this.gCalDB, newEvent.uid), this.gConfig.type === "task");
- com.synckolab.tools.logMessage("findevent returned :" + foundEvent + "(" + (foundEvent === null ? 'null' : foundEvent.uid) + ") for " + newEvent.uid + " caching " + this.gCalDB.length() + " events", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("findevent returned :" + foundEvent + "(" + (foundEvent === null ? 'null' : foundEvent.uid) + ") for " + newEvent.uid + " caching " + this.gCalDB.length() + " events", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// get the dbfile from the local disk
- var idxEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, newEvent.uid);
+ var idxEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, newEvent.uid);
- com.synckolab.tools.logMessage("idxEntry:" + idxEntry, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("idxEntry:" + idxEntry, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// always add if the forceLocalCopy flag is set (happens when you change the configuration)
if (foundEvent === null || this.forceLocalCopy) {
// a new event
- com.synckolab.tools.logMessage("a new event, locally unknown:" + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("a new event, locally unknown:" + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
if (!idxEntry.exists() || !this.calTools.allowSyncEvent(foundEvent, newEvent, this)) {
// write the pojo into a file for faster comparison in later sync
- com.synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
+ synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localAdd"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localAdd"));
- tmpEventObj = com.synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
+ tmpEventObj = synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
// update the newEvent timestamp so it wont display a window
var lastAckTime = Components.classes["@mozilla.org/calendar/datetime;1"].createInstance(Components.interfaces.calIDateTime);
@@ -676,20 +674,20 @@ com.synckolab.Calendar = {
// add the new event
try {
- com.synckolab.tools.logMessage("adding obj with startdate:" + tmpEventObj.startDate, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("adding obj with startdate:" + tmpEventObj.startDate, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
this.gConfig.calendar.addItem(tmpEventObj, this.gEvents);
// also add to the hash-database
this.gCalDB.put(newEvent.uid, newEvent);
- com.synckolab.tools.logMessage("added locally:" + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("added locally:" + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
} catch (addEx) {
- com.synckolab.tools.logMessage("unable to add item:" + newEvent.uid + "\n" + addEx, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERR);
+ synckolab.tools.logMessage("unable to add item:" + newEvent.uid + "\n" + addEx, synckolab.global.LOG_CAL + synckolab.global.LOG_ERR);
this.curItemInListStatus.setAttribute("label", "ERROR");
}
} else {
// now this should be deleted, since it was in the db already
- com.synckolab.tools.logMessage("Delete event on server and in db: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("deleteOnServer"));
+ synckolab.tools.logMessage("Delete event on server and in db: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("deleteOnServer"));
// also remove the local db file since we deleted the contact
if (idxEntry.exists()) {
@@ -700,50 +698,50 @@ com.synckolab.Calendar = {
}
} else {
// event exists in local calendar
- com.synckolab.tools.logMessage("Event exists local: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Event exists local: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
- var cEvent = com.synckolab.tools.readSyncDBFile(idxEntry);
+ var cEvent = synckolab.tools.readSyncDBFile(idxEntry);
var cEvent_equals_foundEvent, cEvent_equals_newEvent, foundEvent_equals_newEvent;
if(cEvent === null) {
- com.synckolab.tools.logMessage("cEvent is null!", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("cEvent is null!", synckolab.global.LOG_DEBUG);
}
if(foundEvent === null) {
- com.synckolab.tools.logMessage("foundEvent is null!", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("foundEvent is null!", synckolab.global.LOG_DEBUG);
}
if(newEvent === null) {
- com.synckolab.tools.logMessage("newEvent is null!", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("newEvent is null!", synckolab.global.LOG_DEBUG);
}
// Streamline card comparisons
- if (com.synckolab.calendarTools.equalsEvent(cEvent, foundEvent)) {
+ if (synckolab.calendarTools.equalsEvent(cEvent, foundEvent)) {
cEvent_equals_foundEvent = true;
- com.synckolab.tools.logMessage("In parse Message cEvent equals foundEvent", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message cEvent equals foundEvent", synckolab.global.LOG_DEBUG);
} else {
cEvent_equals_foundEvent = false;
- com.synckolab.tools.logMessage("In parse Message cEvent DOES NOT EQUALS foundEvent\n ", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message cEvent DOES NOT EQUALS foundEvent\n ", synckolab.global.LOG_DEBUG);
}
- if (com.synckolab.calendarTools.equalsEvent(cEvent, newEvent)) {
+ if (synckolab.calendarTools.equalsEvent(cEvent, newEvent)) {
cEvent_equals_newEvent = true;
- com.synckolab.tools.logMessage("In parse Message cEvent equals newEvent", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message cEvent equals newEvent", synckolab.global.LOG_DEBUG);
} else {
cEvent_equals_newEvent = false;
- com.synckolab.tools.logMessage("In parse Message cEvent DOES NOT equal newEvent", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message cEvent DOES NOT equal newEvent", synckolab.global.LOG_DEBUG);
}
- if (com.synckolab.calendarTools.equalsEvent(foundEvent, newEvent)) {
+ if (synckolab.calendarTools.equalsEvent(foundEvent, newEvent)) {
foundEvent_equals_newEvent = true;
- com.synckolab.tools.logMessage("In parse Message foundEvent equals newEvent", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message foundEvent equals newEvent", synckolab.global.LOG_DEBUG);
} else {
foundEvent_equals_newEvent = false;
- com.synckolab.tools.logMessage("In parse Message foundEvent DOES NOT equal newEvent", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message foundEvent DOES NOT equal newEvent", synckolab.global.LOG_DEBUG);
}
// change for conflict
if ((idxEntry.exists() && !cEvent_equals_foundEvent && !cEvent_equals_newEvent) || (!idxEntry.exists() && !foundEvent_equals_newEvent))
{
// changed locally and on server side
- com.synckolab.tools.logMessage("Changed on server and local: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Changed on server and local: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
//Holds the users response, must be an object so that we can pass by reference
var conflictResolution = {};
@@ -756,7 +754,7 @@ com.synckolab.Calendar = {
conflictResolution.result = 2;
} else
// display a dialog asking for whats going on
- if (window.confirm(com.synckolab.global.strBundle.getFormattedString("calConflictUseServer", [ foundEvent.title, foundEvent.uid, newEvent.title, newEvent.uid ]))) {
+ if (window.confirm(synckolab.global.strBundle.getFormattedString("calConflictUseServer", [ foundEvent.title, foundEvent.uid, newEvent.title, newEvent.uid ]))) {
conflictResolution.result = 1;
} else {
conflictResolution.result = 2;
@@ -764,13 +762,13 @@ com.synckolab.Calendar = {
if (conflictResolution.result === 1) {
// take event from server
- com.synckolab.tools.logMessage("Take event from server: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Take event from server: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
- com.synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
+ synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
for (i = 0; i < this.gEvents.events.length; i++) {
if (this.gEvents.events[i].id === newEvent.uid) {
- tmpEventObj = com.synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
+ tmpEventObj = synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
// set the calendar
tmpEventObj.calendar = this.gConfig.calendar;
@@ -784,17 +782,17 @@ com.synckolab.Calendar = {
// because they will break the sync process
this.gConfig.calendar.modifyItem(tmpEventObj, this.gEvents.events[i], this.gEvents);
} catch (e) {
- com.synckolab.tools.logMessage("gCalendar.modifyItem() failed: " + e, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("gCalendar.modifyItem() failed: " + e, synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
}
//update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localUpdate"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localUpdate"));
return null;
}
}
} else {
// local change to server
- com.synckolab.tools.logMessage("put event on server: " + newEvent.uid, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("put event on server: " + newEvent.uid, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
// first check privacy info
//foundEvent = this.calTools.checkEventOnDeletion(foundEvent, newEvent, this);
@@ -807,7 +805,7 @@ com.synckolab.Calendar = {
if (this.gConfig.format === "Xml") {
msg = this.calTools.event2kolabXmlMsg(foundEvent, this.gConfig.email, this.gConfig.type === "task");
} else {
- tmpEventObj = com.synckolab.calendarTools.json2event(newEvent);
+ tmpEventObj = synckolab.calendarTools.json2event(newEvent);
calComp = Components.classes["@mozilla.org/calendar/ics-service;1"].getService(Components.interfaces.calIICSService).createIcalComponent("VCALENDAR");
calComp.version = "2.0";
@@ -815,16 +813,16 @@ com.synckolab.Calendar = {
calComp.addSubcomponent(tmpEventObj.icalComponent);
if (this.gConfig.type === "task") {
- msg = com.synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/todo", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/todo", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
} else {
- msg = com.synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/calendar", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/calendar", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
}
}
- com.synckolab.tools.writeSyncDBFile(idxEntry, foundEvent);
+ synckolab.tools.writeSyncDBFile(idxEntry, foundEvent);
// update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("updateOnServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("updateOnServer"));
// remember this message for update
return msg;
@@ -834,69 +832,69 @@ com.synckolab.Calendar = {
if (!idxEntry.exists() || (cEvent_equals_foundEvent && !cEvent_equals_newEvent))
{
if (!idxEntry.exists()) {
- com.synckolab.tools.logMessage("In parse Message idxEntry does not exist", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In parse Message idxEntry does not exist", synckolab.global.LOG_DEBUG);
}
if(foundEvent_equals_newEvent){
- com.synckolab.tools.logMessage("no change, but sync file missing: " + foundEvent.uid, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("no change, but sync file missing: " + foundEvent.uid, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
} else {
- com.synckolab.tools.logMessage("server changed: " + foundEvent.uid, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("server changed: " + foundEvent.uid, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
}
// server changed - update local
for (i = 0; i < this.gEvents.events.length; i++) {
if (this.gEvents.events[i].id === newEvent.uid) {
- tmpEventObj = com.synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
+ tmpEventObj = synckolab.calendarTools.json2event(newEvent, this.gConfig.calendar);
// if we change a local event make sure to set alarmLastAck
if (this.gEvents.events[i].alarmLastAck) {
tmpEventObj.alarmLastAck = this.gEvents.events[i].alarmLastAck.clone();
}
- com.synckolab.tools.logMessage("start modify item", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("start modify item", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
try {
// modify the item - catch exceptions due to triggered alarms
// because they will break the sync process
this.gConfig.calendar.modifyItem(tmpEventObj, this.gEvents.events[i], this.gEvents);
} catch (e1) {
- com.synckolab.tools.logMessage("gCalendar.modifyItem() failed: " + e1, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("gCalendar.modifyItem() failed: " + e1, synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
}
- com.synckolab.tools.logMessage("event modified", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("event modified", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
break;
}
}
- com.synckolab.tools.logMessage("write sync db " + foundEvent.uid, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("write sync db " + foundEvent.uid, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
+ synckolab.tools.writeSyncDBFile(idxEntry, newEvent);
// update list item
if(foundEvent_equals_newEvent){
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("noChange"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("noChange"));
}
else {
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localUpdate"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localUpdate"));
}
return null;
}
// is the db file equals server, but not local.. we got a local change
else if (idxEntry.exists() && !cEvent_equals_foundEvent && cEvent_equals_newEvent)
{
- com.synckolab.tools.logMessage("client changed " + foundEvent.uid + " - " + cEvent.primaryEmail, com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("client changed " + foundEvent.uid + " - " + cEvent.primaryEmail, synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
// update list item
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("updateOnServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("updateOnServer"));
// remember this message for update - generate mail message (incl. extra fields)
msg = null;
if (this.gConfig.format === "Xml") {
msg = this.calTools.event2kolabXmlMsg(foundEvent, this.gConfig.email, this.gConfig.type === "task");
} else {
- tmpEventObj = com.synckolab.calendarTools.json2event(foundEvent);
+ tmpEventObj = synckolab.calendarTools.json2event(foundEvent);
calComp = Components.classes["@mozilla.org/calendar/ics-service;1"].getService(Components.interfaces.calIICSService).createIcalComponent("VCALENDAR");
calComp.version = "2.0";
@@ -904,19 +902,19 @@ com.synckolab.Calendar = {
calComp.addSubcomponent(tmpEventObj.icalComponent);
if (this.gConfig.type === "task") {
- msg = com.synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/todo", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/todo", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
} else {
- msg = com.synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/calendar", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(newEvent.uid, this.gConfig.email, "iCal", "text/calendar", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
}
}
// write the current content in the sync-db file
- com.synckolab.tools.writeSyncDBFile(idxEntry, foundEvent);
+ synckolab.tools.writeSyncDBFile(idxEntry, foundEvent);
return msg;
}
else {
- com.synckolab.tools.logMessage("events are equals", com.synckolab.global.LOG_INFO + com.synckolab.global.LOG_AB);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("noChange"));
+ synckolab.tools.logMessage("events are equals", synckolab.global.LOG_INFO + synckolab.global.LOG_AB);
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("noChange"));
}
}
@@ -934,14 +932,14 @@ com.synckolab.Calendar = {
* @return "done" to specify that the sync is finished
*/
nextUpdate : function () {
- com.synckolab.tools.logMessage("next update...", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("next update...", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// if there happens an exception, we are done
if ((this.gEvents === null || this.gCurEvent >= this.gEvents.events.length)) {
- com.synckolab.tools.logMessage("done update...", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("done update...", synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
// we are done
return "done";
}
- com.synckolab.tools.logMessage("get event ( " + this.gCurEvent + " of " + this.gEvents.events.length + ")", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("get event ( " + this.gCurEvent + " of " + this.gEvents.events.length + ")", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
var msg = null;
var cEntry;
@@ -950,10 +948,10 @@ com.synckolab.Calendar = {
var writeCur = true;
msg = null;
- com.synckolab.tools.logMessage("nextUpdate for " + (this.gConfig.type === "task" ? "task" : "event") + ":" + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("nextUpdate for " + (this.gConfig.type === "task" ? "task" : "event") + ":" + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
if (cur.id === null) {
- com.synckolab.tools.logMessage("no id found for this element! skipping.", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("no id found for this element! skipping.", synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
return null;
}
@@ -961,23 +959,23 @@ com.synckolab.Calendar = {
var endDate = this.calTools.getEndDate(cur, this.gConfig.type === "task");
if (endDate && this.gConfig.timeFrame > 0 && (endDate.getTime() + (this.gConfig.timeFrame * 86400000) < (new Date()).getTime())) {
- com.synckolab.tools.logMessage("skipping event because its too old: " + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("skipping event because its too old: " + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
return null;
}
/* skip if event is PRIVATE */
if (this.calTools.isPrivateEvent(cur)) {
- com.synckolab.tools.logMessage("skipping event because it is marked as PRIVATE: " + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("skipping event because it is marked as PRIVATE: " + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
return null;
}
- com.synckolab.tools.logMessage("processing event", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("processing event", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// check if we have this uid in the messages, skip it if it
// has been processed already when reading the IMAP msgs
for ( var i = 0; i < this.folderMessageUids.length; i++) {
if (cur.id === this.folderMessageUids[i]) {
- com.synckolab.tools.logMessage("event is known from IMAP lookup: " + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("event is known from IMAP lookup: " + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
writeCur = false;
break;
}
@@ -989,13 +987,13 @@ com.synckolab.Calendar = {
if (writeCur) {
var curListItem;
- com.synckolab.tools.logMessage("nextUpdate decided to write event:" + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("nextUpdate decided to write event:" + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
- cEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, cur.id);
+ cEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, cur.id);
if (cEntry.exists() && !this.forceServerCopy) {
// we have it in our database - don't write back to server but delete locally
- com.synckolab.tools.logMessage("nextUpdate assumes 'delete on server', better don't write event:" + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("nextUpdate assumes 'delete on server', better don't write event:" + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
writeCur = false;
this.gConfig.calendar.deleteItem(cur, this.gEvents);
@@ -1011,7 +1009,7 @@ com.synckolab.Calendar = {
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
this.curItemInListId.setAttribute("label", cur.id);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localDelete"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localDelete"));
this.curItemInListContent.setAttribute("label", cur.title);
this.curItemInList.appendChild(this.curItemInListId);
@@ -1023,7 +1021,7 @@ com.synckolab.Calendar = {
curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
} else {
@@ -1033,7 +1031,7 @@ com.synckolab.Calendar = {
this.curItemInListStatus = this.doc.createElement("treecell");
this.curItemInListContent = this.doc.createElement("treecell");
this.curItemInListId.setAttribute("label", cur.id);
- this.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("addToServer"));
+ this.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("addToServer"));
this.curItemInListContent.setAttribute("label", cur.title);
this.curItemInList.appendChild(this.curItemInListId);
@@ -1045,13 +1043,13 @@ com.synckolab.Calendar = {
curListItem = this.doc.createElement("treeitem");
curListItem.appendChild(this.curItemInList);
this.itemList.appendChild(curListItem);
- com.synckolab.tools.scrollToBottom(this.itemList);
+ synckolab.tools.scrollToBottom(this.itemList);
}
}
}
if (writeCur) {
- com.synckolab.tools.logMessage("nextUpdate really writes event:" + cur.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("nextUpdate really writes event:" + cur.id, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// and now really write the message
msg = null;
var clonedEvent = cur;
@@ -1066,17 +1064,17 @@ com.synckolab.Calendar = {
calComp.addSubcomponent(cur.icalComponent);
if (this.gConfig.type === "task") {
- msg = com.synckolab.tools.generateMail(cur.id, this.gConfig.email, "iCal", "text/todo", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, this.gConfig.email, "iCal", "text/todo", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
} else {
- msg = com.synckolab.tools.generateMail(cur.id, this.gConfig.email, "iCal", "text/calendar", false, com.synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
+ msg = synckolab.tools.generateMail(cur.id, this.gConfig.email, "iCal", "text/calendar", false, synckolab.tools.text.quoted.encode(calComp.serializeToICS()), null);
}
}
- com.synckolab.tools.logMessage("New event:\n" + msg, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("New event:\n" + msg, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// add the new event into the db
- cEntry = com.synckolab.tools.file.getSyncDbFile(this.gConfig, cur.id);
- com.synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
+ cEntry = synckolab.tools.file.getSyncDbFile(this.gConfig, cur.id);
+ synckolab.tools.writeSyncDBFile(cEntry, clonedEvent);
}
}
diff --git a/src/chrome/content/synckolab/calendarTools.js b/src/chrome/content/synckolab/calendarTools.js
index 2162c1a..ba660da 100644
--- a/src/chrome/content/synckolab/calendarTools.js
+++ b/src/chrome/content/synckolab/calendarTools.js
@@ -38,12 +38,11 @@ try {
// ignore exception if lightning is not installed
}
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
/* ----- general functions to access calendar and events ----- */
-com.synckolab.calendarTools = {
+synckolab.calendarTools = {
activeCalendarManager: null,
// make sure the listener is only registered ONCE
@@ -88,7 +87,7 @@ com.synckolab.calendarTools = {
return syncCalManager.getCalendars({});
}
catch (e) {
- com.synckolab.tools.logMessage("Error getting calendars: " + e, com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Error getting calendars: " + e, synckolab.global.LOG_ERROR);
return null;
}
},
@@ -97,9 +96,9 @@ com.synckolab.calendarTools = {
* add a listener to a calendar. This makes sure a listener is not double-added.
*/
registerListener: function(calendar, listener) {
- if(listener && !com.synckolab.calendarTools.listenerRegistered[calendar.id]) {
+ if(listener && !synckolab.calendarTools.listenerRegistered[calendar.id]) {
calendar.addObserver(listener);
- com.synckolab.calendarTools.listenerRegistered[calendar.id] = true;
+ synckolab.calendarTools.listenerRegistered[calendar.id] = true;
}
},
@@ -146,7 +145,7 @@ com.synckolab.calendarTools = {
* This is taken from the lightning extension (calendar-event-dialog.js#938ff setItemProperty)
*/
setKolabItemProperty: function (item, propertyName, value) {
- //com.synckolab.tools.logMessage("setting property: " + propertyName + " with value " + value, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ //synckolab.tools.logMessage("setting property: " + propertyName + " with value " + value, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
try
{
switch(propertyName) {
@@ -172,7 +171,7 @@ com.synckolab.calendarTools = {
item.isCompleted = value;
break;
case "status":
- item.status = com.synckolab.calendarTools.getTaskStatus(value,false);
+ item.status = synckolab.calendarTools.getTaskStatus(value,false);
break;
case "title":
item.title = value;
@@ -203,7 +202,7 @@ com.synckolab.calendarTools = {
}
}
catch (ex){
- com.synckolab.tools.logMessage("unable to set property: " + propertyName + " with value " + value, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("unable to set property: " + propertyName + " with value " + value, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
}
},
@@ -266,7 +265,7 @@ com.synckolab.calendarTools = {
rorgmail = revent.organizer.mail;
}
var org2mail = (config.email === rorgmail);
- com.synckolab.tools.logMessage("allowSyncEvent: " + org2mail + ":" + lpublic + ":" + rpublic, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG );
+ synckolab.tools.logMessage("allowSyncEvent: " + org2mail + ":" + lpublic + ":" + rpublic, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG );
return org2mail;
},
@@ -276,8 +275,8 @@ com.synckolab.calendarTools = {
checkEventBeforeSync: function (fevent, revent, lsyncCalendar) {
var rc = this.allowSyncEvent(fevent, revent, lsyncCalendar);
if (!rc) {
- com.synckolab.tools.logMessage("Update local event with server one : " + revent.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG );
- lsyncCalendar.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("localUpdate"));
+ synckolab.tools.logMessage("Update local event with server one : " + revent.id, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG );
+ lsyncCalendar.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("localUpdate"));
lsyncCalendar.gConfig.calendar.modifyItem(revent, fevent, lsyncCalendar.gEvents);
}
return rc;
@@ -299,11 +298,11 @@ com.synckolab.calendarTools = {
if (!this.checkEventServerDeletion(fevent, pevent, lsyncCalendar)) {
return false;
}
- var eventry = com.synckolab.tools.file.getSyncDbFile(lsyncCalendar.gConfig, fevent.id);
+ var eventry = synckolab.tools.file.getSyncDbFile(lsyncCalendar.gConfig, fevent.id);
if (eventry.exists()) {
eventry.remove(false);
}
- lsyncCalendar.curItemInListStatus.setAttribute("label", com.synckolab.global.strBundle.getString("deleteOnServer"));
+ lsyncCalendar.curItemInListStatus.setAttribute("label", synckolab.global.strBundle.getString("deleteOnServer"));
return true;
},
@@ -351,8 +350,8 @@ com.synckolab.calendarTools = {
/**
* This functions checks if two event json objects are equals
*/
-com.synckolab.calendarTools.equalsEvent = function (a, b) {
- return com.synckolab.tools.equalsObject(a, b);
+synckolab.calendarTools.equalsEvent = function (a, b) {
+ return synckolab.tools.equalsObject(a, b);
};
/**
@@ -361,7 +360,7 @@ com.synckolab.calendarTools.equalsEvent = function (a, b) {
* @param syncTasks true if we sync tasks
* @returns a parsed json object
*/
-com.synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
+synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
if (fileContent === null) {
return null;
}
@@ -373,7 +372,7 @@ com.synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
// fileContent should be a string - with indexOf
if(!fileContent.indexOf) {
- com.synckolab.tools.logMessage("Unknown fileContent: " + fileContent.toSource(), com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("Unknown fileContent: " + fileContent.toSource(), synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
return null;
}
@@ -385,7 +384,7 @@ com.synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
// for ical - use the way through the lightning decoder to json
var parsedEvent = null;
if(fileContent.indexOf("=3D") !== -1) {
- fileContent = com.synckolab.tools.text.quoted.decode(fileContent);
+ fileContent = synckolab.tools.text.quoted.decode(fileContent);
}
// sepcial fix for Europe bug
if (fileContent.indexOf("TZIDID=rope")) {
@@ -399,15 +398,15 @@ com.synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
}
// check type
- if (syncTasks === true && com.synckolab.tools.instanceOf(parsedEvent, Components.interfaces.calIEvent))
+ if (syncTasks === true && synckolab.tools.instanceOf(parsedEvent, Components.interfaces.calIEvent))
{
- com.synckolab.tools.logMessage("There is an event in the task folder! skipping.", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("There is an event in the task folder! skipping.", synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
return null;
}
- if (syncTasks === false && !com.synckolab.tools.instanceOf(parsedEvent, Components.interfaces.calIEvent))
+ if (syncTasks === false && !synckolab.tools.instanceOf(parsedEvent, Components.interfaces.calIEvent))
{
- com.synckolab.tools.logMessage("There is a task in the calendar folder! skipping.", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("There is a task in the calendar folder! skipping.", synckolab.global.LOG_CAL + synckolab.global.LOG_WARNING);
return null;
}
@@ -420,14 +419,14 @@ com.synckolab.calendarTools.message2json = function (fileContent, syncTasks) {
* @param syncTasks true if this is a task
* @return a json object
*/
-com.synckolab.calendarTools.event2json = function (event, syncTasks) {
- com.synckolab.tools.logMessage("Event To JSON", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+synckolab.calendarTools.event2json = function (event, syncTasks) {
+ synckolab.tools.logMessage("Event To JSON", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// no event given
if(!event) {
return null;
}
var jobj = {
- synckolab : com.synckolab.config.version, // synckolab version
+ synckolab : synckolab.config.version, // synckolab version
type : "calendar"
};
@@ -439,7 +438,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
// - yearly recurrence
var isAllDay = syncTasks?false:(event.startDate?event.startDate.isDate:false);
- var endDate = com.synckolab.calendarTools.getEndDate(event, syncTasks);
+ var endDate = synckolab.calendarTools.getEndDate(event, syncTasks);
var i, minutes;
var dayindex, daynumber;
@@ -466,12 +465,12 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
if (syncTasks === true)
{
if(event.entryDate) {
- jobj.startDate = com.synckolab.tools.text.calDateTime2String(event.entryDate, isAllDay);
+ jobj.startDate = synckolab.tools.text.calDateTime2String(event.entryDate, isAllDay);
}
if(endDate) {
- jobj.endDate = com.synckolab.tools.text.calDateTime2String(endDate, isAllDay);
+ jobj.endDate = synckolab.tools.text.calDateTime2String(endDate, isAllDay);
}
- // jobj.completedDate = com.synckolab.tools.text.calDateTime2String(completedDate, true);
+ // jobj.completedDate = synckolab.tools.text.calDateTime2String(completedDate, true);
if(event.priority && event.priority !== null && event.priority !== "") {
jobj.priority = event.priority;
}
@@ -482,20 +481,20 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
jobj.status = "completed";
}
else {
- jobj.status = com.synckolab.calendarTools.getTaskStatus(event.status, true);
+ jobj.status = synckolab.calendarTools.getTaskStatus(event.status, true);
jobj.completed = event.percentComplete;
}
} else {
- jobj.startDate = com.synckolab.tools.text.calDateTime2String(event.startDate, isAllDay);
- jobj.endDate = com.synckolab.tools.text.calDateTime2String(endDate, isAllDay);
+ jobj.startDate = synckolab.tools.text.calDateTime2String(event.startDate, isAllDay);
+ jobj.endDate = synckolab.tools.text.calDateTime2String(endDate, isAllDay);
}
jobj.uid = event.id;
jobj.title = event.title;
jobj.body = event.getProperty("DESCRIPTION");
jobj.sensitivity = event.getProperty("CLASS")?event.getProperty("CLASS").toLowerCase():"public";
- // xml += " <creation-date>" + com.synckolab.tools.text.calDateTime2String(event.getProperty("CREATED"), false) + "</creation-date>\n";
- // xml += " <last-modification-date>" + com.synckolab.tools.text.calDateTime2String(event.getProperty("LAST-MODIFIED"), false) + "</last-modification-date>\n";
+ // xml += " <creation-date>" + synckolab.tools.text.calDateTime2String(event.getProperty("CREATED"), false) + "</creation-date>\n";
+ // xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(event.getProperty("LAST-MODIFIED"), false) + "</last-modification-date>\n";
if (event.getProperty("LOCATION")) {
jobj.location = event.getProperty("LOCATION");
@@ -533,7 +532,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
calarms.push(tmpobj);
// TODO lightning has some other attributes which we should take care of
- com.synckolab.tools.copyFields(alarm, tmpobj, ["description", "summary", "action"], true);
+ synckolab.tools.copyFields(alarm, tmpobj, ["description", "summary", "action"], true);
}
// only create if there are alarms
@@ -601,7 +600,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
if (curDay && curDay.length > 0 ) {
// multiple recurrence possible
for(var recweekdays = 0; recweekdays < curDay.length; recweekdays ++) {
- jobj.recurrence.days.push(com.synckolab.tools.kolab.getXmlDayName(curDay[recweekdays]));
+ jobj.recurrence.days.push(synckolab.tools.kolab.getXmlDayName(curDay[recweekdays]));
}
}
break;
@@ -624,7 +623,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
dayindex = days[0] % 8;
daynumber = (days[0] - dayindex) / 8;
jobj.recurrence.daynumber = daynumber;
- jobj.recurrence.weekday = com.synckolab.tools.kolab.getXmlDayName(dayindex);
+ jobj.recurrence.weekday = synckolab.tools.kolab.getXmlDayName(dayindex);
}
}
break;
@@ -674,7 +673,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
}
if (endDate) {
- jobj.recurrence.untilDate = com.synckolab.tools.text.date2String(endDate.jsDate);
+ jobj.recurrence.untilDate = synckolab.tools.text.date2String(endDate.jsDate);
}
}
@@ -685,7 +684,7 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
{
var item = items[i];
if (item.isNegative) {
- jobj.recurrence.exclusion.push(com.synckolab.tools.text.calDateTime2String(item.date, true));
+ jobj.recurrence.exclusion.push(synckolab.tools.text.calDateTime2String(item.date, true));
}
}
}
@@ -764,17 +763,17 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
* @param json the json object to read
* @param calendar an optional calendar to set
*/
-com.synckolab.calendarTools.json2event = function (jobj, calendar) {
+synckolab.calendarTools.json2event = function (jobj, calendar) {
var syncTasks = (jobj.type === "task");
var event;
if (syncTasks === true)
{
- com.synckolab.tools.logMessage("creating task/todo.", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("creating task/todo.", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
event = Components.classes["@mozilla.org/calendar/todo;1"].createInstance(Components.interfaces.calITodo);
}
else {
- com.synckolab.tools.logMessage("creating event.", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("creating event.", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
event = Components.classes["@mozilla.org/calendar/event;1"].createInstance(Components.interfaces.calIEvent);
}
// set the correct calendar
@@ -790,19 +789,19 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
if(jobj.startDate) {
if (jobj.startDate.indexOf(":") === -1) {
// entry date and start date can be handled the same way
- com.synckolab.tools.logMessage("setting all day: " + (syncTasks?"entryDate":"startDate"), com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
- this.setKolabItemProperty(event, syncTasks?"entryDate":"startDate", com.synckolab.tools.text.string2CalDate(jobj.startDate));
+ synckolab.tools.logMessage("setting all day: " + (syncTasks?"entryDate":"startDate"), synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
+ this.setKolabItemProperty(event, syncTasks?"entryDate":"startDate", synckolab.tools.text.string2CalDate(jobj.startDate));
} else {
// entry date and start date can be handled the same way
- com.synckolab.tools.logMessage("setting: " + (syncTasks?"entryDate":"startDate"), com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
- this.setKolabItemProperty(event, syncTasks?"entryDate":"startDate", com.synckolab.tools.text.string2CalDateTime(jobj.startDate, true));
+ synckolab.tools.logMessage("setting: " + (syncTasks?"entryDate":"startDate"), synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
+ this.setKolabItemProperty(event, syncTasks?"entryDate":"startDate", synckolab.tools.text.string2CalDateTime(jobj.startDate, true));
}
}
// full day
if(jobj.endDate) {
if (jobj.endDate.indexOf(":") === -1) {
- cDate = com.synckolab.tools.text.string2CalDate(jobj.endDate);
+ cDate = synckolab.tools.text.string2CalDate(jobj.endDate);
// Kolab uses for 1-day-event:
// startdate = day_x, enddate = day_x
// Sunbird uses for 1-day-event:
@@ -815,18 +814,18 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
this.setKolabItemProperty(event, syncTasks?"dueDate":"endDate", cDate);
} else {
// due date and end date can be handled the same way
- this.setKolabItemProperty(event, syncTasks?"dueDate":"endDate", com.synckolab.tools.text.string2CalDateTime(jobj.endDate, true));
+ this.setKolabItemProperty(event, syncTasks?"dueDate":"endDate", synckolab.tools.text.string2CalDateTime(jobj.endDate, true));
}
}
// 2005-03-30T15:28:52Z
if(jobj.creationDate) {
- this.setKolabItemProperty(event, "CREATED", com.synckolab.tools.text.string2CalDateTime(jobj.creationDate, true));
+ this.setKolabItemProperty(event, "CREATED", synckolab.tools.text.string2CalDateTime(jobj.creationDate, true));
}
// 2005-03-30T15:28:52Z
if(jobj.lastModified) {
- this.setKolabItemProperty(event, "LAST-MODIFIED", com.synckolab.tools.text.string2CalDateTime(jobj.lastModified, true));
+ this.setKolabItemProperty(event, "LAST-MODIFIED", synckolab.tools.text.string2CalDateTime(jobj.lastModified, true));
}
// special fields for tasks
@@ -864,15 +863,15 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
var alarm = Components.classes["@mozilla.org/calendar/alarm;1"].createInstance(Components.interfaces.calIAlarm);
alarm.related = 1; // 1: related to startdate - 2: related to enddate
// fix for #24507 make sure the alarm is BEFORE the event not after
- alarm.offset = com.synckolab.tools.text.createDuration(-1 * Number(jobj.alarms[i].offset));
+ alarm.offset = synckolab.tools.text.createDuration(-1 * Number(jobj.alarms[i].offset));
// TODO lightning has some other attributes which we should take care of
- com.synckolab.tools.copyFields(jobj.alarms[i], alarm, ["description", "summary", "action"], true);
+ synckolab.tools.copyFields(jobj.alarms[i], alarm, ["description", "summary", "action"], true);
event.addAlarm(alarm);
}
else {
- event.alarmOffset = com.synckolab.tools.text.createDuration(-1 * Number(jobj.alarms[i].offset));
+ event.alarmOffset = synckolab.tools.text.createDuration(-1 * Number(jobj.alarms[i].offset));
}
}
}
@@ -887,7 +886,7 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
}
if(jobj.recurrence) {
- com.synckolab.tools.logMessage("recurring event", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("recurring event", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
var recInfo = Components.classes["@mozilla.org/calendar/recurrence-info;1"].createInstance(Components.interfaces.calIRecurrenceInfo);
recInfo.item = event;
@@ -904,7 +903,7 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
//alert(recRule.icalProperty.icalString);
var weeklyRecurrence = [];
for(var recdays = 0; recdays < jobj.recurrence.days.length; recdays++) {
- weeklyRecurrence.push(com.synckolab.tools.kolab.getDayIndex(jobj.recurrence.days[recdays]));
+ weeklyRecurrence.push(synckolab.tools.kolab.getDayIndex(jobj.recurrence.days[recdays]));
}
recRule.setComponent("BYDAY", weeklyRecurrence.length, weeklyRecurrence);
}
@@ -918,7 +917,7 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
recRule.setComponent("BYMONTHDAY", 1, [jobj.recurrence.daynumber]);
}
} else {
- var dayindex = com.synckolab.tools.kolab.getDayIndex(jobj.recurrence.weekday);
+ var dayindex = synckolab.tools.kolab.getDayIndex(jobj.recurrence.weekday);
if(jobj.recurrence.daynumber === -1) {
recRule.setComponent("BYDAY", 1, [(-1)*(8+dayindex)]);
} else {
@@ -939,17 +938,17 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
if(jobj.recurrence.untilDate) {
if (recRule.endDate) {
- recRule.endDate = com.synckolab.tools.text.string2CalDate(jobj.recurrence.untilDate);
+ recRule.endDate = synckolab.tools.text.string2CalDate(jobj.recurrence.untilDate);
} else {
// new lighnting
- recRule.untilDate = com.synckolab.tools.text.string2CalDate(jobj.recurrence.untilDate);
+ recRule.untilDate = synckolab.tools.text.string2CalDate(jobj.recurrence.untilDate);
}
}
recInfo.insertRecurrenceItemAt(recRule, 0);
if(jobj.recurrence.exclusion && jobj.recurrence.exclusion.length > 0) {
for(i=0; i < jobj.recurrence.exclusion.length; i++) {
- var exclusionDate = com.synckolab.tools.text.string2CalDate(jobj.recurrence.exclusion[i]);
+ var exclusionDate = synckolab.tools.text.string2CalDate(jobj.recurrence.exclusion[i]);
recInfo.removeOccurrenceAt(exclusionDate);
var exclusion = recInfo.getOccurrenceFor(exclusionDate,true);
recInfo.modifyException(exclusion, true);
@@ -1010,10 +1009,10 @@ com.synckolab.calendarTools.json2event = function (jobj, calendar) {
*
* @return true, if this event actually existed
*/
-com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
+synckolab.calendarTools.xml2json = function (xml, syncTasks)
{
var jobj = {
- synckolab : com.synckolab.config.version, // synckolab version
+ synckolab : synckolab.config.version, // synckolab version
type : "calendar"
};
@@ -1024,16 +1023,16 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
// check if we have to decode quoted printable
if (xml.indexOf(" version=3D") !== -1) { // we know from the version
- xml = com.synckolab.tools.text.quoted.decode(xml);
+ xml = synckolab.tools.text.quoted.decode(xml);
}
- com.synckolab.tools.logMessage("Parsing an XML event:\n" + xml, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Parsing an XML event:\n" + xml, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
// TODO improve recurrence settings
// not working ATM:
// - yearly recurrence
// decode utf chars and make sure an & is an &amp; (otherwise this is unparseable)
- xml = com.synckolab.tools.text.utf8.decode(xml);
+ xml = synckolab.tools.text.utf8.decode(xml);
// temporary fixes:
// - attribute: "summary= ; "action=
// TODO: remove for non-nightly!!!
@@ -1052,28 +1051,28 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
if (topNode.nodeName === "parsererror")
{
// so this message has no valid XML part :-(
- com.synckolab.tools.logMessage("Error parsing the XML content of this message.\n" + xml, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Error parsing the XML content of this message.\n" + xml, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return false;
}
if ((topNode.nodeType !== Node.ELEMENT_NODE) || ((topNode.nodeName.toUpperCase() !== "EVENT") && (topNode.nodeName.toUpperCase() !== "TASK") ))
{
// this can't be an event in Kolab XML format
- com.synckolab.tools.logMessage("This message doesn't contain an event in Kolab XML format.\n" + xml, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("This message doesn't contain an event in Kolab XML format.\n" + xml, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return false;
}
// check for task
if(syncTasks !== true && topNode.nodeName.toUpperCase() === "TASK") {
- com.synckolab.tools.logMessage("Skipping task in event sync", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Skipping task in event sync", synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
if(syncTasks === true && topNode.nodeName.toUpperCase() !== "TASK") {
- com.synckolab.tools.logMessage("Skipping event in task sync", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Skipping event in task sync", synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
- var cur = new com.synckolab.Node(topNode.firstChild);
+ var cur = new synckolab.Node(topNode.firstChild);
var s, tmpobj;
var cDate;
// iterate over the DOM tree of the XML structure of the event
@@ -1385,7 +1384,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
jobj.recurrence.interval = Number(cur.getXmlResult("INTERVAL", 1));
jobj.recurrence.count = 0;
- var node = new com.synckolab.Node(cur.getChildNode("RANGE"));
+ var node = new synckolab.Node(cur.getChildNode("RANGE"));
if (node)
{
// read the "type" attribute of the range
@@ -1490,7 +1489,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
cur = cur.nextSibling;
} // end while
- com.synckolab.tools.logMessage("Parsed event in XML", com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Parsed event in XML", synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
return jobj;
};
@@ -1499,7 +1498,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
* Kolabs "deferred" will be Lightning "CANCELLED"
*/
/* return the task status */
-com.synckolab.calendarTools.getTaskStatus = function (tstatus, xmlvalue) {
+synckolab.calendarTools.getTaskStatus = function (tstatus, xmlvalue) {
var arrstatus = [];
arrstatus["IN-PROCESS"] = "in-progress";
arrstatus["IN-PROGRESS"] = "in-progress";
@@ -1543,7 +1542,7 @@ com.synckolab.calendarTools.getTaskStatus = function (tstatus, xmlvalue) {
* @param skipVolatiles skips problematic fields for hash creation
* @return XML string in Kolab 2 format
*/
-com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
+synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
// TODO not working ATM:
// - yearly recurrence
@@ -1556,35 +1555,35 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
xml += '<event version='+'"'+'1.0" >\n';
}
- xml += " <product-id>Synckolab " + com.synckolab.config.version + ", Calendar Sync</product-id>\n";
- xml += com.synckolab.tools.text.nodeWithContent("uid", jobj.uid, false);
+ xml += " <product-id>Synckolab " + synckolab.config.version + ", Calendar Sync</product-id>\n";
+ xml += synckolab.tools.text.nodeWithContent("uid", jobj.uid, false);
if(syncTasks === true)
{
// tasks have a status
- xml += com.synckolab.tools.text.nodeWithContent("status", jobj.status, false);
- xml += com.synckolab.tools.text.nodeWithContent("completed", jobj.completed, false);
- xml += com.synckolab.tools.text.nodeWithContent("start-date", jobj.startDate, false);
- xml += com.synckolab.tools.text.nodeWithContent("due-date", jobj.endDate, false);
- xml += com.synckolab.tools.text.nodeWithContent("priority", jobj.priority, false);
+ xml += synckolab.tools.text.nodeWithContent("status", jobj.status, false);
+ xml += synckolab.tools.text.nodeWithContent("completed", jobj.completed, false);
+ xml += synckolab.tools.text.nodeWithContent("start-date", jobj.startDate, false);
+ xml += synckolab.tools.text.nodeWithContent("due-date", jobj.endDate, false);
+ xml += synckolab.tools.text.nodeWithContent("priority", jobj.priority, false);
- // xml += " <completed-date>" + com.synckolab.tools.text.calDateTime2String(completedDate, true) + "</completed-date>\n";
+ // xml += " <completed-date>" + synckolab.tools.text.calDateTime2String(completedDate, true) + "</completed-date>\n";
}
else
{
- xml += com.synckolab.tools.text.nodeWithContent("start-date", jobj.startDate, false);
- xml += com.synckolab.tools.text.nodeWithContent("end-date", jobj.endDate, false);
+ xml += synckolab.tools.text.nodeWithContent("start-date", jobj.startDate, false);
+ xml += synckolab.tools.text.nodeWithContent("end-date", jobj.endDate, false);
}
- xml += com.synckolab.tools.text.nodeWithContent("summary", jobj.title, false);
- xml += com.synckolab.tools.text.nodeWithContent("body", jobj.body, false);
- xml += com.synckolab.tools.text.nodeWithContent("sensitivity", jobj.sensitivity, false);
+ xml += synckolab.tools.text.nodeWithContent("summary", jobj.title, false);
+ xml += synckolab.tools.text.nodeWithContent("body", jobj.body, false);
+ xml += synckolab.tools.text.nodeWithContent("sensitivity", jobj.sensitivity, false);
// xml += " <creation-date>" + jobj.createdDate + "</creation-date>\n";
// xml += " <last-modification-date>" + jobj.lastModificationDate + "</last-modification-date>\n";
- xml += com.synckolab.tools.text.nodeWithContent("location", jobj.location, false);
- xml += com.synckolab.tools.text.nodeWithContent("show-time-as", jobj.showTimeAs, false);
- xml += com.synckolab.tools.text.nodeWithContent("color-label", jobj.colorLabel, false);
+ xml += synckolab.tools.text.nodeWithContent("location", jobj.location, false);
+ xml += synckolab.tools.text.nodeWithContent("show-time-as", jobj.showTimeAs, false);
+ xml += synckolab.tools.text.nodeWithContent("color-label", jobj.colorLabel, false);
var i;
if(jobj.alarms) {
@@ -1604,7 +1603,7 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
}
}
- xml += com.synckolab.tools.text.nodeWithContent("categories", jobj.categories, false);
+ xml += synckolab.tools.text.nodeWithContent("categories", jobj.categories, false);
if(jobj.recurrence) {
switch(jobj.recurrence.cycle) {
case "daily":
@@ -1613,7 +1612,7 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
case "weekly":
xml += " <recurrence cycle=\"weekly\">\n";
for(i=0; i < jobj.recurrence.days.length; i++) {
- xml += com.synckolab.tools.text.nodeWithContent("day", jobj.recurrence.days[i], false);
+ xml += synckolab.tools.text.nodeWithContent("day", jobj.recurrence.days[i], false);
}
break;
case "monthly":
@@ -1622,7 +1621,7 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
} else if(jobj.recurrence.days) {
xml += " <recurrence cycle=\"monthly\" type=\"daynumber\">\n";
for(i=0; i < jobj.recurrence.days.length; i++) {
- xml += com.synckolab.tools.text.nodeWithContent("daynumber", jobj.recurrence.days[i], false);
+ xml += synckolab.tools.text.nodeWithContent("daynumber", jobj.recurrence.days[i], false);
}
} else if(!jobj.recurrence.weekday) {
xml += " <recurrence cycle=\"monthly\" type=\"daynumber\">\n";
@@ -1655,7 +1654,7 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
break;
}
- xml += com.synckolab.tools.text.nodeWithContent("interval", jobj.recurrence.interval, true);
+ xml += synckolab.tools.text.nodeWithContent("interval", jobj.recurrence.interval, true);
if(jobj.recurrence.count && jobj.recurrence.count > 0) {
xml += " <range type=\"number\">" + jobj.recurrence.count + "</range>\n";
} else if(jobj.recurrence.untilDate) {
@@ -1666,7 +1665,7 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
if(jobj.recurrence.exclusion) {
for(i=0; i < jobj.recurrence.exclusion.length; i++) {
- xml += com.synckolab.tools.text.nodeWithContent("exclusion", jobj.recurrence.exclusion[i], true);
+ xml += synckolab.tools.text.nodeWithContent("exclusion", jobj.recurrence.exclusion[i], true);
}
}
@@ -1676,11 +1675,11 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
if(jobj.attendees) {
for(i=0; i < jobj.attendees.length; i++) {
xml += " <attendee>\n";
- xml += com.synckolab.tools.text.nodeWithContent("display-name", jobj.attendees[i].displayName, false);
- xml += com.synckolab.tools.text.nodeWithContent("smtp-address", jobj.attendees[i].email, false);
- xml += com.synckolab.tools.text.nodeWithContent("status", jobj.attendees[i].status, false);
- xml += com.synckolab.tools.text.nodeWithContent("request-response", jobj.attendees[i].rsvp ? "true" : "false", false);
- xml += com.synckolab.tools.text.nodeWithContent("role", jobj.attendees[i].role, false);
+ xml += synckolab.tools.text.nodeWithContent("display-name", jobj.attendees[i].displayName, false);
+ xml += synckolab.tools.text.nodeWithContent("smtp-address", jobj.attendees[i].email, false);
+ xml += synckolab.tools.text.nodeWithContent("status", jobj.attendees[i].status, false);
+ xml += synckolab.tools.text.nodeWithContent("request-response", jobj.attendees[i].rsvp ? "true" : "false", false);
+ xml += synckolab.tools.text.nodeWithContent("role", jobj.attendees[i].role, false);
xml += " </attendee>\n";
}
}
@@ -1689,16 +1688,16 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
if (jobj.organizer)
{
xml += " <organizer>\n";
- xml += com.synckolab.tools.text.nodeWithContent("display-name", jobj.organizer.displayName, false);
- xml += com.synckolab.tools.text.nodeWithContent("smtp-address", jobj.organizer.email, false);
+ xml += synckolab.tools.text.nodeWithContent("display-name", jobj.organizer.displayName, false);
+ xml += synckolab.tools.text.nodeWithContent("smtp-address", jobj.organizer.email, false);
xml += " </organizer>\n";
}
if (jobj.creator)
{
xml += " <creator>\n";
- xml += com.synckolab.tools.text.nodeWithContent("display-name", jobj.creator.displayName, false);
- xml += com.synckolab.tools.text.nodeWithContent("smtp-address", jobj.creator.email, false);
+ xml += synckolab.tools.text.nodeWithContent("display-name", jobj.creator.displayName, false);
+ xml += synckolab.tools.text.nodeWithContent("smtp-address", jobj.creator.email, false);
xml += " </creator>\n";
}
@@ -1712,14 +1711,14 @@ com.synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
xml += "</event>\n";
}
- //com.synckolab.tools.logMessage("Created XML event structure:\n=============================\n" + xml, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ //synckolab.tools.logMessage("Created XML event structure:\n=============================\n" + xml, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
return xml;
};
/**
* Write an event into human readable form
*/
-com.synckolab.calendarTools.json2Human = function (jobj)
+synckolab.calendarTools.json2Human = function (jobj)
{
var txt = "";
if (jobj.title) {
@@ -1750,12 +1749,12 @@ com.synckolab.calendarTools.json2Human = function (jobj)
*
* @return a message in Kolab 2 format
*/
-com.synckolab.calendarTools.event2kolabXmlMsg = function (event, email)
+synckolab.calendarTools.event2kolabXmlMsg = function (event, email)
{
var syncTasks = (event.type === "task");
var xml = this.json2xml(event, syncTasks);
- return com.synckolab.tools.generateMail(event.uid, email, "", syncTasks?"application/x-vnd.kolab.task":"application/x-vnd.kolab.event",
- true, com.synckolab.tools.text.utf8.encode(xml), this.json2Human(event, syncTasks));
+ return synckolab.tools.generateMail(event.uid, email, "", syncTasks?"application/x-vnd.kolab.task":"application/x-vnd.kolab.event",
+ true, synckolab.tools.text.utf8.encode(xml), this.json2Human(event, syncTasks));
};
@@ -1763,7 +1762,7 @@ com.synckolab.calendarTools.event2kolabXmlMsg = function (event, email)
/**
* functions to handle the iCal event format
*/
-com.synckolab.calendarTools.ical2event = function (content, todo)
+synckolab.calendarTools.ical2event = function (content, todo)
{
var event;
var icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]
@@ -1775,7 +1774,7 @@ com.synckolab.calendarTools.ical2event = function (content, todo)
rootComp = icssrv.parseICS(content, null);
}
catch (ex) {
- com.synckolab.tools.logMessage("unable to parse ical: " + content, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("unable to parse ical: " + content, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
@@ -1803,24 +1802,24 @@ com.synckolab.calendarTools.ical2event = function (content, todo)
.createInstance(Components.interfaces.calITodo);
break;
} else if (subComp.componentType !== "VTIMEZONE") {
- com.synckolab.tools.logMessage("unable to parse event 2: " + content, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("unable to parse event 2: " + content, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
subComp = event.getNextSubcomponent("ANY");
}
if (!subComp ) {
- com.synckolab.tools.logMessage("unable to parse event 3: " + content, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("unable to parse event 3: " + content, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
try {
event.icalComponent = subComp;
- com.synckolab.tools.logMessage("parsed event: " + event + ":" + event.id, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("parsed event: " + event + ":" + event.id, synckolab.global.LOG_CAL + synckolab.global.LOG_INFO);
}
catch (exc) {
- com.synckolab.tools.logMessage("unable to parse event: \n" + content, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("unable to parse event: \n" + content, synckolab.global.LOG_CAL + synckolab.global.LOG_ERROR);
return null;
}
return event;
diff --git a/src/chrome/content/synckolab/config.js b/src/chrome/content/synckolab/config.js
index 31cefbd..4eef754 100644
--- a/src/chrome/content/synckolab/config.js
+++ b/src/chrome/content/synckolab/config.js
@@ -32,11 +32,10 @@
***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
-com.synckolab.config = {
- version: "2.0.3",
+synckolab.config = {
+ version: "3.0.0",
DEBUG_SYNCKOLAB: true,
SWITCH_TIME: 20, //wait 20ms (enough so tbird wont get unresponsive)
@@ -55,27 +54,27 @@ com.synckolab.config = {
// definition of settings that are the same for each part (contact/calendar/task)
baseSetting: {
// the address book / calendar
- source: {type: com.synckolab.tools.CONFIG_TYPE_CHAR, def: null },
+ source: {type: synckolab.tools.CONFIG_TYPE_CHAR, def: null },
// the imap folder path
- folderPath: {type: com.synckolab.tools.CONFIG_TYPE_CHAR, def: null },
+ folderPath: {type: synckolab.tools.CONFIG_TYPE_CHAR, def: null },
// true if the config is enabled
- enabled: {type: com.synckolab.tools.CONFIG_TYPE_BOOL, def: true },
+ enabled: {type: synckolab.tools.CONFIG_TYPE_BOOL, def: true },
// save changes to imap (vs. read only)
- saveToImap: {type: com.synckolab.tools.CONFIG_TYPE_BOOL, def: true },
+ saveToImap: {type: synckolab.tools.CONFIG_TYPE_BOOL, def: true },
// automatically sync every X minutes (0 = disable)
- //@deprecated syncInterval: {type: com.synckolab.tools.CONFIG_TYPE_INT, def: 0 },
+ //@deprecated syncInterval: {type: synckolab.tools.CONFIG_TYPE_INT, def: 0 },
// format to use: xml|vcard
- format: {type: com.synckolab.tools.CONFIG_TYPE_CHAR, def: "xml" },
+ format: {type: synckolab.tools.CONFIG_TYPE_CHAR, def: "xml" },
// timeframe to sync in (don't sync entries with an older start-date)
- timeFrame: {type: com.synckolab.tools.CONFIG_TYPE_INT, def: 180},
+ timeFrame: {type: synckolab.tools.CONFIG_TYPE_INT, def: 180},
// enable the sync listener
- syncListener: {type: com.synckolab.tools.CONFIG_TYPE_BOOL, def: false },
+ syncListener: {type: synckolab.tools.CONFIG_TYPE_BOOL, def: false },
// what to do with conflicts
- defaultResolve: {type: com.synckolab.tools.CONFIG_TYPE_CHAR, def: "ask" }
+ defaultResolve: {type: synckolab.tools.CONFIG_TYPE_CHAR, def: "ask" }
}
};
-com.synckolab.global = {
+synckolab.global = {
// log settings
LOG_ERROR: 0,
LOG_WARNING: 1,
@@ -107,24 +106,24 @@ com.synckolab.global = {
* @param pref the preference service (optional)
* @returns a configuration object
*/
-com.synckolab.config.loadConfiguration = function(pref) {
+synckolab.config.loadConfiguration = function(pref) {
if(!pref) {
pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
}
var config = {
- version: com.synckolab.tools.getConfigValue(pref, "configVersion", com.synckolab.tools.CONFIG_TYPE_INT, 0),
- debugLevel: com.synckolab.tools.getConfigValue(pref, "debugLevel", com.synckolab.tools.CONFIG_TYPE_INT, com.synckolab.global.LOG_WARNING),
+ version: synckolab.tools.getConfigValue(pref, "configVersion", synckolab.tools.CONFIG_TYPE_INT, 0),
+ debugLevel: synckolab.tools.getConfigValue(pref, "debugLevel", synckolab.tools.CONFIG_TYPE_INT, synckolab.global.LOG_WARNING),
// hide folder
- hideFolder: com.synckolab.tools.getConfigValue(pref, "hideFolder", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ hideFolder: synckolab.tools.getConfigValue(pref, "hideFolder", synckolab.tools.CONFIG_TYPE_BOOL, false),
// close window when done
- closeWindow: com.synckolab.tools.getConfigValue(pref, "closeWindow", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ closeWindow: synckolab.tools.getConfigValue(pref, "closeWindow", synckolab.tools.CONFIG_TYPE_BOOL, false),
// sync automatically once on start
- syncOnStart: com.synckolab.tools.getConfigValue(pref, "syncOnStart", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ syncOnStart: synckolab.tools.getConfigValue(pref, "syncOnStart", synckolab.tools.CONFIG_TYPE_BOOL, false),
accounts: []
};
- var sAcct = com.synckolab.tools.getConfigValue(pref, "accounts.list");
+ var sAcct = synckolab.tools.getConfigValue(pref, "accounts.list");
if (sAcct) {
var sAccts = sAcct.split(';');
for(var i = 0; i < sAccts.length; i++) {
@@ -140,7 +139,7 @@ com.synckolab.config.loadConfiguration = function(pref) {
};
config.accounts.push(acct);
- com.synckolab.config.loadAccountConfig(pref, acct);
+ synckolab.config.loadAccountConfig(pref, acct);
}
}
@@ -152,13 +151,13 @@ com.synckolab.config.loadConfiguration = function(pref) {
* read the account configuration into an object
* @param acct the account object to read the configuration into (name has to be existent)
*/
-com.synckolab.config.loadAccountConfig = function (pref, acct) {
+synckolab.config.loadAccountConfig = function (pref, acct) {
var sConf, sConfs, i;
for(var type in acct) {
// skip volatiles/non-arrays
if(type !== "name" && acct[type].push) {
- sConf = com.synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".list");
+ sConf = synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".list");
sConfs = sConf.split(';');
if(sConfs) {
for(i = 0; i < sConfs.length; i++) {
@@ -172,12 +171,12 @@ com.synckolab.config.loadAccountConfig = function (pref, acct) {
acct[type].push(cConf);
// read all the base settings
- for(var n in com.synckolab.config.baseSetting) {
+ for(var n in synckolab.config.baseSetting) {
// skip unwanted prototypes (without type)
- if(com.synckolab.config.baseSetting[n].type >= 0) {
- cConf[n] = com.synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".configs." + cConf.name + "." + n,
- com.synckolab.config.baseSetting[n].type,
- com.synckolab.config.baseSetting[n].def);
+ if(synckolab.config.baseSetting[n].type >= 0) {
+ cConf[n] = synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".configs." + cConf.name + "." + n,
+ synckolab.config.baseSetting[n].type,
+ synckolab.config.baseSetting[n].def);
}
}
}
@@ -196,36 +195,36 @@ com.synckolab.config.loadAccountConfig = function (pref, acct) {
* <li>the folder listener
* </ul>
*/
-com.synckolab.config.readConfiguration = function() {
+synckolab.config.readConfiguration = function() {
var i,j;
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var curVersion = com.synckolab.tools.getConfigValue(pref, "configVersion", com.synckolab.tools.CONFIG_TYPE_INT, 0);
- com.synckolab.tools.logMessage("Checking configuration ("+com.synckolab.config.VERSION+" - "+curVersion+")", com.synckolab.global.LOG_DEBUG);
+ var curVersion = synckolab.tools.getConfigValue(pref, "configVersion", synckolab.tools.CONFIG_TYPE_INT, 0);
+ synckolab.tools.logMessage("Checking configuration ("+synckolab.config.VERSION+" - "+curVersion+")", synckolab.global.LOG_DEBUG);
- if(curVersion === com.synckolab.config.VERSION) {
+ if(curVersion === synckolab.config.VERSION) {
// nothing changed and we have an active config
return;
}
// load the configuration (use existing pref service)
- var config = com.synckolab.config.loadConfiguration(pref);
+ var config = synckolab.config.loadConfiguration(pref);
// set the debug level
- com.synckolab.config.DEBUG_SYNCKOLAB_LEVEL = com.synckolab.global.LOG_ALL + config.debugLevel;
+ synckolab.config.DEBUG_SYNCKOLAB_LEVEL = synckolab.global.LOG_ALL + config.debugLevel;
- com.synckolab.tools.logMessage("Config Version has changed. ("+com.synckolab.config.VERSION+" - "+curVersion+") - LogLevel " + com.synckolab.config.DEBUG_SYNCKOLAB_LEVEL, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Config Version has changed. ("+synckolab.config.VERSION+" - "+curVersion+") - LogLevel " + synckolab.config.DEBUG_SYNCKOLAB_LEVEL, synckolab.global.LOG_INFO);
// remember the config version
- com.synckolab.config.VERSION = curVersion;
+ synckolab.config.VERSION = curVersion;
- com.synckolab.main.config = config;
+ synckolab.main.config = config;
// hide folder
- com.synckolab.main.hideFolder = config.hideFolder;
+ synckolab.main.hideFolder = config.hideFolder;
// create an object for each configuration
- com.synckolab.main.syncConfigs = [];
+ synckolab.main.syncConfigs = [];
// hide window
- com.synckolab.main.doHideWindow = config.hiddenWindow;
+ synckolab.main.doHideWindow = config.hiddenWindow;
// check for listener or autorun
@@ -235,43 +234,43 @@ com.synckolab.config.readConfiguration = function() {
// read the messagefolder and save the object in the config
for(j = 0; j < account.contact.length; j++) {
account.contact[j].serverKey = account.name;
- com.synckolab.config.prepareConfig(account.contact[j], "contact");
+ synckolab.config.prepareConfig(account.contact[j], "contact");
if(account.contact[j].enabled) {
- com.synckolab.tools.logMessage("Adding contact account " + account.contact[j].name, com.synckolab.global.LOG_INFO);
- com.synckolab.main.syncConfigs.push(account.contact[j]);
+ synckolab.tools.logMessage("Adding contact account " + account.contact[j].name, synckolab.global.LOG_INFO);
+ synckolab.main.syncConfigs.push(account.contact[j]);
}
}
if(account.calendar) {
for(j = 0; j < account.calendar.length; j++) {
- com.synckolab.tools.logMessage("checking calendar " + account.calendar[j].name, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("checking calendar " + account.calendar[j].name, synckolab.global.LOG_INFO);
account.calendar[j].serverKey = account.name;
- com.synckolab.config.prepareConfig(account.calendar[j], "calendar");
- com.synckolab.tools.logMessage("checking calendar " + account.calendar[j].name + " enabled? " + account.calendar[j].enabled, com.synckolab.global.LOG_INFO);
+ synckolab.config.prepareConfig(account.calendar[j], "calendar");
+ synckolab.tools.logMessage("checking calendar " + account.calendar[j].name + " enabled? " + account.calendar[j].enabled, synckolab.global.LOG_INFO);
if(account.calendar[j].enabled) {
- com.synckolab.tools.logMessage("Adding calendar account " + account.calendar[j].name, com.synckolab.global.LOG_INFO);
- com.synckolab.main.syncConfigs.push(account.calendar[j]);
+ synckolab.tools.logMessage("Adding calendar account " + account.calendar[j].name, synckolab.global.LOG_INFO);
+ synckolab.main.syncConfigs.push(account.calendar[j]);
}
}
}
if(account.task) {
for(j = 0; j < account.task.length; j++) {
- com.synckolab.tools.logMessage("checking task " + account.calendar[j].name, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("checking task " + account.calendar[j].name, synckolab.global.LOG_INFO);
account.task[j].serverKey = account.name;
- com.synckolab.config.prepareConfig(account.task[j], "task");
+ synckolab.config.prepareConfig(account.task[j], "task");
if(account.task[j].enabled) {
- com.synckolab.tools.logMessage("Adding task account " + account.task[j].name, com.synckolab.global.LOG_INFO);
- com.synckolab.main.syncConfigs.push(account.task[j]);
+ synckolab.tools.logMessage("Adding task account " + account.task[j].name, synckolab.global.LOG_INFO);
+ synckolab.main.syncConfigs.push(account.task[j]);
}
}
}
}
var msgNotificationService = Components.classes["@mozilla.org/messenger/msgnotificationservice;1"].getService(Components.interfaces.nsIMsgFolderNotificationService);
- msgNotificationService.addListener(com.synckolab.config.folderListener, msgNotificationService.msgAdded | msgNotificationService.msgsDeleted | msgNotificationService.msgsMoveCopyCompleted);
+ msgNotificationService.addListener(synckolab.config.folderListener, msgNotificationService.msgAdded | msgNotificationService.msgsDeleted | msgNotificationService.msgsMoveCopyCompleted);
};
-com.synckolab.config.checkIdProcessed = function(baseConfig, id) {
+synckolab.config.checkIdProcessed = function(baseConfig, id) {
for(var i = 0; i < baseConfig.recentProcessed.length; i++) {
if(id === baseConfig.recentProcessed[i]) {
baseConfig.recentProcessed.splice(i, 1);
@@ -285,28 +284,28 @@ com.synckolab.config.checkIdProcessed = function(baseConfig, id) {
/**
* creates an empty config object
*/
-com.synckolab.config.prepareConfig = function(baseConfig, confType) {
+synckolab.config.prepareConfig = function(baseConfig, confType) {
// if we dont wnat to - dont initialize it
if(!baseConfig.enabled) {
- com.synckolab.tools.logMessage("config " + baseConfig.name +"/"+confType + " is disabled!", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("config " + baseConfig.name +"/"+confType + " is disabled!", synckolab.global.LOG_INFO);
return;
}
// no folder - not enabled
if(!baseConfig.folderPath || baseConfig.folderPath.length < 5) {
- com.synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + "- no folderpath found", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + "- no folderpath found", synckolab.global.LOG_INFO);
baseConfig.enabled = false;
return;
}
// no source - not enabled
if(!baseConfig.source) {
- com.synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + "- no source found", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + "- no source found", synckolab.global.LOG_INFO);
baseConfig.enabled = false;
return;
}
// keep a lookup of ALL messages in the folder for local trigger
- baseConfig.msgList = new com.synckolab.hashMap();
+ baseConfig.msgList = new synckolab.hashMap();
// keep a list of all IDs recently processed - this avoids double checking
baseConfig.recentProcessed = [];
@@ -316,65 +315,65 @@ com.synckolab.config.prepareConfig = function(baseConfig, confType) {
// trigger handler
if(confType === "contact") {
- baseConfig.triggerParseAddMessage = com.synckolab.AddressBook.triggerParseAddMessage;
- baseConfig.triggerParseDeleteMessage = com.synckolab.AddressBook.triggerParseDeleteMessage;
- baseConfig.init = com.synckolab.AddressBook.init;
- baseConfig.syncClass = com.synckolab.AddressBook;
+ baseConfig.triggerParseAddMessage = synckolab.AddressBook.triggerParseAddMessage;
+ baseConfig.triggerParseDeleteMessage = synckolab.AddressBook.triggerParseDeleteMessage;
+ baseConfig.init = synckolab.AddressBook.init;
+ baseConfig.syncClass = synckolab.AddressBook;
// add some custom contact related stuff
- com.synckolab.AddressBook.readConfig(baseConfig);
+ synckolab.AddressBook.readConfig(baseConfig);
} else {
// tasks and events are handled by calendar
- baseConfig.triggerParseAddMessage = com.synckolab.Calendar.triggerParseAddMessage;
- baseConfig.triggerParseDeleteMessage = com.synckolab.Calendar.triggerParseDeleteMessage;
- baseConfig.init = com.synckolab.Calendar.init;
- baseConfig.syncClass = com.synckolab.Calendar;
+ baseConfig.triggerParseAddMessage = synckolab.Calendar.triggerParseAddMessage;
+ baseConfig.triggerParseDeleteMessage = synckolab.Calendar.triggerParseDeleteMessage;
+ baseConfig.init = synckolab.Calendar.init;
+ baseConfig.syncClass = synckolab.Calendar;
// add some custom contact related stuff
- com.synckolab.Calendar.readConfig(baseConfig);
+ synckolab.Calendar.readConfig(baseConfig);
}
// get and set the message folder
- baseConfig.folder = com.synckolab.tools.getMsgFolder(baseConfig.serverKey, baseConfig.folderPath);
+ baseConfig.folder = synckolab.tools.getMsgFolder(baseConfig.serverKey, baseConfig.folderPath);
// disable config if it doesnt exist
if(!baseConfig.folder) {
- com.synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + " - baseFolder missing " + baseConfig.folderPath, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("disabling " + baseConfig.name +"/"+confType + " - baseFolder missing " + baseConfig.folderPath, synckolab.global.LOG_INFO);
baseConfig.enabled = false;
return;
}
baseConfig.folderMsgURI = baseConfig.folder.baseMessageURI;
- baseConfig.email = com.synckolab.tools.getAccountEMail(baseConfig.serverKey);
- baseConfig.mailname = com.synckolab.tools.getAccountName(baseConfig.serverKey);
+ baseConfig.email = synckolab.tools.getAccountEMail(baseConfig.serverKey);
+ baseConfig.mailname = synckolab.tools.getAccountName(baseConfig.serverKey);
- com.synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": check listener for "+ baseConfig.folderMsgURI, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": check listener for "+ baseConfig.folderMsgURI, synckolab.global.LOG_DEBUG);
if(baseConfig.addListener) {
- com.synckolab.tools.logMessage("adding listener for "+ baseConfig.folderMsgURI, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("adding listener for "+ baseConfig.folderMsgURI, synckolab.global.LOG_DEBUG);
}
- com.synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": check sync on start", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": check sync on start", synckolab.global.LOG_DEBUG);
baseConfig.startOnce = false;
if(baseConfig.syncOnStart)
{
- com.synckolab.tools.logMessage("Run on Startup for "+ baseConfig.name, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Run on Startup for "+ baseConfig.name, synckolab.global.LOG_DEBUG);
// run the config
- com.synckolab.main.forceConfig = baseConfig;
- com.synckolab.main.sync("timer");
+ synckolab.main.forceConfig = baseConfig;
+ synckolab.main.sync("timer");
}
- com.synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": done ("+baseConfig.enabled+")", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage(baseConfig.name +"/"+confType + ": done ("+baseConfig.enabled+")", synckolab.global.LOG_DEBUG);
};
-com.synckolab.config.folderListener = {
+synckolab.config.folderListener = {
findConfig: function(folder) {
// fixup folder: image:// vs. imap-message://
folder = "imap-message" + folder.substring(4);
// search through the configs
- for(var j = 0; j < com.synckolab.main.syncConfigs.length; j++) {
- if(com.synckolab.main.syncConfigs[j]) {
- var curConfig = com.synckolab.main.syncConfigs[j];
- com.synckolab.tools.logMessage("checking " + curConfig.folderMsgURI + " vs. " + folder, com.synckolab.global.LOG_DEBUG);
+ for(var j = 0; j < synckolab.main.syncConfigs.length; j++) {
+ if(synckolab.main.syncConfigs[j]) {
+ var curConfig = synckolab.main.syncConfigs[j];
+ synckolab.tools.logMessage("checking " + curConfig.folderMsgURI + " vs. " + folder, synckolab.global.LOG_DEBUG);
if(curConfig.syncListener && curConfig.folderMsgURI === folder)
{
@@ -386,24 +385,24 @@ com.synckolab.config.folderListener = {
},
msgAdded: function(aMsg) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
var msg = aMsg.QueryInterface(Components.interfaces.nsIMsgDBHdr);
//nsIMsgDBHdr - check folder
- com.synckolab.tools.logMessage("ADDED to " + msg.folder.folderURL, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("ADDED to " + msg.folder.folderURL, synckolab.global.LOG_DEBUG);
// lets see if we have this folde rin the list
var curConfig = this.findConfig(msg.folder.folderURL);
if(curConfig) {
// check if this one hasnt been just added
- if(com.synckolab.config.checkIdProcessed(curConfig, msg.mime2DecodedSubject)) {
- com.synckolab.tools.logMessage("message recently processed - ignore", com.synckolab.global.LOG_DEBUG);
+ if(synckolab.config.checkIdProcessed(curConfig, msg.mime2DecodedSubject)) {
+ synckolab.tools.logMessage("message recently processed - ignore", synckolab.global.LOG_DEBUG);
return;
}
- com.synckolab.tools.logMessage("Found configuration for folder... calling", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Found configuration for folder... calling", synckolab.global.LOG_DEBUG);
var content = {
message: "imap-message" + msg.folder.folderURL.substring(4) +"#"+msg.messageKey,
fileContent: "",
@@ -411,7 +410,7 @@ com.synckolab.config.folderListener = {
config: curConfig,
nextFunc: curConfig.triggerParseAddMessage
};
- com.synckolab.main.getMessageIntoContent(content);
+ synckolab.main.getMessageIntoContent(content);
}
},
msgsClassified: function(aMsgs, aJunkProcessed, aTraitProcessed) {
@@ -419,21 +418,21 @@ com.synckolab.config.folderListener = {
},
msgsDeleted: function(aMsgs) {
// make sure not to parse messages while a full sync is running
- if(com.synckolab.global.running || com.synckolab.global.triggerRunning) {
+ if(synckolab.global.running || synckolab.global.triggerRunning) {
return;
}
//nsiArray<nsIMsgDBHdr> - check folder
- com.synckolab.tools.logMessage("GOT DELETE...", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("GOT DELETE...", synckolab.global.LOG_DEBUG);
var e = aMsgs.enumerate();
while(e.hasMoreElements()) {
var msg = e.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
- com.synckolab.tools.logMessage("DELETED from " + msg.folder.folderURL, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("DELETED from " + msg.folder.folderURL, synckolab.global.LOG_DEBUG);
var curConfig = this.findConfig(msg.folder.folderURL);
if(curConfig) {
// check if this one hasnt been just removed
- if(com.synckolab.config.checkIdProcessed(curConfig, msg.mime2DecodedSubject)) {
- com.synckolab.tools.logMessage("message recently processed - ignore", com.synckolab.global.LOG_DEBUG);
+ if(synckolab.config.checkIdProcessed(curConfig, msg.mime2DecodedSubject)) {
+ synckolab.tools.logMessage("message recently processed - ignore", synckolab.global.LOG_DEBUG);
return;
}
@@ -444,7 +443,7 @@ com.synckolab.config.folderListener = {
config: curConfig,
nextFunc: curConfig.triggerParseDeleteMessage
};
- com.synckolab.main.getMessageIntoContent(content);
+ synckolab.main.getMessageIntoContent(content);
}
}
},
@@ -453,7 +452,7 @@ com.synckolab.config.folderListener = {
*/
msgsMoveCopyCompleted: function(aMove, aSrcMsgs, aDestFolder) {
//nsiArray<nsIMsgDBHdr> - check folder
- com.synckolab.tools.logMessage("MOVE: " + aMove, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("MOVE: " + aMove, synckolab.global.LOG_DEBUG);
if(aMove) {
this.msgsDeleted(aSrcMsgs);
}
@@ -474,7 +473,7 @@ com.synckolab.config.folderListener = {
// ignore
},
itemEvent: function(aItem, aEvent, aData) {
- com.synckolab.tools.logMessage("EVENT", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("EVENT", synckolab.global.LOG_DEBUG);
}
};
diff --git a/src/chrome/content/synckolab/contactConflictDialog.xul b/src/chrome/content/synckolab/contactConflictDialog.xul
index df752ad..6bf5580 100644
--- a/src/chrome/content/synckolab/contactConflictDialog.xul
+++ b/src/chrome/content/synckolab/contactConflictDialog.xul
@@ -13,10 +13,10 @@
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="contactConfligGldWindow"
buttons="accept,cancel"
- ondialogaccept="return com.synckolab.contactConflict.doOK();"
- ondialogcancel="return com.synckolab.contactConflict.doCancel();"
+ ondialogaccept="return synckolab.contactConflict.doOK();"
+ ondialogcancel="return synckolab.contactConflict.doCancel();"
buttonlabelcancel="Skip"
- onload="com.synckolab.contactConflict.init();"
+ onload="synckolab.contactConflict.init();"
persist="screenX screenY"
title="&synckolab.contactConflict.dialogTitle;">
@@ -250,8 +250,8 @@
</scrollbox>
<box align="left">
- <button label="Keep Server" oncommand="com.synckolab.contactConflict.keepServer(); return false;"/>
- <button label="Keep Local" oncommand="com.synckolab.contactConflict.keepLocal(); return false;"/>
+ <button label="Keep Server" oncommand="synckolab.contactConflict.keepServer(); return false;"/>
+ <button label="Keep Local" oncommand="synckolab.contactConflict.keepLocal(); return false;"/>
</box>
</dialog>
diff --git a/src/chrome/content/synckolab/contactConflictDialogCode.js b/src/chrome/content/synckolab/contactConflictDialogCode.js
index d054fea..2ce9637 100644
--- a/src/chrome/content/synckolab/contactConflictDialogCode.js
+++ b/src/chrome/content/synckolab/contactConflictDialogCode.js
@@ -30,10 +30,9 @@
*
***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
-com.synckolab.contactConflict = {
+synckolab.contactConflict = {
localCard:null,
serverCard: null,
@@ -61,12 +60,12 @@ com.synckolab.contactConflict = {
} else {
//Updating both copies with new values
for ( i=0 ; i < this.conflictsArray.length ; i++ ) {
- var serverValue = com.synckolab.addressbookTools.getCardProperty(this.serverCard, this.conflictsArray[i]);
- var localValue = com.synckolab.addressbookTools.getCardProperty(this.localCard, this.conflictsArray[i]);
+ var serverValue = synckolab.addressbookTools.getCardProperty(this.serverCard, this.conflictsArray[i]);
+ var localValue = synckolab.addressbookTools.getCardProperty(this.localCard, this.conflictsArray[i]);
if (document.getElementById(this.conflictsArray[i]).selectedIndex === 0) {
- com.synckolab.addressbookTools.setCardProperty(this.localCard, this.conflictsArray[i], serverValue);
+ synckolab.addressbookTools.setCardProperty(this.localCard, this.conflictsArray[i], serverValue);
} else {
- com.synckolab.addressbookTools.setCardProperty(this.serverCard, this.conflictsArray[i], localValue);
+ synckolab.addressbookTools.setCardProperty(this.serverCard, this.conflictsArray[i], localValue);
}
}
this.conflictResolution.result = 3;
@@ -88,7 +87,7 @@ com.synckolab.contactConflict = {
document.getElementById(this.conflictsArray[i]).selectedIndex = 0;
}
else {
- com.synckolab.tools.logMessage("unable to find element for conflict " + this.conflictsArray[i], com.synckolab.global.LOG_ERROR + com.synckolab.global.LOG_AB);
+ synckolab.tools.logMessage("unable to find element for conflict " + this.conflictsArray[i], synckolab.global.LOG_ERROR + synckolab.global.LOG_AB);
}
}
return false;
@@ -113,18 +112,18 @@ com.synckolab.contactConflict = {
this.localCard = window.arguments[3];
//Show static elements for the following so that we always know who's record we are looking at
- document.getElementById("firstNameStatic").value = com.synckolab.addressbookTools.getCardProperty(this.localCard, 'FirstName');
- document.getElementById("lastNameStatic").value = com.synckolab.addressbookTools.getCardProperty(this.localCard, 'LastName');
- document.getElementById("displayNameStatic").value = com.synckolab.addressbookTools.getCardProperty(this.localCard, 'DisplayName');
- document.getElementById("nickNameStatic").value = com.synckolab.addressbookTools.getCardProperty(this.localCard, 'NickName');
+ document.getElementById("firstNameStatic").value = synckolab.addressbookTools.getCardProperty(this.localCard, 'FirstName');
+ document.getElementById("lastNameStatic").value = synckolab.addressbookTools.getCardProperty(this.localCard, 'LastName');
+ document.getElementById("displayNameStatic").value = synckolab.addressbookTools.getCardProperty(this.localCard, 'DisplayName');
+ document.getElementById("nickNameStatic").value = synckolab.addressbookTools.getCardProperty(this.localCard, 'NickName');
var serverValue;
var localValue;
//Loop through the conflicted fields, set their current values, unhide from the dialog
for (var i=0 ; i < this.conflictsArray.length ; i++ ) {
- serverValue = com.synckolab.addressbookTools.getCardProperty(this.serverCard, this.conflictsArray[i]);
- localValue = com.synckolab.addressbookTools.getCardProperty(this.localCard, this.conflictsArray[i]);
+ serverValue = synckolab.addressbookTools.getCardProperty(this.serverCard, this.conflictsArray[i]);
+ localValue = synckolab.addressbookTools.getCardProperty(this.localCard, this.conflictsArray[i]);
if (serverValue === 0 || serverValue === null || serverValue === "0" || serverValue === "null")
serverValue = "";
diff --git a/src/chrome/content/synckolab/contents.rdf b/src/chrome/content/synckolab/contents.rdf
index 3fabf0f..3773fc5 100644
--- a/src/chrome/content/synckolab/contents.rdf
+++ b/src/chrome/content/synckolab/contents.rdf
@@ -8,7 +8,7 @@
<!-- package information -->
<RDF:Description about="urn:mozilla:package:synckolab"
- chrome:displayName="SyncKolab 2.0.3"
+ chrome:displayName="SyncKolab 3.0.0"
chrome:author="Niko Berger"
chrome:name="synckolab"
chrome:description="Synchronize an IMAP Folder with the mozilla Address Book and Calendar "
diff --git a/src/chrome/content/synckolab/mainWindow.xul b/src/chrome/content/synckolab/mainWindow.xul
index baddfdf..23435cd 100644
--- a/src/chrome/content/synckolab/mainWindow.xul
+++ b/src/chrome/content/synckolab/mainWindow.xul
@@ -17,7 +17,7 @@
<commandset id="mailCommands">
<command id="cmd_synckolab_sync"
tooltiptext="&synckolab.sync.tip;"
- oncommand="com.synckolab.main.sync('manual');"/>
+ oncommand="synckolab.main.sync('manual');"/>
<command id="cmd_synckolab_options"
oncommand="window.openDialog('chrome://synckolab/content/wndConfig.xul', 'options', 'chrome=yes,resizable=yes,modal=yes');"/>
</commandset>
@@ -50,9 +50,9 @@
window.addEventListener("load", function load(event) {
window.removeEventListener("load", load, false); //remove listener, no longer needed
// init the timer
- com.synckolab.main.syncKolabTimer();
+ synckolab.main.syncKolabTimer();
// init the groupware
- com.synckolab.main.initGroupwareActions();
+ synckolab.main.initGroupwareActions();
}, false);
// calendar fix
diff --git a/src/chrome/content/synckolab/synckolab.js b/src/chrome/content/synckolab/synckolab.js
index f7a0054..5cb3b82 100644
--- a/src/chrome/content/synckolab/synckolab.js
+++ b/src/chrome/content/synckolab/synckolab.js
@@ -29,12 +29,11 @@
*
* ***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
//synckolab interface
-com.synckolab.main = {
+synckolab.main = {
timer: Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer),
backgroundTimer: Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer),
/************************
@@ -58,21 +57,21 @@ com.synckolab.main = {
/**
* runs periodically and checks if there is anything to do
*/
-com.synckolab.main.syncKolabTimer = function () {
- com.synckolab.tools.logMessage("sync timer starting", com.synckolab.global.LOG_DEBUG);
- com.synckolab.config.readConfiguration();
+synckolab.main.syncKolabTimer = function () {
+ synckolab.tools.logMessage("sync timer starting", synckolab.global.LOG_DEBUG);
+ synckolab.config.readConfiguration();
/*@deprecated: listener works better
var i;
// check and load config
// only continue timer if nothing is running right now and if we have any configs!
- if (com.synckolab.main.forceConfig === null && com.synckolab.main.syncConfigs)
+ if (synckolab.main.forceConfig === null && synckolab.main.syncConfigs)
{
// go through all configs
- for (i=0; i < com.synckolab.main.syncConfigs.length; i++)
+ for (i=0; i < synckolab.main.syncConfigs.length; i++)
{
- var curConfig = com.synckolab.main.syncConfigs[i];
+ var curConfig = synckolab.main.syncConfigs[i];
// skip all configurations which dont have autorun
if (!curConfig || curConfig.autoRun === 0)
@@ -80,19 +79,19 @@ com.synckolab.main.syncKolabTimer = function () {
continue;
}
- com.synckolab.tools.logMessage("synctimer: checking: "+curConfig.name+" ("+com.synckolab.main.syncConfigs[i].gAutoRun+")....", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("synctimer: checking: "+curConfig.name+" ("+synckolab.main.syncConfigs[i].gAutoRun+")....", synckolab.global.LOG_DEBUG);
curConfig.syncTimer++;
// lets start (make sure no other auto config is running right now)
if (curConfig.syncTimer >= curConfig.autoRun)
{
- com.synckolab.tools.logMessage("running syncKolab configuration "+curConfig.name+" ("+curConfig.autoRun+")", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("running syncKolab configuration "+curConfig.name+" ("+curConfig.autoRun+")", synckolab.global.LOG_INFO);
curConfig.syncTimer = 0;
// hide the window
- com.synckolab.main.doHideWindow = curConfig.autoHideWindow;
- com.synckolab.main.forceConfig = curConfig.name;
- com.synckolab.main.sync("timer");
+ synckolab.main.doHideWindow = curConfig.autoHideWindow;
+ synckolab.main.forceConfig = curConfig.name;
+ synckolab.main.sync("timer");
// make sure, that we do not start another config right now
break;
@@ -101,24 +100,24 @@ com.synckolab.main.syncKolabTimer = function () {
}
}
else {
- com.synckolab.tools.logMessage("sync with config "+com.synckolab.main.forceConfig +" is still running...", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("sync with config "+synckolab.main.forceConfig +" is still running...", synckolab.global.LOG_DEBUG);
}
*/
// refresh all mail folders configured to trigger auto-sync
- if(com.synckolab.main.syncConfigs) {
- for(var j = 0; j < com.synckolab.main.syncConfigs.length; j++) {
- if(com.synckolab.main.syncConfigs[j]) {
- var curConfig = com.synckolab.main.syncConfigs[j];
- com.synckolab.tools.logMessage("sync timer: checking config " + curConfig.name, com.synckolab.global.LOG_DEBUG);
+ if(synckolab.main.syncConfigs) {
+ for(var j = 0; j < synckolab.main.syncConfigs.length; j++) {
+ if(synckolab.main.syncConfigs[j]) {
+ var curConfig = synckolab.main.syncConfigs[j];
+ synckolab.tools.logMessage("sync timer: checking config " + curConfig.name, synckolab.global.LOG_DEBUG);
if(curConfig.syncListener && curConfig.folder)
{
- com.synckolab.tools.logMessage("refreshing " + curConfig.folderMsgURI + "...", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("refreshing " + curConfig.folderMsgURI + "...", synckolab.global.LOG_DEBUG);
try {
curConfig.folder.updateFolder(null);
} catch (ex) {
- com.synckolab.tools.logMessage("unable to refresh " + curConfig.folderMsgURI + ": " + ex, com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("unable to refresh " + curConfig.folderMsgURI + ": " + ex, synckolab.global.LOG_WARNING);
}
}
}
@@ -126,17 +125,17 @@ com.synckolab.main.syncKolabTimer = function () {
}
// wait a minute
- com.synckolab.tools.logMessage("sync timer: sleep for 30s minute", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("sync timer: sleep for 30s minute", synckolab.global.LOG_INFO);
- com.synckolab.main.backgroundTimer.initWithCallback({
+ synckolab.main.backgroundTimer.initWithCallback({
notify:
function () {
- com.synckolab.main.syncKolabTimer();
+ synckolab.main.syncKolabTimer();
}
}, 30000, 0);
};
-com.synckolab.main.initGroupwareActions = function() {
+synckolab.main.initGroupwareActions = function() {
// detect and disable event listener for seamonkey
try {
if((Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo)).name === "SeaMonkey")
@@ -146,32 +145,32 @@ com.synckolab.main.initGroupwareActions = function() {
} catch (ex) { /* ignore */ }
// make sure configuration is already available
- com.synckolab.config.readConfiguration();
+ synckolab.config.readConfiguration();
- com.synckolab.main.timer.initWithCallback({
+ synckolab.main.timer.initWithCallback({
notify:
function (){
- window.document.getElementById('folderTree').addEventListener("click", com.synckolab.main.groupwareActions, true);
+ window.document.getElementById('folderTree').addEventListener("click", synckolab.main.groupwareActions, true);
}
- }, com.synckolab.config.SWITCH_TIME, 0);
+ }, synckolab.config.SWITCH_TIME, 0);
};
/**
* Executed when the user clicks on a folder.
* This checks the config if we want to hide that folder and open the address book or calendar view instead.
*/
-com.synckolab.main.groupwareActions = function () {
+synckolab.main.groupwareActions = function () {
// make sure we have an up to date and valid configuration
- com.synckolab.config.readConfiguration();
+ synckolab.config.readConfiguration();
// only do that if we really have to
- if(!com.synckolab.main.config.hideFolder)
+ if(!synckolab.main.config.hideFolder)
{
return;
}
- com.synckolab.tools.logMessage("Starting groupware Actions function", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Starting groupware Actions function", synckolab.global.LOG_DEBUG);
// Grab the selected folder and figure out what the INBOX is so we can switch to that later
var selected_foldername = gFolderDisplay.displayedFolder.URI; // gFolderDisplay is defined in messenger
@@ -183,11 +182,11 @@ com.synckolab.main.groupwareActions = function () {
var i;
- com.synckolab.tools.logMessage("In groupware Actions function folder name is " + selected_foldername, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In groupware Actions function folder name is " + selected_foldername, synckolab.global.LOG_DEBUG);
- for (i=0; i < com.synckolab.main.syncConfigs.length; i++)
+ for (i=0; i < synckolab.main.syncConfigs.length; i++)
{
- var curConfig = com.synckolab.main.syncConfigs[i];
+ var curConfig = synckolab.main.syncConfigs[i];
if(!curConfig)
{
continue;
@@ -197,14 +196,14 @@ com.synckolab.main.groupwareActions = function () {
switch(curConfig.type) {
case "calendar":
- com.synckolab.tools.logMessage("In groupware Actions selected Calendar folder", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In groupware Actions selected Calendar folder", synckolab.global.LOG_DEBUG);
if (versionChecker.compare(Application.version, "3.0b4") >= 0) {
document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('tooltiptext') });
SelectFolder(inbox);
}
break;
case "task":
- com.synckolab.tools.logMessage("In groupware Actions selected Task folder", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In groupware Actions selected Task folder", synckolab.global.LOG_DEBUG);
if (versionChecker.compare(Application.version, "3.0b4") >= 0) {
document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('tooltiptext') });
@@ -212,7 +211,7 @@ com.synckolab.main.groupwareActions = function () {
}
break;
case "contact":
- com.synckolab.tools.logMessage("In groupware Actions selected Contacts folder", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("In groupware Actions selected Contacts folder", synckolab.global.LOG_DEBUG);
if (versionChecker.compare(Application.version, "3.0b4") >= 0) {
document.getElementById('tabmail').openTab('contentTab', {contentPage: 'chrome://messenger/content/addressbook/addressbook.xul'});
SelectFolder(inbox);
@@ -225,79 +224,79 @@ com.synckolab.main.groupwareActions = function () {
};
//progress variables
-com.synckolab.main.curStep = 0;
+synckolab.main.curStep = 0;
//hold window elements
-com.synckolab.main.processMsg = null; //process message
-com.synckolab.main.curCounter = null; // counter
-com.synckolab.main.meter = null; // the progress meter
-com.synckolab.main.totalMeter = null; // the total progress meter
-com.synckolab.main.statusMsg = null; // the status message
-com.synckolab.main.itemList = null; // display all processed items
+synckolab.main.processMsg = null; //process message
+synckolab.main.curCounter = null; // counter
+synckolab.main.meter = null; // the progress meter
+synckolab.main.totalMeter = null; // the total progress meter
+synckolab.main.statusMsg = null; // the status message
+synckolab.main.itemList = null; // display all processed items
-com.synckolab.main.fileContent = null; // holds the file content
+synckolab.main.fileContent = null; // holds the file content
// sync message db
-com.synckolab.main.syncMessageDb = null;
-com.synckolab.main.gSyncFileKey = null;
-com.synckolab.main.gSyncKeyInfo = null;
-com.synckolab.main.gLastMessageDBHdr = null; // save last message header
+synckolab.main.syncMessageDb = null;
+synckolab.main.gSyncFileKey = null;
+synckolab.main.gSyncKeyInfo = null;
+synckolab.main.gLastMessageDBHdr = null; // save last message header
/**
* Start a sync.
* @param event containing the type of sync (i.e. "timer")
* @param syncconfig an optional configuration to sync directly (i.e. for "trigger")
*/
-com.synckolab.main.sync = function (event, syncconfig)
+synckolab.main.sync = function (event, syncconfig)
{
- com.synckolab.global.consoleService.logStringMessage("running SyncKolab "+com.synckolab.config.version+" with debug level " + com.synckolab.config.DEBUG_SYNCKOLAB_LEVEL + " in " + event + " mode (hideWindow: " + com.synckolab.main.doHideWindow +")");
+ synckolab.global.consoleService.logStringMessage("running SyncKolab "+synckolab.config.version+" with debug level " + synckolab.config.DEBUG_SYNCKOLAB_LEVEL + " in " + event + " mode (hideWindow: " + synckolab.main.doHideWindow +")");
// avoid race condition with manual switch (only timer has a this.forceConfig)
- if (com.synckolab.global.running === true)
+ if (synckolab.global.running === true)
{
- com.synckolab.tools.logMessage("Ignoring run - there is already an instance!", com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("Ignoring run - there is already an instance!", synckolab.global.LOG_WARNING);
return;
}
- com.synckolab.global.running = true;
+ synckolab.global.running = true;
// in case this wasnt called via timer - its a manual sync
if (event !== "timer" && event !== "trigger")
{
- com.synckolab.main.forceConfig = "MANUAL-SYNC";
- com.synckolab.main.forceConfigType = null;
+ synckolab.main.forceConfig = "MANUAL-SYNC";
+ synckolab.main.forceConfigType = null;
}
- com.synckolab.global.strBundle = document.getElementById("synckolabBundle");
+ synckolab.global.strBundle = document.getElementById("synckolabBundle");
- if (com.synckolab.main.doHideWindow) {
- com.synckolab.global.wnd = null;
+ if (synckolab.main.doHideWindow) {
+ synckolab.global.wnd = null;
} else {
- com.synckolab.global.wnd = window.openDialog("chrome://synckolab/content/progressWindow.xul", "bmarks", "chrome,width=500,height=350,resizable=yes,alwaysRaised=yes,dependent=yes,modal=no");
+ synckolab.global.wnd = window.openDialog("chrome://synckolab/content/progressWindow.xul", "bmarks", "chrome,width=500,height=350,resizable=yes,alwaysRaised=yes,dependent=yes,modal=no");
}
// reset variables
- com.synckolab.main.totalMessages = 0;
- com.synckolab.main.curMessage = null;
- com.synckolab.main.currentMessage = null;
- com.synckolab.main.updateMessages = null;
- com.synckolab.main.updateMessagesContent = null;
- com.synckolab.main.writeDone = false;
+ synckolab.main.totalMessages = 0;
+ synckolab.main.curMessage = null;
+ synckolab.main.currentMessage = null;
+ synckolab.main.updateMessages = null;
+ synckolab.main.updateMessagesContent = null;
+ synckolab.main.writeDone = false;
- com.synckolab.main.gMessages = null;
- com.synckolab.main.gSync = null;
+ synckolab.main.gMessages = null;
+ synckolab.main.gSync = null;
- com.synckolab.main.gLaterMessages = null; // for lists - we have to wait until we got everything - then start
+ synckolab.main.gLaterMessages = null; // for lists - we have to wait until we got everything - then start
// wait until loaded
- com.synckolab.main.timer.initWithCallback({
+ synckolab.main.timer.initWithCallback({
notify:
function (){
- com.synckolab.main.goWindow(com.synckolab.global.wnd);
+ synckolab.main.goWindow(synckolab.global.wnd);
}
- }, com.synckolab.config.SWITCH_TIME, 0);
+ }, synckolab.config.SWITCH_TIME, 0);
};
-com.synckolab.main.goWindow = function(wnd)
+synckolab.main.goWindow = function(wnd)
{
// wait until the window is loaded (might need a little)
if (wnd)
@@ -305,7 +304,7 @@ com.synckolab.main.goWindow = function(wnd)
var statusMsg1 = wnd.document.getElementById('current-action');
if (statusMsg1 === null || !statusMsg1)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.goWindow(wnd);}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.goWindow(wnd);}}, synckolab.config.SWITCH_TIME, 0);
return;
}
}
@@ -313,12 +312,12 @@ com.synckolab.main.goWindow = function(wnd)
if (wnd)
{
// some window elements for displaying the status
- com.synckolab.main.meter = wnd.document.getElementById('progress');
- com.synckolab.main.totalMeter = wnd.document.getElementById('totalProgress');
- com.synckolab.main.statusMsg = wnd.document.getElementById('current-action');
- com.synckolab.main.processMsg = wnd.document.getElementById('current-process');
- com.synckolab.main.curCounter = wnd.document.getElementById('current-counter');
- com.synckolab.main.itemList = wnd.document.getElementById('itemList');
+ synckolab.main.meter = wnd.document.getElementById('progress');
+ synckolab.main.totalMeter = wnd.document.getElementById('totalProgress');
+ synckolab.main.statusMsg = wnd.document.getElementById('current-action');
+ synckolab.main.processMsg = wnd.document.getElementById('current-process');
+ synckolab.main.curCounter = wnd.document.getElementById('current-counter');
+ synckolab.main.itemList = wnd.document.getElementById('itemList');
}
else
{
@@ -328,200 +327,200 @@ com.synckolab.main.goWindow = function(wnd)
wnd.gStopSync = false;
wnd.gPauseSync = false;
}
- com.synckolab.main.statusMsg = document.getElementById('current-action-sk');
- if (com.synckolab.main.statusMsg === null) {
- com.synckolab.main.statusMsg = document.createElement("statusbarpanel");
- com.synckolab.main.statusMsg.setAttribute("id", "current-action-sk");
- sb.appendChild(com.synckolab.main.statusMsg);
+ synckolab.main.statusMsg = document.getElementById('current-action-sk');
+ if (synckolab.main.statusMsg === null) {
+ synckolab.main.statusMsg = document.createElement("statusbarpanel");
+ synckolab.main.statusMsg.setAttribute("id", "current-action-sk");
+ sb.appendChild(synckolab.main.statusMsg);
}
- com.synckolab.main.meter = document.getElementById('progress');
- if (com.synckolab.main.meter === null) {
- com.synckolab.main.meter = document.createElement("progressmeter");
- sb.appendChild(com.synckolab.main.meter);
- com.synckolab.main.meter.setAttribute("id", "progress-sk");
+ synckolab.main.meter = document.getElementById('progress');
+ if (synckolab.main.meter === null) {
+ synckolab.main.meter = document.createElement("progressmeter");
+ sb.appendChild(synckolab.main.meter);
+ synckolab.main.meter.setAttribute("id", "progress-sk");
}
- com.synckolab.main.meter.setAttribute("mode", "determined");
- com.synckolab.main.meter.setAttribute("value", "0");
- com.synckolab.main.meter.setAttribute("style", "width:100px");
+ synckolab.main.meter.setAttribute("mode", "determined");
+ synckolab.main.meter.setAttribute("value", "0");
+ synckolab.main.meter.setAttribute("style", "width:100px");
- com.synckolab.main.curCounter = document.getElementById('current-counter-sk');
- if (com.synckolab.main.curCounter === null) {
- com.synckolab.main.curCounter = document.createElement("statusbarpanel");
- com.synckolab.main.curCounter.setAttribute("id", "current-counter-sk");
- sb.appendChild(com.synckolab.main.curCounter);
+ synckolab.main.curCounter = document.getElementById('current-counter-sk');
+ if (synckolab.main.curCounter === null) {
+ synckolab.main.curCounter = document.createElement("statusbarpanel");
+ synckolab.main.curCounter.setAttribute("id", "current-counter-sk");
+ sb.appendChild(synckolab.main.curCounter);
}
- com.synckolab.main.curCounter.setAttribute("label", "-/-");
+ synckolab.main.curCounter.setAttribute("label", "-/-");
- com.synckolab.main.processMsg = null;
- com.synckolab.main.totalMeter = null;
- com.synckolab.main.itemList = null;
+ synckolab.main.processMsg = null;
+ synckolab.main.totalMeter = null;
+ synckolab.main.itemList = null;
}
- if (com.synckolab.calendarTools.isCalendarAvailable())
+ if (synckolab.calendarTools.isCalendarAvailable())
{
- com.synckolab.tools.logMessage("Calendar available", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Calendar available", synckolab.global.LOG_INFO);
}
else {
- com.synckolab.tools.logMessage("Calendar not available - disabling", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Calendar not available - disabling", synckolab.global.LOG_INFO);
}
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.startSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.startSync();}}, synckolab.config.SWITCH_TIME, 0);
};
-com.synckolab.main.startSync = function(event) {
- com.synckolab.main.meter.setAttribute("value", "0%");
- if (com.synckolab.global.wnd) {
- com.synckolab.main.totalMeter.setAttribute("value", "0%");
+synckolab.main.startSync = function(event) {
+ synckolab.main.meter.setAttribute("value", "0%");
+ if (synckolab.global.wnd) {
+ synckolab.main.totalMeter.setAttribute("value", "0%");
}
// get temp file
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
file.append("syncKolab.tmp");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 600);
- com.synckolab.main.gTmpFile = file.path;
+ synckolab.main.gTmpFile = file.path;
// check if the configuration is available and up to date
- com.synckolab.config.readConfiguration();
+ synckolab.config.readConfiguration();
- if(com.synckolab.main.syncConfigs) {
- com.synckolab.tools.logMessage("Starting sync with " + com.synckolab.main.syncConfigs.length + " configurations.", com.synckolab.global.LOG_DEBUG);
+ if(synckolab.main.syncConfigs) {
+ synckolab.tools.logMessage("Starting sync with " + synckolab.main.syncConfigs.length + " configurations.", synckolab.global.LOG_DEBUG);
}
// reset the config counter
- com.synckolab.main.curConfig = 0;
+ synckolab.main.curConfig = 0;
// all initialized, lets run
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.nextSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.nextSync();}}, synckolab.config.SWITCH_TIME, 0);
};
/**
* Start a new sync loop. This will iterate through all configurations and sync accordingly.
* Calls prepareContent or itself.
*/
-com.synckolab.main.nextSync = function()
+synckolab.main.nextSync = function()
{
// remember the current configuation
var curConfig = null;
- if (com.synckolab.global.wnd) {
- com.synckolab.main.totalMeter.setAttribute("value", ((com.synckolab.main.curConfig*100)/(com.synckolab.main.syncConfigs.length)) +"%");
+ if (synckolab.global.wnd) {
+ synckolab.main.totalMeter.setAttribute("value", ((synckolab.main.curConfig*100)/(synckolab.main.syncConfigs.length)) +"%");
}
- if (com.synckolab.main.curConfig < com.synckolab.main.syncConfigs.length)
+ if (synckolab.main.curConfig < synckolab.main.syncConfigs.length)
{
// empty or invalid config
- if(!com.synckolab.main.syncConfigs[com.synckolab.main.curConfig]) {
- com.synckolab.main.curConfig++;
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.nextSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ if(!synckolab.main.syncConfigs[synckolab.main.curConfig]) {
+ synckolab.main.curConfig++;
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.nextSync();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
// contact config
- curConfig = com.synckolab.main.syncConfigs[com.synckolab.main.curConfig];
+ curConfig = synckolab.main.syncConfigs[synckolab.main.curConfig];
// skip problematic configs or if we don't want to sync this
if (!curConfig || !curConfig.enabled)
{
- com.synckolab.main.curConfig++;
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.nextSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.curConfig++;
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.nextSync();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
// if we were called from timer - forceConfig defines one config which is loaded - skip the rest then
- if (com.synckolab.main.forceConfig && com.synckolab.main.forceConfig !== "MANUAL-SYNC") {
+ if (synckolab.main.forceConfig && synckolab.main.forceConfig !== "MANUAL-SYNC") {
// check if we skip that: name and type must match
- if (com.synckolab.main.forceConfig !== curConfig.name ||
- (com.synckolab.main.forceConfigType && com.synckolab.main.forceConfigType !== "contact"))
+ if (synckolab.main.forceConfig !== curConfig.name ||
+ (synckolab.main.forceConfigType && synckolab.main.forceConfigType !== "contact"))
{
- com.synckolab.main.curConfig++;
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.nextSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.curConfig++;
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.nextSync();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
}
- com.synckolab.main.gConfig = curConfig;
- com.synckolab.tools.logMessage("Trying configuration " + curConfig.name, com.synckolab.global.LOG_DEBUG);
+ synckolab.main.gConfig = curConfig;
+ synckolab.tools.logMessage("Trying configuration " + curConfig.name, synckolab.global.LOG_DEBUG);
- if (com.synckolab.main.processMsg) {
- com.synckolab.main.processMsg.value ="Configuration " + curConfig.name;
+ if (synckolab.main.processMsg) {
+ synckolab.main.processMsg.value ="Configuration " + curConfig.name;
}
// run the init callback
- com.synckolab.main.curConfig++;
+ synckolab.main.curConfig++;
// remember the sync class
- com.synckolab.main.gSync = curConfig.syncClass;
+ synckolab.main.gSync = curConfig.syncClass;
// display stuff
- if (com.synckolab.global.wnd)
+ if (synckolab.global.wnd)
{
- curConfig.syncClass.init(curConfig, com.synckolab.main.itemList, com.synckolab.global.wnd.document);
+ curConfig.syncClass.init(curConfig, synckolab.main.itemList, synckolab.global.wnd.document);
}
else
{
curConfig.syncClass.init(curConfig, null, document);
}
- com.synckolab.tools.logMessage("got folder: " + curConfig.folder.URI +
- "\nMessage Folder: " + curConfig.folderMsgURI, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("got folder: " + curConfig.folder.URI +
+ "\nMessage Folder: " + curConfig.folderMsgURI, synckolab.global.LOG_DEBUG);
// the init2 does the goon for us
if(curConfig.syncClass.init2) {
- com.synckolab.tools.logMessage("runnint init2 on " + curConfig.name, com.synckolab.global.LOG_DEBUG);
- curConfig.syncClass.init2(com.synckolab.main.prepareContent, curConfig.syncClass);
+ synckolab.tools.logMessage("runnint init2 on " + curConfig.name, synckolab.global.LOG_DEBUG);
+ curConfig.syncClass.init2(synckolab.main.prepareContent, curConfig.syncClass);
}
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.prepareContent();}}, com.synckolab.config.SWITCH_TIME, 0);
- //com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.prepareContent(com.synckolab.Calendar);}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.prepareContent();}}, synckolab.config.SWITCH_TIME, 0);
+ //synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.prepareContent(synckolab.Calendar);}}, synckolab.config.SWITCH_TIME, 0);
}
else //done
{
- com.synckolab.tools.logMessage("Done syncing resetting ui." , com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Done syncing resetting ui." , synckolab.global.LOG_DEBUG);
- if(com.synckolab.global.wnd && !com.synckolab.global.wnd.document) {
- com.synckolab.global.wnd = null;
+ if(synckolab.global.wnd && !synckolab.global.wnd.document) {
+ synckolab.global.wnd = null;
}
- if (com.synckolab.global.wnd) {
- com.synckolab.main.totalMeter.setAttribute("value", "100%");
+ if (synckolab.global.wnd) {
+ synckolab.main.totalMeter.setAttribute("value", "100%");
}
- com.synckolab.main.meter.setAttribute("value", "100%");
- if (com.synckolab.global.wnd) {
- com.synckolab.main.statusMsg.value = com.synckolab.global.strBundle.getString("syncfinished");
+ synckolab.main.meter.setAttribute("value", "100%");
+ if (synckolab.global.wnd) {
+ synckolab.main.statusMsg.value = synckolab.global.strBundle.getString("syncfinished");
} else {
- com.synckolab.main.statusMsg.setAttribute("label", com.synckolab.global.strBundle.getString("syncfinished"));
+ synckolab.main.statusMsg.setAttribute("label", synckolab.global.strBundle.getString("syncfinished"));
}
- if (com.synckolab.global.wnd) {
- com.synckolab.global.wnd.document.getElementById('cancel-button').label = com.synckolab.global.strBundle.getString("close");
+ if (synckolab.global.wnd) {
+ synckolab.global.wnd.document.getElementById('cancel-button').label = synckolab.global.strBundle.getString("close");
}
// delete the temp file
var sfile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- sfile.initWithPath(com.synckolab.main.gTmpFile);
+ sfile.initWithPath(synckolab.main.gTmpFile);
if (sfile.exists()) {
sfile.remove(true);
}
// close the status window
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- if (com.synckolab.tools.getConfigValue(pref, "closeWindow", com.synckolab.tools.CONFIG_TYPE_BOOL, false) && com.synckolab.global.wnd) {
- com.synckolab.global.wnd.close();
+ if (synckolab.tools.getConfigValue(pref, "closeWindow", synckolab.tools.CONFIG_TYPE_BOOL, false) && synckolab.global.wnd) {
+ synckolab.global.wnd.close();
}
// remove all status bar elements
try {
- if (com.synckolab.global.wnd === null)
+ if (synckolab.global.wnd === null)
{
var sb = document.getElementById("status-bar");
if(sb) {
- sb.removeChild(com.synckolab.main.meter);
- sb.removeChild(com.synckolab.main.statusMsg);
- sb.removeChild(com.synckolab.main.curCounter);
+ sb.removeChild(synckolab.main.meter);
+ sb.removeChild(synckolab.main.statusMsg);
+ sb.removeChild(synckolab.main.curCounter);
}
}
} catch (sbEx) {
@@ -529,74 +528,74 @@ com.synckolab.main.nextSync = function()
}
// done autorun
- if (com.synckolab.main.forceConfig)
+ if (synckolab.main.forceConfig)
{
- com.synckolab.tools.logMessage("finished autorun of config " + com.synckolab.main.forceConfig, com.synckolab.global.LOG_INFO);
- com.synckolab.main.forceConfig = null;
- com.synckolab.main.doHideWindow = false;
+ synckolab.tools.logMessage("finished autorun of config " + synckolab.main.forceConfig, synckolab.global.LOG_INFO);
+ synckolab.main.forceConfig = null;
+ synckolab.main.doHideWindow = false;
}
// set running state to done
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
// Step 3
- if (com.synckolab.global.wnd)
+ if (synckolab.global.wnd)
{
- com.synckolab.main.statusMsg.value = com.synckolab.global.strBundle.getString("getContent");
+ synckolab.main.statusMsg.value = synckolab.global.strBundle.getString("getContent");
}
else
{
- com.synckolab.main.statusMsg.setAttribute("label", com.synckolab.global.strBundle.getString("getContent"));
+ synckolab.main.statusMsg.setAttribute("label", synckolab.global.strBundle.getString("getContent"));
}
- com.synckolab.main.meter.setAttribute("value", "5%");
+ synckolab.main.meter.setAttribute("value", "5%");
};
/**
* this function is being called just before the content parsing starts
* its sole purpose is to make sure all messages/contacts are downloaded and refreshed
*/
-com.synckolab.main.prepareContent = function() {
+synckolab.main.prepareContent = function() {
// wait for the data (special case for calendar - they need a time to init)
- if (com.synckolab.main.gSync.dataReady() === false)
+ if (synckolab.main.gSync.dataReady() === false)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.prepareContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.prepareContent();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
// update folder information from imap and make sure we got everything
- com.synckolab.main.gConfig.folder.updateFolder(msgWindow);
+ synckolab.main.gConfig.folder.updateFolder(msgWindow);
// my UrlListener calls getContent
- com.synckolab.main.gConfig.folder.compact({
+ synckolab.main.gConfig.folder.compact({
OnStartRunningUrl: function ( url )
{
},
OnStopRunningUrl: function ( url, exitCode )
{
- com.synckolab.tools.logMessage("Finished folder frefresh; ONSTOP="+exitCode+" : " + url, com.synckolab.global.LOG_DEBUG );
- com.synckolab.main.getContent();
+ synckolab.tools.logMessage("Finished folder frefresh; ONSTOP="+exitCode+" : " + url, synckolab.global.LOG_DEBUG );
+ synckolab.main.getContent();
}
}, msgWindow); // this should take care of refreshes
};
-com.synckolab.main.syncKolabCompact = function() {
+synckolab.main.syncKolabCompact = function() {
// update folder and compact - this prevents event triggereing
- com.synckolab.main.gConfig.folder.updateFolder(msgWindow);
+ synckolab.main.gConfig.folder.updateFolder(msgWindow);
// compact folder
try {
- com.synckolab.main.gConfig.folder.compact(null, null);
+ synckolab.main.gConfig.folder.compact(null, null);
} catch(e) {
- com.synckolab.tools.logMessage("ERROR: Running compact: " + e, com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("ERROR: Running compact: " + e, synckolab.global.LOG_ERROR);
}
- com.synckolab.main.gSync.doneParsing();
- com.synckolab.tools.logMessage("nextSync", com.synckolab.global.LOG_INFO);
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.nextSync();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.gSync.doneParsing();
+ synckolab.tools.logMessage("nextSync", synckolab.global.LOG_INFO);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.nextSync();}}, synckolab.config.SWITCH_TIME, 0);
};
@@ -604,92 +603,92 @@ com.synckolab.main.syncKolabCompact = function() {
* start with the sync with the sync class
* saves the contact folder into fileContent
*/
-com.synckolab.main.getContent = function()
+synckolab.main.getContent = function()
{
// check if folder REALLY exists
- com.synckolab.main.gConfig.folder.clearNewMessages();
+ synckolab.main.gConfig.folder.clearNewMessages();
// get the number of messages to go through
- com.synckolab.main.totalMessages = com.synckolab.main.gConfig.folder.getTotalMessages(false);
- com.synckolab.tools.logMessage("Have to sync " + com.synckolab.main.totalMessages + " messages for the folder.", com.synckolab.global.LOG_INFO);
+ synckolab.main.totalMessages = synckolab.main.gConfig.folder.getTotalMessages(false);
+ synckolab.tools.logMessage("Have to sync " + synckolab.main.totalMessages + " messages for the folder.", synckolab.global.LOG_INFO);
// fix bug #16848 and ask before deleting everything :P
- if (com.synckolab.main.totalMessages === 0 && com.synckolab.main.gSync.itemCount() > 0)
+ if (synckolab.main.totalMessages === 0 && synckolab.main.gSync.itemCount() > 0)
{
- if (window.confirm(com.synckolab.global.strBundle.getString("syncCopyToServer"))) {
- com.synckolab.main.gSync.forceServerCopy = true;
+ if (window.confirm(synckolab.global.strBundle.getString("syncCopyToServer"))) {
+ synckolab.main.gSync.forceServerCopy = true;
}
}
- else if (com.synckolab.main.totalMessages > 0 && com.synckolab.main.gSync.itemCount() === 0)
+ else if (synckolab.main.totalMessages > 0 && synckolab.main.gSync.itemCount() === 0)
{
- if (window.confirm(com.synckolab.global.strBundle.getString("syncCopyToClient"))) {
- com.synckolab.main.gSync.forceLocalCopy = true;
+ if (window.confirm(synckolab.global.strBundle.getString("syncCopyToClient"))) {
+ synckolab.main.gSync.forceLocalCopy = true;
}
}
// prepare empty later list
- com.synckolab.main.gLaterMessages = {
+ synckolab.main.gLaterMessages = {
msgs: [],
pointer: 0
};
// get the message keys
- if (com.synckolab.main.gConfig.folder.getMessages) {
- com.synckolab.main.gMessages = com.synckolab.main.gConfig.folder.getMessages(null); // dont need the msgWindow use null
+ if (synckolab.main.gConfig.folder.getMessages) {
+ synckolab.main.gMessages = synckolab.main.gConfig.folder.getMessages(null); // dont need the msgWindow use null
} else {
- com.synckolab.main.gMessages = com.synckolab.main.gConfig.folder.messages; // tbird 3 uses an enumerator property instead of a function
+ synckolab.main.gMessages = synckolab.main.gConfig.folder.messages; // tbird 3 uses an enumerator property instead of a function
}
// get the message database (a file with uid:size:date:localfile)
- com.synckolab.main.syncMessageDb = new com.synckolab.dataBase(com.synckolab.main.gConfig.dbFile);
+ synckolab.main.syncMessageDb = new synckolab.dataBase(synckolab.main.gConfig.dbFile);
- com.synckolab.main.curMessage = 0;
- com.synckolab.main.updateMessages = []; // saves the the message url to delete
- com.synckolab.main.updateMessagesContent = []; // saves the card to use to update
+ synckolab.main.curMessage = 0;
+ synckolab.main.updateMessages = []; // saves the the message url to delete
+ synckolab.main.updateMessagesContent = []; // saves the card to use to update
- if (com.synckolab.global.wnd) {
- com.synckolab.main.statusMsg.value = com.synckolab.global.strBundle.getString("syncEntries");
+ if (synckolab.global.wnd) {
+ synckolab.main.statusMsg.value = synckolab.global.strBundle.getString("syncEntries");
} else {
- com.synckolab.main.statusMsg.setAttribute("label", com.synckolab.global.strBundle.getString("syncEntries"));
+ synckolab.main.statusMsg.setAttribute("label", synckolab.global.strBundle.getString("syncEntries"));
}
- com.synckolab.main.meter.setAttribute("value", "5%");
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.getMessage();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.meter.setAttribute("value", "5%");
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.getMessage();}}, synckolab.config.SWITCH_TIME, 0);
};
/**
* Get the current message into a string and then go to parseMessageRunner
*/
-com.synckolab.main.getMessage = function()
+synckolab.main.getMessage = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.getMessage();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.getMessage();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
var cur = null;
// still in first run...
- if(com.synckolab.main.gLaterMessages.pointer === 0) {
+ if(synckolab.main.gLaterMessages.pointer === 0) {
try
{
- if (com.synckolab.main.gMessages.hasMoreElements()) {
- cur = com.synckolab.main.gMessages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
+ if (synckolab.main.gMessages.hasMoreElements()) {
+ cur = synckolab.main.gMessages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
}
}
catch (ex)
{
- com.synckolab.tools.logMessage("skipping read of messages - since there are none :)", com.synckolab.global.LOG_INFO);
- com.synckolab.main.updateContentAfterSave();
+ synckolab.tools.logMessage("skipping read of messages - since there are none :)", synckolab.global.LOG_INFO);
+ synckolab.main.updateContentAfterSave();
return;
}
}
@@ -700,49 +699,49 @@ com.synckolab.main.getMessage = function()
if (!cur)
{
// done with the second run
- if (com.synckolab.main.gLaterMessages.pointer >= com.synckolab.main.gLaterMessages.msgs.length)
+ if (synckolab.main.gLaterMessages.pointer >= synckolab.main.gLaterMessages.msgs.length)
{
- com.synckolab.main.gLaterMessages.msgs = [];
+ synckolab.main.gLaterMessages.msgs = [];
// done with messages go on...
- com.synckolab.main.parseFolderToAddressFinish();
+ synckolab.main.parseFolderToAddressFinish();
return;
}
//process later message
- com.synckolab.tools.logMessage("second round process message: message " + com.synckolab.main.gLaterMessages.pointer + " of " + com.synckolab.main.gLaterMessages.msgs.length, com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("second round process message: message " + synckolab.main.gLaterMessages.pointer + " of " + synckolab.main.gLaterMessages.msgs.length, synckolab.global.LOG_INFO);
- laterMsg = com.synckolab.main.gLaterMessages.msgs[com.synckolab.main.gLaterMessages.pointer++];
+ laterMsg = synckolab.main.gLaterMessages.msgs[synckolab.main.gLaterMessages.pointer++];
cur = laterMsg.hdr;
}
else
{
// check message flags (based on mailnews\base\public\nsMsgMessageFlags.h -> deleted=0x200000
- com.synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " (dateInSeconds: " + cur.dateInSeconds + ") has flags: " + cur.flags + " flag imap_deleted? " + (cur.flags&0x200000), com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " (dateInSeconds: " + cur.dateInSeconds + ") has flags: " + cur.flags + " flag imap_deleted? " + (cur.flags&0x200000), synckolab.global.LOG_DEBUG);
var skipCMessage = false;
if (cur.flags&0x200000)
{
- com.synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " has been DELETED on imap!", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " has been DELETED on imap!", synckolab.global.LOG_INFO);
// skip current and process next nessage
skipCMessage = true;
}
if(!cur.mime2DecodedSubject || cur.mime2DecodedSubject.length < 3) {
- com.synckolab.tools.logMessage("Message '" + cur.mime2DecodedSubject + "' has an invalid subject!", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Message '" + cur.mime2DecodedSubject + "' has an invalid subject!", synckolab.global.LOG_INFO);
// skip current and process next nessage
skipCMessage = true;
}
// check if we can ignore this message because its too old (0=take all into accout)
- if(com.synckolab.main.gConfig.type !== "contact" && com.synckolab.main.gConfig.timeFrame && com.synckolab.main.gConfig.timeFrame > 0 && skipCMessage !== true)
+ if(synckolab.main.gConfig.type !== "contact" && synckolab.main.gConfig.timeFrame && synckolab.main.gConfig.timeFrame > 0 && skipCMessage !== true)
{
- com.synckolab.tools.logMessage("Checking if message might be too old for now " + (new Date()).getTime(), com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Checking if message might be too old for now " + (new Date()).getTime(), synckolab.global.LOG_DEBUG);
// now get the correct startdate (convert in milliseconds)
- if ((cur.dateInSeconds + (com.synckolab.main.gConfig.timeFrame * 86400))*1000 < (new Date()).getTime())
+ if ((cur.dateInSeconds + (synckolab.main.gConfig.timeFrame * 86400))*1000 < (new Date()).getTime())
{
- com.synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " will be ignored (too old) Now: " + (new Date()).getTime(), com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Message " + cur.mime2DecodedSubject + " will be ignored (too old) Now: " + (new Date()).getTime(), synckolab.global.LOG_INFO);
// skip current and process next nessage
skipCMessage = true;
}
@@ -750,23 +749,23 @@ com.synckolab.main.getMessage = function()
if (skipCMessage === true)
{
- com.synckolab.main.curMessage++;
- if (com.synckolab.main.curMessage <= com.synckolab.main.totalMessages)
+ synckolab.main.curMessage++;
+ if (synckolab.main.curMessage <= synckolab.main.totalMessages)
{
- var curpointer = 5 + (55*(com.synckolab.main.curMessage/com.synckolab.main.totalMessages));
- com.synckolab.main.meter.setAttribute("value", curpointer + "%");
- if (com.synckolab.global.wnd) {
- com.synckolab.main.curCounter.setAttribute("value", com.synckolab.main.curMessage + "/" + com.synckolab.main.totalMessages);
+ var curpointer = 5 + (55*(synckolab.main.curMessage/synckolab.main.totalMessages));
+ synckolab.main.meter.setAttribute("value", curpointer + "%");
+ if (synckolab.global.wnd) {
+ synckolab.main.curCounter.setAttribute("value", synckolab.main.curMessage + "/" + synckolab.main.totalMessages);
} else {
- com.synckolab.main.curCounter.setAttribute("label", com.synckolab.main.curMessage + "/" + com.synckolab.main.totalMessages);
+ synckolab.main.curCounter.setAttribute("label", synckolab.main.curMessage + "/" + synckolab.main.totalMessages);
}
// next message
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.getMessage();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.getMessage();}}, synckolab.config.SWITCH_TIME, 0);
}
else
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.parseFolderToAddressFinish();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.parseFolderToAddressFinish();}}, synckolab.config.SWITCH_TIME, 0);
}
return;
}
@@ -785,101 +784,101 @@ com.synckolab.main.getMessage = function()
cur.messageSize
cur.date (PRTime) ?
*/
- com.synckolab.main.gLastMessageDBHdr = cur;
- com.synckolab.tools.logMessage("checking for synckey in local db: " + com.synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject), com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.gSyncKeyInfo = com.synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject);
- com.synckolab.main.gSyncFileKey = com.synckolab.main.syncMessageDb.get(com.synckolab.main.gSyncKeyInfo);
+ synckolab.main.gLastMessageDBHdr = cur;
+ synckolab.tools.logMessage("checking for synckey in local db: " + synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject), synckolab.global.LOG_DEBUG);
+ synckolab.main.gSyncKeyInfo = synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject);
+ synckolab.main.gSyncFileKey = synckolab.main.syncMessageDb.get(synckolab.main.gSyncKeyInfo);
if (laterMsg) {
- com.synckolab.tools.logMessage("taking " + com.synckolab.main.gSyncKeyInfo + " from fist round...", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("taking " + synckolab.main.gSyncKeyInfo + " from fist round...", synckolab.global.LOG_DEBUG);
// get the message content into fileContent
// parseMessageRunner is called when we got the message
- com.synckolab.main.currentMessage = {
- message: com.synckolab.main.gConfig.folderMsgURI +"#"+cur.messageKey,
+ synckolab.main.currentMessage = {
+ message: synckolab.main.gConfig.folderMsgURI +"#"+cur.messageKey,
fileContent: laterMsg.content,
- nextFunc: com.synckolab.main.parseMessageRunner
+ nextFunc: synckolab.main.parseMessageRunner
};
- com.synckolab.main.gSyncFileKey = laterMsg.fileKey;
- com.synckolab.main.parseMessageRunner();
+ synckolab.main.gSyncFileKey = laterMsg.fileKey;
+ synckolab.main.parseMessageRunner();
return;
}
else {
- if (com.synckolab.main.gSyncFileKey)
+ if (synckolab.main.gSyncFileKey)
{
- com.synckolab.tools.logMessage("we have " + com.synckolab.main.gSyncKeyInfo + " already locally...", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("we have " + synckolab.main.gSyncKeyInfo + " already locally...", synckolab.global.LOG_DEBUG);
// check if the message has changed
- if (cur.messageSize === Number(com.synckolab.main.gSyncFileKey[1]) && cur.date === Number(com.synckolab.main.gSyncFileKey[2]))
+ if (cur.messageSize === Number(synckolab.main.gSyncFileKey[1]) && cur.date === Number(synckolab.main.gSyncFileKey[2]))
{
// get the content from the cached file and ignore the imap
- com.synckolab.tools.logMessage("taking content from: " + com.synckolab.main.gSyncFileKey[3] + "/" + com.synckolab.main.gSyncFileKey[4], com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("taking content from: " + synckolab.main.gSyncFileKey[3] + "/" + synckolab.main.gSyncFileKey[4], synckolab.global.LOG_DEBUG);
- var cachedFile = com.synckolab.tools.readSyncDBFile(com.synckolab.tools.file.getSyncDbFile(com.synckolab.main.gConfig, com.synckolab.main.gSyncFileKey[4]));
+ var cachedFile = synckolab.tools.readSyncDBFile(synckolab.tools.file.getSyncDbFile(synckolab.main.gConfig, synckolab.main.gSyncFileKey[4]));
// make sure we dont read an empty file
if (cachedFile && cachedFile !== "" && cachedFile.synckolab)
{
- com.synckolab.tools.logMessage("read cached file", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("read cached file", synckolab.global.LOG_DEBUG);
// parse the json
- com.synckolab.main.currentMessage = {
+ synckolab.main.currentMessage = {
fileContent: cachedFile
};
- com.synckolab.main.parseMessageRunner();
+ synckolab.main.parseMessageRunner();
return;
} else {
- com.synckolab.tools.logMessage("unable to read read cached file", com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.syncMessageDb.remove(com.synckolab.main.gSyncFileKey);
+ synckolab.tools.logMessage("unable to read read cached file", synckolab.global.LOG_DEBUG);
+ synckolab.main.syncMessageDb.remove(synckolab.main.gSyncFileKey);
// new netry
// remember the info
- com.synckolab.main.gSyncFileKey = {}; // we not yet know the id
- com.synckolab.main.gSyncFileKey[0] = '';
- com.synckolab.main.gSyncFileKey[1] = cur.messageSize;
- com.synckolab.main.gSyncFileKey[2] = cur.date;
+ synckolab.main.gSyncFileKey = {}; // we not yet know the id
+ synckolab.main.gSyncFileKey[0] = '';
+ synckolab.main.gSyncFileKey[1] = cur.messageSize;
+ synckolab.main.gSyncFileKey[2] = cur.date;
}
}
else
{
// some change happened... remove this entry (+ some update :P )
- com.synckolab.tools.logMessage("Cached message does not match - skipping cache read", com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.syncMessageDb.remove(com.synckolab.main.gSyncFileKey);
+ synckolab.tools.logMessage("Cached message does not match - skipping cache read", synckolab.global.LOG_DEBUG);
+ synckolab.main.syncMessageDb.remove(synckolab.main.gSyncFileKey);
// new netry
// remember the info
- com.synckolab.main.gSyncFileKey = {}; // we not yet know the id
- com.synckolab.main.gSyncFileKey[0] = '';
- com.synckolab.main.gSyncFileKey[1] = cur.messageSize;
- com.synckolab.main.gSyncFileKey[2] = cur.date;
+ synckolab.main.gSyncFileKey = {}; // we not yet know the id
+ synckolab.main.gSyncFileKey[0] = '';
+ synckolab.main.gSyncFileKey[1] = cur.messageSize;
+ synckolab.main.gSyncFileKey[2] = cur.date;
}
}
else
{
// remember the info
- com.synckolab.main.gSyncFileKey = {}; // we not yet know the id
- com.synckolab.main.gSyncFileKey[0] = '';
- com.synckolab.main.gSyncFileKey[1] = cur.messageSize;
- com.synckolab.main.gSyncFileKey[2] = cur.date;
+ synckolab.main.gSyncFileKey = {}; // we not yet know the id
+ synckolab.main.gSyncFileKey[0] = '';
+ synckolab.main.gSyncFileKey[1] = cur.messageSize;
+ synckolab.main.gSyncFileKey[2] = cur.date;
}
}
// get the message content into fileContent
// parseMessageRunner is called when we got the message
- com.synckolab.main.currentMessage = {
- message: com.synckolab.main.gConfig.folderMsgURI +"#"+cur.messageKey,
+ synckolab.main.currentMessage = {
+ message: synckolab.main.gConfig.folderMsgURI +"#"+cur.messageKey,
fileContent: "",
- nextFunc: com.synckolab.main.parseMessageRunner
+ nextFunc: synckolab.main.parseMessageRunner
};
- com.synckolab.main.getMessageIntoContent(com.synckolab.main.currentMessage);
+ synckolab.main.getMessageIntoContent(synckolab.main.currentMessage);
};
/**
*
* @param content the content structure contianing the message key and the buffer for the content
*/
-com.synckolab.main.getMessageIntoContent = function(content) {
+synckolab.main.getMessageIntoContent = function(content) {
var aurl = {};
- com.synckolab.global.messageService.CopyMessage(
+ synckolab.global.messageService.CopyMessage(
content.message,
/* nsIStreamListener */
{
@@ -898,15 +897,15 @@ com.synckolab.main.getMessageIntoContent = function(content) {
onStartRequest: function (request, context) {
},
onStopRequest: function (aRequest, aContext, aStatusCode) {
- com.synckolab.tools.logMessage("got Message [" + content.message + "]:\n" + content.fileContent, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("got Message [" + content.message + "]:\n" + content.fileContent, synckolab.global.LOG_DEBUG);
// remove the header of the content
- content.fileContent = com.synckolab.tools.stripMailHeader(content.fileContent);
+ content.fileContent = synckolab.tools.stripMailHeader(content.fileContent);
// make sure we dont come into an endless loop here
- com.synckolab.global.triggerRunning = true;
+ synckolab.global.triggerRunning = true;
content.nextFunc(content);
- com.synckolab.global.triggerRunning = false;
+ synckolab.global.triggerRunning = false;
}
}, false, null, msgWindow, aurl
);
@@ -919,7 +918,7 @@ com.synckolab.main.getMessageIntoContent = function(content) {
* fileName string - the file to copy(+path)
* folderUri string - the Uri/Url of the folder we want this in
*/
-com.synckolab.main.copyToFolder = function(fileName, folderUri, listener)
+synckolab.main.copyToFolder = function(fileName, folderUri, listener)
{
var mailFolder = folderUri;
var fileSpec;
@@ -955,145 +954,145 @@ com.synckolab.main.copyToFolder = function(fileName, folderUri, listener)
/**
* we now got the message content. this needs to parsed and checked
*/
-com.synckolab.main.parseMessageRunner = function()
+synckolab.main.parseMessageRunner = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.parseMessageRunner();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.parseMessageRunner();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
var skcontent = null;
// unparsable message... content is null and so it will skip
- if(com.synckolab.main.currentMessage && com.synckolab.main.currentMessage.fileContent) {
- com.synckolab.tools.logMessage("parsing message... ", com.synckolab.global.LOG_DEBUG);
+ if(synckolab.main.currentMessage && synckolab.main.currentMessage.fileContent) {
+ synckolab.tools.logMessage("parsing message... ", synckolab.global.LOG_DEBUG);
// fix the message for line truncs (last char in line is =)
// content might be a preparsed json
- if(!com.synckolab.main.currentMessage.fileContent.synckolab) {
- com.synckolab.main.currentMessage.fileContent = com.synckolab.main.currentMessage.fileContent.replace(/\=\n(\S)/g, "$1");
+ if(!synckolab.main.currentMessage.fileContent.synckolab) {
+ synckolab.main.currentMessage.fileContent = synckolab.main.currentMessage.fileContent.replace(/\=\n(\S)/g, "$1");
}
- skcontent = com.synckolab.main.gSync.parseMessage(com.synckolab.main.currentMessage.fileContent, com.synckolab.main.updateMessagesContent, (com.synckolab.main.gLaterMessages.pointer === 0));
+ skcontent = synckolab.main.gSync.parseMessage(synckolab.main.currentMessage.fileContent, synckolab.main.updateMessagesContent, (synckolab.main.gLaterMessages.pointer === 0));
}
if (skcontent === "LATER") {
- com.synckolab.tools.logMessage("keeping message for later (possible a mailing list): #" + com.synckolab.main.gLaterMessages.msgs.length, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("keeping message for later (possible a mailing list): #" + synckolab.main.gLaterMessages.msgs.length, synckolab.global.LOG_DEBUG);
var cMsg = {};
- cMsg.content = com.synckolab.main.currentMessage.fileContent;
- cMsg.hdr = com.synckolab.main.gLastMessageDBHdr;
- cMsg.fileKey = com.synckolab.main.gSyncFileKey;
- com.synckolab.main.gLaterMessages.msgs.push(cMsg);
+ cMsg.content = synckolab.main.currentMessage.fileContent;
+ cMsg.hdr = synckolab.main.gLastMessageDBHdr;
+ cMsg.fileKey = synckolab.main.gSyncFileKey;
+ synckolab.main.gLaterMessages.msgs.push(cMsg);
}
else {
// just to make sure there REALLY isnt any content left :)
- com.synckolab.main.currentMessage.fileContent = null;
+ synckolab.main.currentMessage.fileContent = null;
if (skcontent)
{
if (skcontent === "DELETEME") {
- com.synckolab.tools.logMessage("deleting [" + com.synckolab.main.currentMessage.message + "]", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("deleting [" + synckolab.main.currentMessage.message + "]", synckolab.global.LOG_INFO);
} else {
- com.synckolab.tools.logMessage("updating [" + com.synckolab.main.currentMessage.message + "]", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("updating [" + synckolab.main.currentMessage.message + "]", synckolab.global.LOG_INFO);
}
- // adding message to list of to-delete messages - com.synckolab.main.gConfig.folderMsgURI +"#"+
- com.synckolab.main.updateMessages.push(com.synckolab.main.gLastMessageDBHdr);
- com.synckolab.main.updateMessagesContent.push(skcontent);
- com.synckolab.tools.logMessage("changed msg #" + com.synckolab.main.updateMessages.length, com.synckolab.global.LOG_INFO);
+ // adding message to list of to-delete messages - synckolab.main.gConfig.folderMsgURI +"#"+
+ synckolab.main.updateMessages.push(synckolab.main.gLastMessageDBHdr);
+ synckolab.main.updateMessagesContent.push(skcontent);
+ synckolab.tools.logMessage("changed msg #" + synckolab.main.updateMessages.length, synckolab.global.LOG_INFO);
}
// no change... remember that :)
else
{
// fill info about the file and re-add it
- com.synckolab.main.gSyncFileKey[0] = com.synckolab.main.gSyncKeyInfo;
- com.synckolab.main.gSyncFileKey[3] = com.synckolab.main.gSync.gConfig.name;
- com.synckolab.main.gSyncFileKey[4] = com.synckolab.main.gSyncKeyInfo; //gSync.gCurUID;
+ synckolab.main.gSyncFileKey[0] = synckolab.main.gSyncKeyInfo;
+ synckolab.main.gSyncFileKey[3] = synckolab.main.gSync.gConfig.name;
+ synckolab.main.gSyncFileKey[4] = synckolab.main.gSyncKeyInfo; //gSync.gCurUID;
// Add the key
- com.synckolab.main.syncMessageDb.add(com.synckolab.main.gSyncFileKey);
+ synckolab.main.syncMessageDb.add(synckolab.main.gSyncFileKey);
}
}
// process next nessage
- com.synckolab.main.curMessage++;
- if (com.synckolab.main.curMessage <= com.synckolab.main.totalMessages || com.synckolab.main.gLaterMessages.pointer < com.synckolab.main.gLaterMessages.msgs.length)
+ synckolab.main.curMessage++;
+ if (synckolab.main.curMessage <= synckolab.main.totalMessages || synckolab.main.gLaterMessages.pointer < synckolab.main.gLaterMessages.msgs.length)
{
- var curpointer = 5 + (55*((com.synckolab.main.curMessage + com.synckolab.main.gLaterMessages.pointer)/(com.synckolab.main.totalMessages + com.synckolab.main.gLaterMessages.msgs.length)));
- com.synckolab.main.meter.setAttribute("value", curpointer + "%");
+ var curpointer = 5 + (55*((synckolab.main.curMessage + synckolab.main.gLaterMessages.pointer)/(synckolab.main.totalMessages + synckolab.main.gLaterMessages.msgs.length)));
+ synckolab.main.meter.setAttribute("value", curpointer + "%");
- com.synckolab.main.curCounter.setAttribute((com.synckolab.global.wnd)?"value":"label", (com.synckolab.main.curMessage + com.synckolab.main.gLaterMessages.pointer) + "/" + (com.synckolab.main.totalMessages + com.synckolab.main.gLaterMessages.msgs.length));
+ synckolab.main.curCounter.setAttribute((synckolab.global.wnd)?"value":"label", (synckolab.main.curMessage + synckolab.main.gLaterMessages.pointer) + "/" + (synckolab.main.totalMessages + synckolab.main.gLaterMessages.msgs.length));
- if (com.synckolab.main.curMessage%20 === 0)
+ if (synckolab.main.curMessage%20 === 0)
{
// save the sync db file every 20 messages.. should speed up sync if canceled
- com.synckolab.tools.logMessage("Writing message snyc-db", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Writing message snyc-db", synckolab.global.LOG_DEBUG);
// write the db file back
- com.synckolab.main.syncMessageDb.write();
+ synckolab.main.syncMessageDb.write();
}
// next message
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.getMessage();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.getMessage();}}, synckolab.config.SWITCH_TIME, 0);
}
else
{
- com.synckolab.tools.logMessage("Done parsing " + (com.synckolab.main.totalMessages+com.synckolab.main.gLaterMessages.msgs.length), com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.parseFolderToAddressFinish();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.tools.logMessage("Done parsing " + (synckolab.main.totalMessages+synckolab.main.gLaterMessages.msgs.length), synckolab.global.LOG_DEBUG);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.parseFolderToAddressFinish();}}, synckolab.config.SWITCH_TIME, 0);
}
};
//Step 6 10%
//write everything thats not yet in the message folder but is in the local db
-com.synckolab.main.writeContent = function()
+synckolab.main.writeContent = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.writeContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.writeContent();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
// if there happens an exception, we are done
- var skcontent = com.synckolab.main.gSync.nextUpdate();
+ var skcontent = synckolab.main.gSync.nextUpdate();
if (skcontent === "done")
{
- com.synckolab.tools.logMessage("content is 'done'", com.synckolab.global.LOG_INFO);
- com.synckolab.main.writeContentAfterSave();
+ synckolab.tools.logMessage("content is 'done'", synckolab.global.LOG_INFO);
+ synckolab.main.writeContentAfterSave();
return;
}
if (skcontent === null)
{
- com.synckolab.tools.logMessage("content is null - continue", com.synckolab.global.LOG_WARNING);
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.writeContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.tools.logMessage("content is null - continue", synckolab.global.LOG_WARNING);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.writeContent();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.main.gConfig.saveToImap)
+ if (synckolab.main.gConfig.saveToImap)
{
// write the temp file back to the original directory
- com.synckolab.tools.logMessage("WriteContent Writing...", com.synckolab.global.LOG_INFO);
- com.synckolab.main.writeImapMessage(skcontent, com.synckolab.main.gConfig, com.synckolab.main.kolabCopyServiceListener);
+ synckolab.tools.logMessage("WriteContent Writing...", synckolab.global.LOG_INFO);
+ synckolab.main.writeImapMessage(skcontent, synckolab.main.gConfig, synckolab.main.kolabCopyServiceListener);
}
else {
- com.synckolab.tools.logMessage("Skipping write to imap because of read only config...", com.synckolab.global.LOG_INFO);
- com.synckolab.main.writeContentAfterSave();
+ synckolab.tools.logMessage("Skipping write to imap because of read only config...", synckolab.global.LOG_INFO);
+ synckolab.main.writeContentAfterSave();
}
};
-com.synckolab.main.kolabCopyServiceListener = {
+synckolab.main.kolabCopyServiceListener = {
OnProgress: function (progress, progressMax) {
},
OnStartCopy: function () {
@@ -1101,11 +1100,11 @@ com.synckolab.main.kolabCopyServiceListener = {
SetMessageKey: function (key) {
},
OnStopCopy: function (status) {
- if (com.synckolab.main.curStep === 5) {
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.updateContentWrite();}}, com.synckolab.config.SWITCH_TIME, 0);
+ if (synckolab.main.curStep === 5) {
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.updateContentWrite();}}, synckolab.config.SWITCH_TIME, 0);
}
- if (com.synckolab.main.curStep === 6) {
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.writeContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ if (synckolab.main.curStep === 6) {
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.writeContent();}}, synckolab.config.SWITCH_TIME, 0);
}
}
};
@@ -1116,17 +1115,17 @@ com.synckolab.main.kolabCopyServiceListener = {
* @param config the config to use (for the correct folder)
* @param listener this is a callback that is used when the copy has been finished/failed
*/
-com.synckolab.main.writeImapMessage = function(skcontent, config, listener) {
+synckolab.main.writeImapMessage = function(skcontent, config, listener) {
// get temp file (might not yet be initialized)
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
file.append("syncKolab.tmp");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 600);
- com.synckolab.main.gTmpFile = file.path;
+ synckolab.main.gTmpFile = file.path;
// write the message in the temp file
var sfile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
// temp path
- sfile.initWithPath(com.synckolab.main.gTmpFile);
+ sfile.initWithPath(synckolab.main.gTmpFile);
if (sfile.exists()) {
sfile.remove(true);
}
@@ -1141,190 +1140,190 @@ com.synckolab.main.writeImapMessage = function(skcontent, config, listener) {
stream.write(skcontent, skcontent.length);
stream.close();
- com.synckolab.tools.logMessage("Copy Message to Folder", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Copy Message to Folder", synckolab.global.LOG_DEBUG);
- com.synckolab.main.copyToFolder(com.synckolab.main.gTmpFile, config.folder, listener);
+ synckolab.main.copyToFolder(synckolab.main.gTmpFile, config.folder, listener);
};
//done this time
-com.synckolab.main.writeContentAfterSave = function()
+synckolab.main.writeContentAfterSave = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.writeContentAfterSave();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.writeContentAfterSave();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
- com.synckolab.tools.logMessage("Setting all messages to read...", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Setting all messages to read...", synckolab.global.LOG_INFO);
// before done, set all unread messages to read in the sync folder
- com.synckolab.main.gMessages = com.synckolab.main.gConfig.folder.messages; // tbird 3 uses an enumerator property instead of a function
+ synckolab.main.gMessages = synckolab.main.gConfig.folder.messages; // tbird 3 uses an enumerator property instead of a function
- while (com.synckolab.main.gMessages.hasMoreElements())
+ while (synckolab.main.gMessages.hasMoreElements())
{
- var cur = com.synckolab.main.gMessages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
+ var cur = synckolab.main.gMessages.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
if (!cur.isRead)
{
cur.markRead(true);
}
}
- com.synckolab.main.gMessages = null;
+ synckolab.main.gMessages = null;
- com.synckolab.tools.logMessage("Running compact", com.synckolab.global.LOG_INFO);
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.syncKolabCompact();}}, 2000, 0); // wait for a second or two
+ synckolab.tools.logMessage("Running compact", synckolab.global.LOG_INFO);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.syncKolabCompact();}}, 2000, 0); // wait for a second or two
};
-com.synckolab.main.parseFolderToAddressFinish = function()
+synckolab.main.parseFolderToAddressFinish = function()
{
// do step 5
- com.synckolab.main.curStep = 5;
- com.synckolab.main.writeDone = false;
- com.synckolab.tools.logMessage("parseFolderToAddressFinish (Writing message db)", com.synckolab.global.LOG_DEBUG);
+ synckolab.main.curStep = 5;
+ synckolab.main.writeDone = false;
+ synckolab.tools.logMessage("parseFolderToAddressFinish (Writing message db)", synckolab.global.LOG_DEBUG);
// write the db file back
- com.synckolab.main.syncMessageDb.write();
+ synckolab.main.syncMessageDb.write();
- com.synckolab.main.meter.setAttribute("value", "60%");
- if (com.synckolab.global.wnd)
+ synckolab.main.meter.setAttribute("value", "60%");
+ if (synckolab.global.wnd)
{
- com.synckolab.main.statusMsg.value = com.synckolab.global.strBundle.getString("writeChangedEntries");
- com.synckolab.main.curCounter.setAttribute("value", "0/0");
+ synckolab.main.statusMsg.value = synckolab.global.strBundle.getString("writeChangedEntries");
+ synckolab.main.curCounter.setAttribute("value", "0/0");
}
else
{
- com.synckolab.main.statusMsg.setAttribute("label", com.synckolab.global.strBundle.getString("writeChangedEntries"));
- com.synckolab.main.curCounter.setAttribute("label", "0/0");
+ synckolab.main.statusMsg.setAttribute("label", synckolab.global.strBundle.getString("writeChangedEntries"));
+ synckolab.main.curCounter.setAttribute("label", "0/0");
}
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.updateContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.updateContent();}}, synckolab.config.SWITCH_TIME, 0);
};
/* Remove all messages which needs to be updated or deleted.
* The replacement messages are created in updateContentWrite().
*/
-com.synckolab.main.updateContent = function()
+synckolab.main.updateContent = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.updateContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.updateContent();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
- com.synckolab.tools.logMessage("updating content:", com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("updating content:", synckolab.global.LOG_DEBUG);
var i;
// first lets delete the old messages
- if (com.synckolab.main.gConfig.saveToImap && com.synckolab.main.updateMessages.length > 0)
+ if (synckolab.main.gConfig.saveToImap && synckolab.main.updateMessages.length > 0)
{
try
{
- com.synckolab.tools.logMessage("deleting changed messages..", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("deleting changed messages..", synckolab.global.LOG_INFO);
var list = null;
// use mutablearray
list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
- for (i = 0; i < com.synckolab.main.updateMessages.length; i++)
+ for (i = 0; i < synckolab.main.updateMessages.length; i++)
{
- com.synckolab.tools.logMessage("deleting [" + com.synckolab.main.updateMessages[i] + "]");
- //var hdr = com.synckolab.global.messageService.messageURIToMsgHdr(com.synckolab.main.updateMessages[i]);
- list.appendElement(com.synckolab.main.updateMessages[i], false);
+ synckolab.tools.logMessage("deleting [" + synckolab.main.updateMessages[i] + "]");
+ //var hdr = synckolab.global.messageService.messageURIToMsgHdr(synckolab.main.updateMessages[i]);
+ list.appendElement(synckolab.main.updateMessages[i], false);
}
- com.synckolab.main.gConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
+ synckolab.main.gConfig.folder.deleteMessages(list, msgWindow, true, false, null, true);
}
catch (ex)
{
- com.synckolab.tools.logMessage("Exception while deleting - skipping: " + ex, com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Exception while deleting - skipping: " + ex, synckolab.global.LOG_ERROR);
}
}
- com.synckolab.main.curMessage = -1;
+ synckolab.main.curMessage = -1;
// now write the new ones
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.updateContentWrite();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.updateContentWrite();}}, synckolab.config.SWITCH_TIME, 0);
};
/* Write all changed messages back to the folder. Skip
* the messages which were to be deleted from the server.
*/
-com.synckolab.main.updateContentWrite = function()
+synckolab.main.updateContentWrite = function()
{
// pause sync...
- if (com.synckolab.global.wnd && com.synckolab.global.wnd.gPauseSync)
+ if (synckolab.global.wnd && synckolab.global.wnd.gPauseSync)
{
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.updateContentWrite();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.updateContentWrite();}}, synckolab.config.SWITCH_TIME, 0);
return;
}
- if (com.synckolab.global.wnd && (com.synckolab.global.wnd.document === null || com.synckolab.global.wnd.gStopSync === true))
+ if (synckolab.global.wnd && (synckolab.global.wnd.document === null || synckolab.global.wnd.gStopSync === true))
{
alert("Stopped SyncKolab...");
- com.synckolab.global.running = false;
+ synckolab.global.running = false;
return;
}
- com.synckolab.main.curCounter.setAttribute("value", com.synckolab.main.curMessage + "/" + com.synckolab.main.updateMessagesContent.length);
+ synckolab.main.curCounter.setAttribute("value", synckolab.main.curMessage + "/" + synckolab.main.updateMessagesContent.length);
- com.synckolab.main.curMessage++;
- if (com.synckolab.main.curMessage < com.synckolab.main.updateMessagesContent.length)
+ synckolab.main.curMessage++;
+ if (synckolab.main.curMessage < synckolab.main.updateMessagesContent.length)
{
- var skcontent = com.synckolab.main.updateMessagesContent[com.synckolab.main.curMessage];
+ var skcontent = synckolab.main.updateMessagesContent[synckolab.main.curMessage];
// write the message
- if (com.synckolab.main.gConfig.saveToImap && skcontent !== "DELETEME" && skcontent!== null && skcontent.length > 1)
+ if (synckolab.main.gConfig.saveToImap && skcontent !== "DELETEME" && skcontent!== null && skcontent.length > 1)
{
- com.synckolab.tools.logMessage("adding [" + skcontent + "] to messages", com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.writeImapMessage(skcontent, com.synckolab.main.gConfig, com.synckolab.main.kolabCopyServiceListener);
+ synckolab.tools.logMessage("adding [" + skcontent + "] to messages", synckolab.global.LOG_DEBUG);
+ synckolab.main.writeImapMessage(skcontent, synckolab.main.gConfig, synckolab.main.kolabCopyServiceListener);
}
else {
- com.synckolab.main.updateContentWrite();
+ synckolab.main.updateContentWrite();
}
}
else {
- com.synckolab.main.updateContentAfterSave();
+ synckolab.main.updateContentAfterSave();
}
};
-com.synckolab.main.updateContentAfterSave =function ()
+synckolab.main.updateContentAfterSave =function ()
{
- com.synckolab.tools.logMessage("starting update content...", com.synckolab.global.LOG_INFO);
- com.synckolab.main.curStep = 6;
- com.synckolab.main.writeDone = false;
+ synckolab.tools.logMessage("starting update content...", synckolab.global.LOG_INFO);
+ synckolab.main.curStep = 6;
+ synckolab.main.writeDone = false;
- if (!com.synckolab.main.gSync.initUpdate())
+ if (!synckolab.main.gSync.initUpdate())
{
- com.synckolab.tools.logMessage("Nothing there to update...", com.synckolab.global.LOG_INFO);
- com.synckolab.main.writeContentAfterSave();
+ synckolab.tools.logMessage("Nothing there to update...", synckolab.global.LOG_INFO);
+ synckolab.main.writeContentAfterSave();
}
- com.synckolab.main.meter.setAttribute("value", "80%");
- if (com.synckolab.global.wnd)
+ synckolab.main.meter.setAttribute("value", "80%");
+ if (synckolab.global.wnd)
{
- com.synckolab.main.statusMsg.value = com.synckolab.global.strBundle.getString("writeNewEntries");
- com.synckolab.main.curCounter.setAttribute("value", "...");
+ synckolab.main.statusMsg.value = synckolab.global.strBundle.getString("writeNewEntries");
+ synckolab.main.curCounter.setAttribute("value", "...");
}
else
{
- com.synckolab.main.statusMsg.setAttribute("label", com.synckolab.global.strBundle.getString("writeNewEntries"));
- com.synckolab.main.curCounter.setAttribute("label", "...");
+ synckolab.main.statusMsg.setAttribute("label", synckolab.global.strBundle.getString("writeNewEntries"));
+ synckolab.main.curCounter.setAttribute("label", "...");
}
- com.synckolab.main.timer.initWithCallback({notify:function (){com.synckolab.main.writeContent();}}, com.synckolab.config.SWITCH_TIME, 0);
+ synckolab.main.timer.initWithCallback({notify:function (){synckolab.main.writeContent();}}, synckolab.config.SWITCH_TIME, 0);
};
diff --git a/src/chrome/content/synckolab/tools.js b/src/chrome/content/synckolab/tools.js
index 676972f..bbcfbb3 100644
--- a/src/chrome/content/synckolab/tools.js
+++ b/src/chrome/content/synckolab/tools.js
@@ -32,9 +32,7 @@
//////////////////////////////////HELP FUNCTIONS /////////////////////////////////////////
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
-if(!com.synckolab.tools) com.synckolab.tools={};
+if(!synckolab) var synckolab={};
try {
Components.utils.import("resource://calendar/modules/calUtils.jsm");
@@ -43,7 +41,7 @@ try {
// ignore exception if lightning is not installed
}
-com.synckolab.tools = {
+synckolab.tools = {
logStart: -1,
lastmsg: -1,
@@ -54,11 +52,11 @@ com.synckolab.tools = {
*/
logMessage: function (msg, level) {
if (!level) {
- level = com.synckolab.global.LOG_INFO;
+ level = synckolab.global.LOG_INFO;
}
- var infolvl = com.synckolab.config.DEBUG_SYNCKOLAB_LEVEL%4;
- var infostate = com.synckolab.config.DEBUG_SYNCKOLAB_LEVEL - infolvl;
+ var infolvl = synckolab.config.DEBUG_SYNCKOLAB_LEVEL%4;
+ var infostate = synckolab.config.DEBUG_SYNCKOLAB_LEVEL - infolvl;
var clvl = level%4;
var cstate = level - clvl;
@@ -69,14 +67,14 @@ logMessage: function (msg, level) {
// now lets see if we want the same type of error NORMAL|CALENDAR|ADRESSBOOK|ALL
- // if the two states are diffeent and infostate !== com.synckolab.global.LOG_ALL we want outta here
- if (infostate !== cstate && infostate !== com.synckolab.global.LOG_ALL) {
+ // if the two states are diffeent and infostate !== synckolab.global.LOG_ALL we want outta here
+ if (infostate !== cstate && infostate !== synckolab.global.LOG_ALL) {
return;
}
- if (com.synckolab.config.DEBUG_SYNCKOLAB || clvl === com.synckolab.global.LOG_ERROR)
+ if (synckolab.config.DEBUG_SYNCKOLAB || clvl === synckolab.global.LOG_ERROR)
{
- if (com.synckolab.config.PERFLOG_SYNCKOLAB === true)
+ if (synckolab.config.PERFLOG_SYNCKOLAB === true)
{
if (this.logStart === -1)
{
@@ -91,30 +89,30 @@ logMessage: function (msg, level) {
}
}
// report errors as error
- if (clvl === com.synckolab.global.LOG_ERROR && Components.utils.reportError) {
+ if (clvl === synckolab.global.LOG_ERROR && Components.utils.reportError) {
var err = new Error("" + msg);
Components.utils.reportError("" + msg + err.stack);
} else
- if (clvl === com.synckolab.global.LOG_ERROR) {
- com.synckolab.global.consoleService.logStringMessage("" + msg + new Error("" + msg).stack);
+ if (clvl === synckolab.global.LOG_ERROR) {
+ synckolab.global.consoleService.logStringMessage("" + msg + new Error("" + msg).stack);
} else {
- com.synckolab.global.consoleService.logStringMessage(msg);
+ synckolab.global.consoleService.logStringMessage(msg);
}
}
// pause the sync on error if defined by globals
- if (com.synckolab.config.PAUSE_ON_ERROR && clvl === com.synckolab.global.LOG_ERROR) {
+ if (synckolab.config.PAUSE_ON_ERROR && clvl === synckolab.global.LOG_ERROR) {
// TODO this will NOT work...
- if (typeof com.synckolab !== "undefined" && com.synckolab.global.wnd && com.synckolab.global.wnd.pauseSync) {
- com.synckolab.global.wnd.pauseSync();
+ if (typeof synckolab !== "undefined" && synckolab.global.wnd && synckolab.global.wnd.pauseSync) {
+ synckolab.global.wnd.pauseSync();
}
}
},
scrollToBottom : function (itemList)
{
- if (!itemList && com.synckolab.global.wnd && com.synckolab.global.document) {
- itemList = com.synckolab.global.wnd.document.getElementById('itemList');
+ if (!itemList && synckolab.global.wnd && synckolab.global.document) {
+ itemList = synckolab.global.wnd.document.getElementById('itemList');
}
if (itemList)
{
@@ -124,6 +122,10 @@ scrollToBottom : function (itemList)
}
},
+parseXml: function(content) {
+ var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].getService(Components.interfaces.nsIDOMParser);
+ return parser.parseFromString(content, "text/xml");
+},
/**
* Return a boolean value telling whether
@@ -176,24 +178,24 @@ equalsObject: function(a, b)
var p;
for(p in a) {
- if(p !== "synckolab" && typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "") {
+ if(p !== "ts" && p !== "sha1" && p !== "synckolab" && typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "") {
// 0 == undefined
if((a[p] === "0" || a[p] === 0) && !b[p])
{
continue;
}
- com.synckolab.tools.logMessage("not equals: " + p + " a: " + a[p] + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("not equals: " + p + " a: " + a[p] + " b: " + b[p], synckolab.global.LOG_DEBUG);
return false;
}
}
for(p in a) {
- if (p !== "synckolab") {
+ if (p !== "ts" && p !== "sha1" && p !== "synckolab") {
if (a[p]) {
switch(typeof(a[p])) {
case 'object':
if (!this.equalsObject(a[p], b[p])) {
- com.synckolab.tools.logMessage("not equals: " + p + " a: " + a[p] + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("not equals: " + p + " a: " + a[p] + " b: " + b[p], synckolab.global.LOG_DEBUG);
return false;
}
break;
@@ -201,13 +203,13 @@ equalsObject: function(a, b)
break;
default:
if (a[p] !== b[p] && Number(a[p]) !== Number(b[p])) {
- com.synckolab.tools.logMessage("not equals: : " + p + " a: " + a[p] + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("not equals: : " + p + " a: " + a[p] + " b: " + b[p], synckolab.global.LOG_DEBUG);
return false;
}
}
} else {
if (b[p]) {
- com.synckolab.tools.logMessage("not equals: " + p + " a: not found b: " + b[p], com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("not equals: " + p + " a: not found b: " + b[p], synckolab.global.LOG_DEBUG);
return false;
}
}
@@ -215,8 +217,8 @@ equalsObject: function(a, b)
}
for(p in b) {
- if(p !== "synckolab" && p !== "type" && (!a || typeof(a[p]) === 'undefined') && b[p] !== null && b[p] !== "") {
- com.synckolab.tools.logMessage("not equals: " + p + " a: " + (a?a[p]:'is null') + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
+ if(p !== "ts" && p !== "sha1" && p !== "synckolab" && p !== "type" && (!a || typeof(a[p]) === 'undefined') && b[p] !== null && b[p] !== "") {
+ synckolab.tools.logMessage("not equals: " + p + " a: " + (a?a[p]:'is null') + " b: " + b[p], synckolab.global.LOG_DEBUG);
return false;
}
}
@@ -250,20 +252,20 @@ stripMailHeader: function (skcontent) {
}
isQP = skcontent.search(/Content-Transfer-Encoding:[ \t\r\n]+quoted-printable/i);
- this.logMessage("Stripping header from Message (QP=" + isQP + ")", com.synckolab.global.LOG_DEBUG);
+ this.logMessage("Stripping header from Message (QP=" + isQP + ")", synckolab.global.LOG_DEBUG);
if(isQP !== -1 || skcontent.indexOf("=3D") !== -1)
{
- skcontent = com.synckolab.tools.text.quoted.decode(skcontent.substring(startPos, skcontent.length));
- this.logMessage("unquoted content: " + skcontent, com.synckolab.global.LOG_DEBUG);
+ skcontent = synckolab.tools.text.quoted.decode(skcontent.substring(startPos, skcontent.length));
+ this.logMessage("unquoted content: " + skcontent, synckolab.global.LOG_DEBUG);
} else {
skcontent = skcontent.substring(startPos, skcontent.length);
}
- return com.synckolab.tools.text.trim(skcontent);
+ return synckolab.tools.text.trim(skcontent);
}
- this.logMessage("Stripping header from multipart message", com.synckolab.global.LOG_DEBUG);
+ this.logMessage("Stripping header from multipart message", synckolab.global.LOG_DEBUG);
// we got a multipart message - strip it apart
@@ -272,7 +274,7 @@ stripMailHeader: function (skcontent) {
boundary = skcontent.substring(skcontent.search(/boundary=/)+9);
// lets trim boundary (in case we have whitespace after the =
- boundary = com.synckolab.tools.text.trim(boundary);
+ boundary = synckolab.tools.text.trim(boundary);
// if the boundary string starts with "... we look for an end
if (boundary.charAt(0) === '"')
@@ -339,7 +341,7 @@ stripMailHeader: function (skcontent) {
}
catch (ex) {
// still continue
- this.logMessage("Error while handling image: " + ex + "\nStream:\n" + imgC, com.synckolab.global.LOG_INFO);
+ this.logMessage("Error while handling image: " + ex + "\nStream:\n" + imgC, synckolab.global.LOG_INFO);
}
fileIO.close();
@@ -405,7 +407,7 @@ stripMailHeader: function (skcontent) {
if (isBase64 !== -1)
{
- this.logMessage("Base64 Decoding message. (Boundary: "+boundary+")", com.synckolab.global.LOG_INFO);
+ this.logMessage("Base64 Decoding message. (Boundary: "+boundary+")", synckolab.global.LOG_INFO);
// get rid of the header
skcontent = skcontent.substring(isBase64, skcontent.length);
startPos = skcontent.indexOf("\r\n\r\n");
@@ -422,7 +424,7 @@ stripMailHeader: function (skcontent) {
skcontent = skcontent.substring(startPos, endPos).replace(/[\r\n \t]+/g, "");
- this.logMessage("Base64 message: " + skcontent, com.synckolab.global.LOG_DEBUG);
+ this.logMessage("Base64 message: " + skcontent, synckolab.global.LOG_DEBUG);
// for base64 we use a two storied approach
// first: use atob
@@ -434,13 +436,13 @@ stripMailHeader: function (skcontent) {
// out of memory error... this can be handled :)
if (e.result === Components.results.NS_ERROR_OUT_OF_MEMORY)
{
- skcontent = com.synckolab.text.base64.decode(skcontent);
- this.logMessage("decoded base64: " + skcontent, com.synckolab.global.LOG_DEBUG);
+ skcontent = synckolab.text.base64.decode(skcontent);
+ this.logMessage("decoded base64: " + skcontent, synckolab.global.LOG_DEBUG);
}
else
{
- this.logMessage("Error decoding base64 (" + e + "): " + skcontent, com.synckolab.global.LOG_ERROR);
+ this.logMessage("Error decoding base64 (" + e + "): " + skcontent, synckolab.global.LOG_ERROR);
return null;
}
}
@@ -451,7 +453,7 @@ stripMailHeader: function (skcontent) {
if (isQP !== -1)
{
skcontent = skcontent.substring(isQP, skcontent.length);
- skcontent = com.synckolab.tools.text.quoted.decode(skcontent);
+ skcontent = synckolab.tools.text.quoted.decode(skcontent);
}
@@ -459,7 +461,7 @@ stripMailHeader: function (skcontent) {
if (isQP === -1 && isBase64 === -1)
{
// so this message has no <xml>something</xml> area
- this.logMessage("Error parsing this message: no xml segment found\n" + skcontent, com.synckolab.global.LOG_ERROR);
+ this.logMessage("Error parsing this message: no xml segment found\n" + skcontent, synckolab.global.LOG_ERROR);
return null;
}
@@ -487,11 +489,11 @@ stripMailHeader: function (skcontent) {
// check if we have to decode quoted printable
if (skcontent.indexOf(" version=3D") !== -1 || skcontent.indexOf("TZID=3D")) // we know from the version (or in case of citadel from the tzid)
{
- this.logMessage("Message is quoted", com.synckolab.global.LOG_INFO);
- skcontent = com.synckolab.tools.text.quoted.decode(skcontent);
+ this.logMessage("Message is quoted", synckolab.global.LOG_INFO);
+ skcontent = synckolab.tools.text.quoted.decode(skcontent);
}
- return com.synckolab.tools.text.trim(skcontent);
+ return synckolab.tools.text.trim(skcontent);
},
/**
@@ -512,12 +514,12 @@ generateMail: function (cid, mail, adsubject, mime, part, skcontent, hr, image){
}
var msg = "";
- var bound = com.synckolab.tools.text.randomVcardId();
+ var bound = synckolab.tools.text.randomVcardId();
var cdate = new Date();
var sTime = (cdate.getHours()<10?"0":"") + cdate.getHours() + ":" + (cdate.getMinutes()<10?"0":"") + cdate.getMinutes() + ":" +
(cdate.getSeconds()<10?"0":"") + cdate.getSeconds();
- var sdate = "Date: " + com.synckolab.tools.text.getDayString(cdate.getDay()) + ", " + cdate.getDate() + " " +
- com.synckolab.tools.text.getMonthString(cdate.getMonth()) + " " + cdate.getFullYear() + " " + sTime +
+ var sdate = "Date: " + synckolab.tools.text.getDayString(cdate.getDay()) + ", " + cdate.getDate() + " " +
+ synckolab.tools.text.getMonthString(cdate.getMonth()) + " " + cdate.getFullYear() + " " + sTime +
" " + ((cdate.getTimezoneOffset() < 0)?"+":"-") +
(Math.abs(cdate.getTimezoneOffset()/60)<10?"0":"") + Math.abs(cdate.getTimezoneOffset()/60) +"00\n";
@@ -542,7 +544,7 @@ generateMail: function (cid, mail, adsubject, mime, part, skcontent, hr, image){
if (!part) {
msg += "Content-Transfer-Encoding: quoted-printable\n";
}
- msg += "User-Agent: SyncKolab " + com.synckolab.config.version + "\n";
+ msg += "User-Agent: SyncKolab " + synckolab.config.version + "\n";
if (part) {
msg += "X-Kolab-Type: "+mime+"\n";
}
@@ -626,7 +628,7 @@ generateMail: function (cid, mail, adsubject, mime, part, skcontent, hr, image){
fileIO.close();
istream.close();
- this.logMessage("got " + fileContent.length + " bytes", com.synckolab.global.LOG_WARNING);
+ this.logMessage("got " + fileContent.length + " bytes", synckolab.global.LOG_WARNING);
// now we got the image into fileContent - lets attach
@@ -639,7 +641,7 @@ generateMail: function (cid, mail, adsubject, mime, part, skcontent, hr, image){
}
catch (ex)
{
- this.logMessage("Unable to read image: "+image+"\n" + ex, com.synckolab.global.LOG_WARNING);
+ this.logMessage("Unable to read image: "+image+"\n" + ex, synckolab.global.LOG_WARNING);
return null;
}
@@ -677,8 +679,8 @@ getAccountName: function (accountKey) {
for (var i = 0; i < accountManager.allServers.Count(); i++)
{
var account = accountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
- if (account.rootMsgFolder.baseMessageURI === accountKey || com.synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey ||
- com.synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
+ if (account.rootMsgFolder.baseMessageURI === accountKey || synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey ||
+ synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
{
return accountManager.getFirstIdentityForServer(account).fullName;
}
@@ -696,8 +698,8 @@ getAccountEMail: function (accountKey) {
for (var i = 0; i < accountManager.allServers.Count(); i++)
{
var account = accountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
- if (account.rootMsgFolder.baseMessageURI === accountKey || com.synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey ||
- com.synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
+ if (account.rootMsgFolder.baseMessageURI === accountKey || synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey ||
+ synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
{
return accountManager.getFirstIdentityForServer(account).email;
}
@@ -713,15 +715,15 @@ getAccountEMail: function (accountKey) {
getMsgFolder: function (accountKey, path)
{
- this.logMessage("trying to get folder: '" + path + "' for account " + accountKey, com.synckolab.global.LOG_DEBUG);
+ this.logMessage("trying to get folder: '" + path + "' for account " + accountKey, synckolab.global.LOG_DEBUG);
var accountManager = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
var gInc = null;
for (var i = 0; i < accountManager.allServers.Count(); i++)
{
var account = accountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
- if (account.rootMsgFolder.baseMessageURI === accountKey || com.synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey||
- com.synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
+ if (account.rootMsgFolder.baseMessageURI === accountKey || synckolab.tools.text.fixNameToMiniCharset(account.rootMsgFolder.baseMessageURI) === accountKey||
+ synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === accountKey)
{
gInc = account;
}
@@ -773,7 +775,7 @@ getMsgFolder: function (accountKey, path)
// we found it
if (path === cur.URI)
{
- this.logMessage("we found our path!!!: " + cur.URI, com.synckolab.global.LOG_DEBUG);
+ this.logMessage("we found our path!!!: " + cur.URI, synckolab.global.LOG_DEBUG);
return cur;
}
@@ -782,7 +784,7 @@ getMsgFolder: function (accountKey, path)
if (cp === cur.URI)
{
- this.logMessage("got subpath: " + cur.URI, com.synckolab.global.LOG_DEBUG);
+ this.logMessage("got subpath: " + cur.URI, synckolab.global.LOG_DEBUG);
cFolder = cur;
break;
@@ -824,7 +826,7 @@ getMsgFolder: function (accountKey, path)
};
-com.synckolab.tools.file = {
+synckolab.tools.file = {
/**
* Copies a local file into any mail folder.
* In order to be displayed correct, make sure to create a complete message file!!!
@@ -833,7 +835,7 @@ com.synckolab.tools.file = {
*/
copyToLocalFolder: function (fileName, folderUri)
{
- var mailFolder = com.synckolab.global.rdf.GetResource(folderUri).QueryInterface(Components.interfaces.nsIMsgFolder);
+ var mailFolder = synckolab.global.rdf.GetResource(folderUri).QueryInterface(Components.interfaces.nsIMsgFolder);
// ok give out the folder info
// ok now get the filespec
@@ -852,11 +854,11 @@ com.synckolab.tools.file = {
getSyncDbFile: function (config, id) {
if (id === null)
{
- com.synckolab.tools.logMessage("Error: entry has no id (" +config.name + ": " + config.type + ")", com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Error: entry has no id (" +config.name + ": " + config.type + ")", synckolab.global.LOG_ERROR);
return null;
}
- com.synckolab.tools.logMessage("syncDbFile: (" +com.synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "/" + config.type + "_" + config.name + "/" + id + ")", com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("syncDbFile: (" +synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "/" + config.type + "_" + config.name + "/" + id + ")", synckolab.global.LOG_ERROR);
id = id.replace(/[ :.;$\\\/]\#\@/g, "_");
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
@@ -866,7 +868,7 @@ com.synckolab.tools.file = {
file.create(1, parseInt("0775", 8));
}
- file.append(com.synckolab.tools.text.fixNameToMiniCharset(config.serverKey));
+ file.append(synckolab.tools.text.fixNameToMiniCharset(config.serverKey));
if (!file.exists()) {
file.create(1, parseInt("0775", 8));
}
@@ -881,7 +883,7 @@ com.synckolab.tools.file = {
}
catch (ex)
{
- com.synckolab.tools.logMessage("Problem with getting syncDbFile: (" +com.synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "/" + config.name + ": " + config.type + ": " + id + ")\n" + ex, com.synckolab.global.LOG_ERROR);
+ synckolab.tools.logMessage("Problem with getting syncDbFile: (" +synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "/" + config.name + ": " + config.type + ": " + id + ")\n" + ex, synckolab.global.LOG_ERROR);
return null;
}
return file;
@@ -895,7 +897,7 @@ com.synckolab.tools.file = {
* @param data the data object that will be converted to json and written
* @param direct do not use json, write content as is
*/
-com.synckolab.tools.writeSyncDBFile = function (file, data, direct)
+synckolab.tools.writeSyncDBFile = function (file, data, direct)
{
if (data === null) {
return;
@@ -933,11 +935,11 @@ com.synckolab.tools.writeSyncDBFile = function (file, data, direct)
* @param direct do not use json, write content as is
* @returns the json object from the file
*/
-com.synckolab.tools.readSyncDBFile = function (file, direct)
+synckolab.tools.readSyncDBFile = function (file, direct)
{
if (file === null)
{
- com.synckolab.tools.logMessage("readSyncDBFile ERROR: file is null");
+ synckolab.tools.logMessage("readSyncDBFile ERROR: file is null");
return null;
}
@@ -975,7 +977,7 @@ com.synckolab.tools.readSyncDBFile = function (file, direct)
}
catch (ex)
{
- com.synckolab.tools.logMessage("readSyncDBFile ERROR while reading file" + ex);
+ synckolab.tools.logMessage("readSyncDBFile ERROR while reading file" + ex);
}
return null;
};
@@ -984,10 +986,10 @@ com.synckolab.tools.readSyncDBFile = function (file, direct)
* Retrieves a file in the user profile dir which includes the config database
* make sure to add .cal, .con or .task at the config so there are no duplicate names
*/
-com.synckolab.tools.file.getHashDataBaseFile = function (config)
+synckolab.tools.file.getHashDataBaseFile = function (config)
{
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- file.append("synckolab." + com.synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "." + config.name + "." + config.type+".hdb");
+ file.append("synckolab." + synckolab.tools.text.fixNameToMiniCharset(config.serverKey) + "." + config.name + "." + config.type+".hdb");
return file;
};
@@ -996,10 +998,10 @@ com.synckolab.tools.file.getHashDataBaseFile = function (config)
* Database class: read a file into a hashmap
* @param file the file to read/write the data to/from
*/
-com.synckolab.dataBase = function (file) {
+synckolab.dataBase = function (file) {
// the database file
this.dbf = file;
- this.db = new com.synckolab.hashMap();
+ this.db = new synckolab.hashMap();
// no file specified - memory only
if(!file) {
@@ -1008,7 +1010,7 @@ com.synckolab.dataBase = function (file) {
// if the file is not readable - dont bother
if (!file.exists() || !file.isReadable()) {
- com.synckolab.tools.logMessage("File not readable: " + file, com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("File not readable: " + file, synckolab.global.LOG_WARNING);
return;
}
@@ -1040,7 +1042,7 @@ com.synckolab.dataBase = function (file) {
fv = fv.replace(/\\\\/g, "\\");
}
// split now
- fv = com.synckolab.tools.text.trim(fv).split(":");
+ fv = synckolab.tools.text.trim(fv).split(":");
for (var j =0; j < fv.length; j++)
{
if (fv[j].replace) {
@@ -1058,11 +1060,11 @@ com.synckolab.dataBase = function (file) {
/**
* returns the position of this entry in the db
*/
-com.synckolab.dataBase.prototype.get = function (key) {
+synckolab.dataBase.prototype.get = function (key) {
return this.db.get(key);
};
-com.synckolab.dataBase.prototype.remove = function (entry) {
+synckolab.dataBase.prototype.remove = function (entry) {
this.db.remove(entry[0]);
};
@@ -1070,7 +1072,7 @@ com.synckolab.dataBase.prototype.remove = function (entry) {
* add an array - the first entry is the key!
* @param entry
*/
-com.synckolab.dataBase.prototype.add = function (entry) {
+synckolab.dataBase.prototype.add = function (entry) {
this.db.put(entry[0], entry);
};
@@ -1079,7 +1081,7 @@ com.synckolab.dataBase.prototype.add = function (entry) {
* @param entry
* @return
*/
-com.synckolab.dataBase.prototype.addField = function (name, value) {
+synckolab.dataBase.prototype.addField = function (name, value) {
// ignore errornous fields!
if (name === null || value === null) {
return;
@@ -1088,11 +1090,11 @@ com.synckolab.dataBase.prototype.addField = function (name, value) {
this.db.put(entry[0], entry);
};
-com.synckolab.dataBase.prototype.length = function () {
+synckolab.dataBase.prototype.length = function () {
return this.db.length();
};
-com.synckolab.dataBase.prototype.toString = function () {
+synckolab.dataBase.prototype.toString = function () {
this.db.iterate();
var cur;
var str = "";
@@ -1103,13 +1105,13 @@ com.synckolab.dataBase.prototype.toString = function () {
return str;
};
-com.synckolab.dataBase.prototype.toXmlString = function () {
+synckolab.dataBase.prototype.toXmlString = function () {
this.db.iterate();
var cur;
var str = "";
while ((cur = this.db.next()))
{
- str += com.synckolab.tools.text.nodeWithContent(cur[0], cur[1], false);
+ str += synckolab.tools.text.nodeWithContent(cur[0], cur[1], false);
}
return str;
};
@@ -1117,7 +1119,7 @@ com.synckolab.dataBase.prototype.toXmlString = function () {
* writes a database file (key:hashvalue:h2)
* @param file an optional new filename to write into
*/
-com.synckolab.dataBase.prototype.write = function (file) {
+synckolab.dataBase.prototype.write = function (file) {
if (!file && !this.dbf) {
return;
}
@@ -1156,7 +1158,7 @@ com.synckolab.dataBase.prototype.write = function (file) {
s += ":" + fv;
}
s += "\n";
- com.synckolab.tools.logMessage("writing " + s, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("writing " + s, synckolab.global.LOG_DEBUG);
stream.write(s, s.length);
}
// write newlines at the end
@@ -1170,7 +1172,7 @@ com.synckolab.dataBase.prototype.write = function (file) {
/**
* Initial prime number used as seed: 521
*/
-com.synckolab.hashMap = function ()
+synckolab.hashMap = function ()
{
this.len = 0;
this.seed = 521;
@@ -1182,7 +1184,7 @@ com.synckolab.hashMap = function ()
};
// starts an iteration
-com.synckolab.hashMap.prototype.iterate = function () {
+synckolab.hashMap.prototype.iterate = function () {
this.hashIdx = 0;
this.idx = 0;
};
@@ -1190,7 +1192,7 @@ com.synckolab.hashMap.prototype.iterate = function () {
/**
* gets the next element or null
*/
-com.synckolab.hashMap.prototype.next = function () {
+synckolab.hashMap.prototype.next = function () {
// check if we still have room in the current hash
this.idx++;
while (this.idx >= this.array[this.hashIdx].length)
@@ -1211,14 +1213,14 @@ com.synckolab.hashMap.prototype.next = function () {
/**
* HashMap class to speed up searches
*/
-com.synckolab.hashMap.entry = function ( key, value )
+synckolab.hashMap.entry = function ( key, value )
{
this.key = key;
this.value = value;
};
-com.synckolab.hashMap.prototype.getIKey = function (key)
+synckolab.hashMap.prototype.getIKey = function (key)
{
if(!key) {
var err = new Error("");
@@ -1233,7 +1235,7 @@ com.synckolab.hashMap.prototype.getIKey = function (key)
return sum;
};
-com.synckolab.hashMap.prototype.put = function ( key, value )
+synckolab.hashMap.prototype.put = function ( key, value )
{
if(!key) {
var err = new Error("");
@@ -1252,11 +1254,11 @@ com.synckolab.hashMap.prototype.put = function ( key, value )
return;
}
}
- car[car.length] = new com.synckolab.hashMap.entry( key, value );
+ car[car.length] = new synckolab.hashMap.entry( key, value );
this.len++;
};
-com.synckolab.hashMap.prototype.clear = function ()
+synckolab.hashMap.prototype.clear = function ()
{
for (var k = 0; k < this.seed; k++) {
this.array[k] = [];
@@ -1264,7 +1266,7 @@ com.synckolab.hashMap.prototype.clear = function ()
this.len = 0;
};
-com.synckolab.hashMap.prototype.remove = function ( key )
+synckolab.hashMap.prototype.remove = function ( key )
{
// get a key
var ikey = this.getIKey(key) % this.seed;
@@ -1281,7 +1283,7 @@ com.synckolab.hashMap.prototype.remove = function ( key )
return false;
};
-com.synckolab.hashMap.prototype.get = function ( key )
+synckolab.hashMap.prototype.get = function ( key )
{
// get a key
var ikey = this.getIKey(key) % this.seed;
@@ -1296,7 +1298,7 @@ com.synckolab.hashMap.prototype.get = function ( key )
return null;
};
-com.synckolab.hashMap.prototype.length = function ()
+synckolab.hashMap.prototype.length = function ()
{
return this.len;
};
@@ -1304,7 +1306,7 @@ com.synckolab.hashMap.prototype.length = function ()
/**
* synckolab node (standard node with a twist)
*/
-com.synckolab.Node = function (node) {
+synckolab.Node = function (node) {
if (node === null) {
return null;
}
@@ -1312,21 +1314,21 @@ com.synckolab.Node = function (node) {
this.nodeName = node.nodeName;
this.nodeType = node.nodeType;
this.firstChild = node.firstChild;
- this.nextSibling = new com.synckolab.Node(node.nextSibling);
+ this.nextSibling = new synckolab.Node(node.nextSibling);
};
-com.synckolab.Node.prototype.getFirstData = function () {
+synckolab.Node.prototype.getFirstData = function () {
if (!this.node.firstChild) {
return null;
}
- return com.synckolab.tools.text.decode4XML(this.node.firstChild.data);
+ return synckolab.tools.text.decode4XML(this.node.firstChild.data);
};
/**
* return the content of a child node with name "name" of the node "node"
* or the given default "def" if no such node exists
*/
-com.synckolab.Node.prototype.getXmlResult = function (name, def)
+synckolab.Node.prototype.getXmlResult = function (name, def)
{
var cur = this.node.firstChild;
while(cur)
@@ -1338,7 +1340,7 @@ com.synckolab.Node.prototype.getXmlResult = function (name, def)
var value = cur.firstChild.nodeValue;
// decode the value
if (value) {
- return com.synckolab.tools.text.decode4XML(value);
+ return synckolab.tools.text.decode4XML(value);
}
}
}
@@ -1351,7 +1353,7 @@ com.synckolab.Node.prototype.getXmlResult = function (name, def)
/**
* return a direct child node with the name "name" of the node "node"
*/
-com.synckolab.Node.prototype.getChildNode = function (name)
+synckolab.Node.prototype.getChildNode = function (name)
{
var cur = this.node.firstChild;
while(cur)
@@ -1369,7 +1371,7 @@ com.synckolab.Node.prototype.getChildNode = function (name)
* return the value of the attribute with name "attrName" of the node "node"
* or null, if no attribute with that name exists
*/
-com.synckolab.Node.prototype.getAttribute = function (attrName)
+synckolab.Node.prototype.getAttribute = function (attrName)
{
if (!this.node) {
return null;
@@ -1395,7 +1397,7 @@ com.synckolab.Node.prototype.getAttribute = function (attrName)
* This function falla back to using QueryInterface to check whether the interface
* is implemented.
*/
-com.synckolab.tools.instanceOf = function (aObject, aInterface) {
+synckolab.tools.instanceOf = function (aObject, aInterface) {
// We first try instanceof which is assumed to be faster than querying the object:
if (!(aObject instanceof aInterface)) {
// if the passed object in not wrapped (but a plain implementation),
@@ -1417,7 +1419,7 @@ com.synckolab.tools.instanceOf = function (aObject, aInterface) {
* @param config the config (to read the right folder)
* @param parseFunc a function that parses the messages into objects
*/
-com.synckolab.tools.fillMessageLookup = function(map, config, parseFunc) {
+synckolab.tools.fillMessageLookup = function(map, config, parseFunc) {
var messages;
// get the message keys
if (config.folder.getMessages) {
@@ -1432,31 +1434,31 @@ com.synckolab.tools.fillMessageLookup = function(map, config, parseFunc) {
}
};
-com.synckolab.tools.CONFIG_TYPE_BOOL = 0;
-com.synckolab.tools.CONFIG_TYPE_CHAR = 1;
-com.synckolab.tools.CONFIG_TYPE_INT = 2;
+synckolab.tools.CONFIG_TYPE_BOOL = 0;
+synckolab.tools.CONFIG_TYPE_CHAR = 1;
+synckolab.tools.CONFIG_TYPE_INT = 2;
/**
*
* @param pref the preference service (Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);)
* @param name the name of the configuration to get (every value is prefixed with SyncKolab.)
- * @param type the type (see com.synckolab.tools.CONFIG_TYPE_*)
+ * @param type the type (see synckolab.tools.CONFIG_TYPE_*)
* @param def an optional default value
* @return the configuration value in the given type or the default value
*/
-com.synckolab.tools.getConfigValue = function(pref, name, type, def) {
+synckolab.tools.getConfigValue = function(pref, name, type, def) {
try {
- if(type === com.synckolab.tools.CONFIG_TYPE_BOOL) {
+ if(type === synckolab.tools.CONFIG_TYPE_BOOL) {
return pref.getBoolPref("SyncKolab." + name);
}
- if(type === com.synckolab.tools.CONFIG_TYPE_INT) {
+ if(type === synckolab.tools.CONFIG_TYPE_INT) {
return pref.getIntPref("SyncKolab." + name);
}
// default use char pref
return pref.getCharPref("SyncKolab." + name);
}
catch (ex) {
- com.synckolab.tools.logMessage("SyncKolab."+name+" does not exist(yet).", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("SyncKolab."+name+" does not exist(yet).", synckolab.global.LOG_INFO);
return def;
}
};
@@ -1464,16 +1466,16 @@ com.synckolab.tools.getConfigValue = function(pref, name, type, def) {
/**
* @param pref the preference service (Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);)
* @param name the name of the configuration to get (every value is prefixed with SyncKolab.)
- * @param type the type (see com.synckolab.tools.CONFIG_TYPE_*)
+ * @param type the type (see synckolab.tools.CONFIG_TYPE_*)
* @param value the value to write
* @return true when the value has been written
*/
-com.synckolab.tools.setConfigValue = function(pref, name, type, value) {
+synckolab.tools.setConfigValue = function(pref, name, type, value) {
try {
- if(type === com.synckolab.tools.CONFIG_TYPE_BOOL) {
+ if(type === synckolab.tools.CONFIG_TYPE_BOOL) {
pref.setBoolPref("SyncKolab." + name, value);
}
- if(type === com.synckolab.tools.CONFIG_TYPE_INT) {
+ if(type === synckolab.tools.CONFIG_TYPE_INT) {
pref.setIntPref("SyncKolab." + name, value);
}
// default use char pref
@@ -1492,7 +1494,7 @@ com.synckolab.tools.setConfigValue = function(pref, name, type, value) {
* @param name the name of the configuration to get (every value is prefixed with SyncKolab.)
* @return true when the value has been written
*/
-com.synckolab.tools.removeConfig = function(pref, name) {
+synckolab.tools.removeConfig = function(pref, name) {
try {
pref.clearUserPref("SyncKolab." + name);
}
@@ -1507,14 +1509,14 @@ com.synckolab.tools.removeConfig = function(pref, name) {
* opens a browser window with a given url
* @param aURL the external url to load
*/
-com.synckolab.tools.launchUrl = function(aURL) {
+synckolab.tools.launchUrl = function(aURL) {
var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(aURL);
};
-com.synckolab.tools.getUidFromHeader = function (header) {
+synckolab.tools.getUidFromHeader = function (header) {
if(!header) {
return header;
}
diff --git a/src/chrome/content/synckolab/tools/kolab.js b/src/chrome/content/synckolab/tools/kolab.js
index c7f9889..2294cb2 100644
--- a/src/chrome/content/synckolab/tools/kolab.js
+++ b/src/chrome/content/synckolab/tools/kolab.js
@@ -30,11 +30,10 @@
* ***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
-if(!com.synckolab.tools) com.synckolab.tools={};
+if(!synckolab) var synckolab={};
+if(!synckolab.tools) synckolab.tools={};
-com.synckolab.tools.kolab={
+synckolab.tools.kolab={
/**
* return the name of the week day like it is expected
* by the Kolab 2 XML format
@@ -43,7 +42,7 @@ com.synckolab.tools.kolab={
* @return a string with the name of the week day
*/
getXmlDayName: function(index) {
- com.synckolab.tools.logMessage("converting " + index, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("converting " + index, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
var name = "sunday";
switch (index)
{
@@ -81,7 +80,7 @@ com.synckolab.tools.kolab={
*/
getDayIndex: function (name)
{
- com.synckolab.tools.logMessage("converting " + name, com.synckolab.global.LOG_CAL + com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("converting " + name, synckolab.global.LOG_CAL + synckolab.global.LOG_DEBUG);
var index = 1;
switch (name.toLowerCase())
{
diff --git a/src/chrome/content/synckolab/tools/sha1.js b/src/chrome/content/synckolab/tools/sha1.js
index d9cc453..2b85960 100644
--- a/src/chrome/content/synckolab/tools/sha1.js
+++ b/src/chrome/content/synckolab/tools/sha1.js
@@ -9,11 +9,10 @@
*/
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
-if(!com.synckolab.tools) {com.synckolab.tools={};}
+if(!synckolab) var synckolab={};
+if(!synckolab.tools) {synckolab.tools={};}
-com.synckolab.tools.sha1 = {
+synckolab.tools.sha1 = {
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
diff --git a/src/chrome/content/synckolab/tools/text.js b/src/chrome/content/synckolab/tools/text.js
index 2a03856..eda4649 100644
--- a/src/chrome/content/synckolab/tools/text.js
+++ b/src/chrome/content/synckolab/tools/text.js
@@ -30,7 +30,7 @@
* ***** END LICENSE BLOCK ***** */
/**
- * Package: com.synckolab.tools.text
+ * Package: synckolab.tools.text
*
* Text handling:
* * fixToMiniCharset()
@@ -42,17 +42,15 @@
*/
"use strict";
-if (!com)
- var com = {};
-if (!com.synckolab)
- com.synckolab = {};
-if (!com.synckolab.tools)
- com.synckolab.tools = {};
+if (!synckolab)
+ var synckolab = {};
+if (!synckolab.tools)
+ synckolab.tools = {};
/**
* Basic text stuff
*/
-com.synckolab.tools.text = {
+synckolab.tools.text = {
nodeWithContent : function (nodeName, nodeValue, createNonExist) {
if (!createNonExist && !this.checkExist(nodeValue)) {
return "";
@@ -62,7 +60,7 @@ com.synckolab.tools.text = {
},
checkExist : function (value) {
- return value && value !== "";
+ return value !== null && typeof value !== 'undefined' && value !== "" && value !== " ";
},
trim : function (s) {
@@ -74,7 +72,7 @@ com.synckolab.tools.text = {
*/
fixNameToMiniCharset : function (name) {
if (typeof name === 'undefined' || !name.length) {
- com.synckolab.global.consoleService.logStringMessage("undefined string " + new Error("s").stack);
+ synckolab.global.consoleService.logStringMessage("undefined string " + new Error("s").stack);
}
var ret = "";
@@ -433,7 +431,7 @@ com.synckolab.tools.text = {
}
if(!s) {
- com.synckolab.global.consoleService.logStringMessage("undefined string " + new Error("s").stack);
+ synckolab.global.consoleService.logStringMessage("undefined string " + new Error("s").stack);
}
if (!s.replace) {
@@ -496,9 +494,9 @@ com.synckolab.tools.text = {
/**
* UTF-8 en/decoder
* Usage:
- * result = com.synckolab.text.utf8.decode(String); / encode(String);
+ * result = synckolab.text.utf8.decode(String); / encode(String);
*/
-com.synckolab.tools.text.utf8 = {
+synckolab.tools.text.utf8 = {
decode : function (utftext) {
var plaintext = "";
var i = 0;
@@ -594,9 +592,9 @@ com.synckolab.tools.text.utf8 = {
/**
* UTF-16 en/decoder
* Usage:
- * result = com.synckolab.text.utf16.decode(String); / encode(String);
+ * result = synckolab.text.utf16.decode(String); / encode(String);
*/
-com.synckolab.tools.text.utf16 = {
+synckolab.tools.text.utf16 = {
decode : function (str) {
var out, i, len, c;
var char2, char3;
@@ -660,9 +658,9 @@ com.synckolab.tools.text.utf16 = {
/**
* QuotedPrintable en/decoder
* Usage:
- * result = com.synckolab.text.quoted.decode(String); / encode(String);
+ * result = synckolab.text.quoted.decode(String); / encode(String);
*/
-com.synckolab.tools.text.quoted = {
+synckolab.tools.text.quoted = {
encode : function (str) {
// + original by: Theriault
@@ -743,9 +741,9 @@ com.synckolab.tools.text.quoted = {
/**
* Base 64 decoder
* Usage:
- * result = com.synckolab.text.base64.decode(String); / encode(String);
+ * result = synckolab.text.base64.decode(String); / encode(String);
*/
-com.synckolab.tools.text.base64 = {
+synckolab.tools.text.base64 = {
base64 : ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
'3', '4', '5', '6', '7', '8', '9', '*', '/'],
diff --git a/src/chrome/content/synckolab/wndConfig.js b/src/chrome/content/synckolab/wndConfig.js
index c6c3106..2c5f6db 100644
--- a/src/chrome/content/synckolab/wndConfig.js
+++ b/src/chrome/content/synckolab/wndConfig.js
@@ -30,10 +30,9 @@
* ***** END LICENSE BLOCK ***** */
"use strict";
-if(!com) var com={};
-if(!com.synckolab) com.synckolab={};
+if(!synckolab) var synckolab={};
-com.synckolab.settings = {
+synckolab.settings = {
// string bundle use: strBundle.getString("KEYNAME")
strBundle: null,
// account types
@@ -44,19 +43,19 @@ com.synckolab.settings = {
-com.synckolab.settings.savePrefs = function () {
+synckolab.settings.savePrefs = function () {
// get base info back from ui
- com.synckolab.tools.logMessage("Saving preferences.", com.synckolab.global.LOG_DEBUG);
- com.synckolab.settings.getBaseInfo();
- com.synckolab.tools.logMessage("Getting info.", com.synckolab.global.LOG_DEBUG);
- com.synckolab.settings.getInfo();
+ synckolab.tools.logMessage("Saving preferences.", synckolab.global.LOG_DEBUG);
+ synckolab.settings.getBaseInfo();
+ synckolab.tools.logMessage("Getting info.", synckolab.global.LOG_DEBUG);
+ synckolab.settings.getInfo();
- com.synckolab.tools.logMessage("Write the configuration: " + com.synckolab.settings.config.toSource(), com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Write the configuration: " + synckolab.settings.config.toSource(), synckolab.global.LOG_DEBUG);
// write the configuration
- com.synckolab.settings.writeConfiguration(com.synckolab.settings.config);
- com.synckolab.tools.logMessage("done saving.", com.synckolab.global.LOG_DEBUG);
+ synckolab.settings.writeConfiguration(synckolab.settings.config);
+ synckolab.tools.logMessage("done saving.", synckolab.global.LOG_DEBUG);
return true;
};
@@ -68,16 +67,16 @@ com.synckolab.settings.savePrefs = function () {
* @param conf the configuration to write
* @return true if everything went ok
*/
-com.synckolab.settings.writeConfiguration = function(config) {
- var orig = com.synckolab.config.loadConfiguration();
+synckolab.settings.writeConfiguration = function(config) {
+ var orig = synckolab.config.loadConfiguration();
// now we can start writing
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- com.synckolab.tools.setConfigValue(pref, "configVersion", com.synckolab.tools.CONFIG_TYPE_INT, config.version + 1);
- com.synckolab.tools.setConfigValue(pref, "debugLevel", com.synckolab.tools.CONFIG_TYPE_INT, config.debugLevel);
- com.synckolab.tools.setConfigValue(pref, "hideFolder", com.synckolab.tools.CONFIG_TYPE_BOOL, config.hideFolder);
- com.synckolab.tools.setConfigValue(pref, "closeWindow", com.synckolab.tools.CONFIG_TYPE_BOOL, config.closeWindow);
- com.synckolab.tools.setConfigValue(pref, "syncOnStart", com.synckolab.tools.CONFIG_TYPE_BOOL, config.syncOnStart);
+ synckolab.tools.setConfigValue(pref, "configVersion", synckolab.tools.CONFIG_TYPE_INT, config.version + 1);
+ synckolab.tools.setConfigValue(pref, "debugLevel", synckolab.tools.CONFIG_TYPE_INT, config.debugLevel);
+ synckolab.tools.setConfigValue(pref, "hideFolder", synckolab.tools.CONFIG_TYPE_BOOL, config.hideFolder);
+ synckolab.tools.setConfigValue(pref, "closeWindow", synckolab.tools.CONFIG_TYPE_BOOL, config.closeWindow);
+ synckolab.tools.setConfigValue(pref, "syncOnStart", synckolab.tools.CONFIG_TYPE_BOOL, config.syncOnStart);
// check if an account has been removed
var i,j,found;
@@ -91,7 +90,7 @@ com.synckolab.settings.writeConfiguration = function(config) {
}
}
if(!found) {
- com.synckolab.tools.logMessage("resetting " + orig.accounts[i].name, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("resetting " + orig.accounts[i].name, synckolab.global.LOG_DEBUG);
pref.resetBranch("SyncKolab." + orig.accounts[i].name);
}
}
@@ -116,12 +115,12 @@ com.synckolab.settings.writeConfiguration = function(config) {
}
// write per account
- com.synckolab.settings.writeAccountConfig(pref, config.accounts[i], origAcct);
+ synckolab.settings.writeAccountConfig(pref, config.accounts[i], origAcct);
acctList += config.accounts[i].name + ";";
}
// write the acctList back
- com.synckolab.tools.setConfigValue(pref, "accounts.list", com.synckolab.tools.CONFIG_TYPE_CHAR, acctList);
+ synckolab.tools.setConfigValue(pref, "accounts.list", synckolab.tools.CONFIG_TYPE_CHAR, acctList);
return true;
};
@@ -130,7 +129,7 @@ com.synckolab.settings.writeConfiguration = function(config) {
* read the account configuration into an object
* @param acct the account object to read the configuration into (name has to be existent)
*/
-com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
+synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
var configs, i, j, k, found;
for(var type in acct) {
// skip volatiles/non-arrays
@@ -148,7 +147,7 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
// get rid of the deleted configuration branches
if(!found) {
try {
- com.synckolab.settings.resetConfiguration(acct.name, type, orig[type][i].name);
+ synckolab.settings.resetConfiguration(acct.name, type, orig[type][i].name);
pref.resetBranch("SyncKolab.accounts." + acct.name + "." + type + ".configs." + orig[type][i].name);
} catch (ex) {
@@ -163,7 +162,7 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
continue;
}
- com.synckolab.tools.logMessage("checking " + type + "- " + acct[type][i].name, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("checking " + type + "- " + acct[type][i].name, synckolab.global.LOG_DEBUG);
// if some values change - the cache needs to reset
if(orig && orig[type]) {
@@ -173,9 +172,9 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
for(k=0; k < resetTriggers.length; k++) {
var trigger = resetTriggers[k];
if(acct[type][i][trigger] !== orig[type][j][trigger]) {
- com.synckolab.tools.logMessage("found change trigger - reset config", com.synckolab.global.LOG_DEBUG);
- com.synckolab.settings.resetConfiguration(acct.name, type, acct[type][i].name);
- com.synckolab.tools.logMessage("finished reset for " + acct.name + " " + type, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("found change trigger - reset config", synckolab.global.LOG_DEBUG);
+ synckolab.settings.resetConfiguration(acct.name, type, acct[type][i].name);
+ synckolab.tools.logMessage("finished reset for " + acct.name + " " + type, synckolab.global.LOG_DEBUG);
break;
}
}
@@ -185,12 +184,12 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
}
// write all the base settings
- for(var n in com.synckolab.config.baseSetting) {
+ for(var n in synckolab.config.baseSetting) {
// skip unwanted prototypes (without type)
- if(com.synckolab.config.baseSetting[n].type >= 0) {
- com.synckolab.tools.setConfigValue(pref,
+ if(synckolab.config.baseSetting[n].type >= 0) {
+ synckolab.tools.setConfigValue(pref,
"accounts." + acct.name+"." + type + ".configs." + acct[type][i].name + "." + n,
- com.synckolab.config.baseSetting[n].type,
+ synckolab.config.baseSetting[n].type,
acct[type][i][n]);
}
}
@@ -199,7 +198,7 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
}
// write the configList back
- com.synckolab.tools.setConfigValue(pref, "accounts." + acct.name + "." + type + ".list", com.synckolab.tools.CONFIG_TYPE_CHAR, configs);
+ synckolab.tools.setConfigValue(pref, "accounts." + acct.name + "." + type + ".list", synckolab.tools.CONFIG_TYPE_CHAR, configs);
}
}
};
@@ -208,17 +207,17 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
* Init function. This is called when the configuration dialog or wizard is started.
* This will read the current configuration and the window elements.
*/
-com.synckolab.settings.init = function () {
+synckolab.settings.init = function () {
var i = 0, j;
- com.synckolab.settings.checkOldConfig();
+ synckolab.settings.checkOldConfig();
// load the string bundle for translation
- com.synckolab.settings.strBundle = document.getElementById("synckolabBundle");
+ synckolab.settings.strBundle = document.getElementById("synckolabBundle");
// check if calendar is available
- com.synckolab.settings.isCalendar = com.synckolab.calendarTools.isCalendarAvailable();
+ synckolab.settings.isCalendar = synckolab.calendarTools.isCalendarAvailable();
// read the current configuration
- com.synckolab.settings.config = com.synckolab.config.loadConfiguration();
+ synckolab.settings.config = synckolab.config.loadConfiguration();
// the format selection boxes:
var abList = document.getElementById("contactFormat");
@@ -271,7 +270,7 @@ com.synckolab.settings.init = function () {
// the adress book list
// fill the contact selection
- var cn = com.synckolab.addressbookTools.getABDirectory();
+ var cn = synckolab.addressbookTools.getABDirectory();
var ABook = cn.getNext();
// we only have ONE address book - means a fresh install - notify the user
@@ -285,9 +284,9 @@ com.synckolab.settings.init = function () {
// the calendar
// if we do not have a calendar, we can easily skip this
- if (com.synckolab.settings.isCalendar)
+ if (synckolab.settings.isCalendar)
{
- var calendars = com.synckolab.calendarTools.getCalendars();
+ var calendars = synckolab.calendarTools.getCalendars();
abList = document.getElementById("calendarURL");
abpopup = document.createElement("menupopup");
abList.appendChild(abpopup);
@@ -303,23 +302,23 @@ com.synckolab.settings.init = function () {
abchild = document.createElement("menuitem");
abpopup.appendChild(abchild);
abchild.setAttribute("label", calendars[i].name);
- abchild.setAttribute("value", com.synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
+ abchild.setAttribute("value", synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
if (i === 0)
{
abchild.setAttribute("selected", "true");
abList.setAttribute("label", calendars[i].name);
- abList.setAttribute("value", com.synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
+ abList.setAttribute("value", synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
}
abchild = document.createElement("menuitem");
taskpopup.appendChild(abchild);
abchild.setAttribute("label", calendars[i].name);
- abchild.setAttribute("value", com.synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
+ abchild.setAttribute("value", synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
if (i === 0)
{
abchild.setAttribute("selected", "true");
taskList.setAttribute("label", calendars[i].name);
- taskList.setAttribute("value", com.synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
+ taskList.setAttribute("value", synckolab.tools.text.fixNameToMiniCharset(calendars[i].name));
}
}
}
@@ -365,14 +364,14 @@ com.synckolab.settings.init = function () {
for (i = 0; i < gAccountManager.allServers.Count(); i++)
{
var account = gAccountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
- com.synckolab.tools.logMessage("Account found: " + account.rootMsgFolder.baseMessageURI, com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("Account found: " + account.rootMsgFolder.baseMessageURI, synckolab.global.LOG_DEBUG);
if (account.rootMsgFolder.baseMessageURI.toLowerCase().indexOf("imap") === -1)
{
- com.synckolab.tools.logMessage("Account " + account.rootMsgFolder.baseMessageURI + " is not an imap account - skipping!", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Account " + account.rootMsgFolder.baseMessageURI + " is not an imap account - skipping!", synckolab.global.LOG_INFO);
continue;
}
- var acctName = com.synckolab.tools.text.fixNameToMiniCharset(account.prettyName);
+ var acctName = synckolab.tools.text.fixNameToMiniCharset(account.prettyName);
tItem = document.createElement("treeitem");
tItem.setAttribute("container", "true");
@@ -390,7 +389,7 @@ com.synckolab.settings.init = function () {
var tChildren = document.createElement("treechildren");
tItem.appendChild(tChildren);
- for (j = 0; j < com.synckolab.settings.baseTypes.length;j++) {
+ for (j = 0; j < synckolab.settings.baseTypes.length;j++) {
// fill in the childs with the configs
tItem = document.createElement("treeitem");
@@ -401,44 +400,44 @@ com.synckolab.settings.init = function () {
tItem.appendChild(tRow);
tCell = document.createElement("treecell");
tRow.appendChild(tCell);
- tItem.setAttribute("id", "tab-"+com.synckolab.settings.baseTypes[j]+"-" + acctName);
- tCell.setAttribute("label", this.strBundle.getString(com.synckolab.settings.baseTypes[j]));
- tCell.setAttribute("value", "tab-"+com.synckolab.settings.baseTypes[j]+"-" + acctName);
+ tItem.setAttribute("id", "tab-"+synckolab.settings.baseTypes[j]+"-" + acctName);
+ tCell.setAttribute("label", this.strBundle.getString(synckolab.settings.baseTypes[j]));
+ tCell.setAttribute("value", "tab-"+synckolab.settings.baseTypes[j]+"-" + acctName);
}
}
- com.synckolab.settings.fillBaseInfo();
- com.synckolab.settings.repaintConfigTree();
+ synckolab.settings.fillBaseInfo();
+ synckolab.settings.repaintConfigTree();
};
/**
* read the current configuration and see if its "old" style
*/
-com.synckolab.settings.checkOldConfig = function() {
+synckolab.settings.checkOldConfig = function() {
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var configString = com.synckolab.tools.getConfigValue(pref, "Configs");
+ var configString = synckolab.tools.getConfigValue(pref, "Configs");
// no configs - no old config
if(!configString || configString.length === 0) {
return;
}
/*
- if(!confirm( com.synckolab.global.strBundle.getString("config.convert"))) {
+ if(!confirm( synckolab.global.strBundle.getString("config.convert"))) {
pref.resetBranch("SyncKolab");
return;
}
configs = configString.split(';');
var curConfig = {
- version: com.synckolab.tools.getConfigValue(pref, "configVersion", com.synckolab.tools.CONFIG_TYPE_INT, 0),
- debugLevel: com.synckolab.tools.getConfigValue(pref, "debugLevel", com.synckolab.tools.CONFIG_TYPE_INT, com.synckolab.global.LOG_WARNING),
+ version: synckolab.tools.getConfigValue(pref, "configVersion", synckolab.tools.CONFIG_TYPE_INT, 0),
+ debugLevel: synckolab.tools.getConfigValue(pref, "debugLevel", synckolab.tools.CONFIG_TYPE_INT, synckolab.global.LOG_WARNING),
// hide folder
- hideFolder: com.synckolab.tools.getConfigValue(pref, "hideFolder", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ hideFolder: synckolab.tools.getConfigValue(pref, "hideFolder", synckolab.tools.CONFIG_TYPE_BOOL, false),
// hide the window while sync
- closeWindow: com.synckolab.tools.getConfigValue(pref, "closeWindow", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ closeWindow: synckolab.tools.getConfigValue(pref, "closeWindow", synckolab.tools.CONFIG_TYPE_BOOL, false),
// sync automatically once on start
- syncOnStart: com.synckolab.tools.getConfigValue(pref, "syncOnStart", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ syncOnStart: synckolab.tools.getConfigValue(pref, "syncOnStart", synckolab.tools.CONFIG_TYPE_BOOL, false),
accounts: []
};
@@ -449,7 +448,7 @@ com.synckolab.settings.checkOldConfig = function() {
continue;
}
- act = com.synckolab.tools.text.fixNameToMiniCharset(act);
+ act = synckolab.tools.text.fixNameToMiniCharset(act);
var acct = null;
var j;
@@ -468,7 +467,7 @@ com.synckolab.settings.checkOldConfig = function() {
}
}
- sConf = com.synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".list");
+ sConf = synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".list");
}
*/
@@ -477,11 +476,11 @@ com.synckolab.settings.checkOldConfig = function() {
/**
* re-create the config tree,
*/
-com.synckolab.settings.repaintConfigTree = function() {
+synckolab.settings.repaintConfigTree = function() {
// remove all nodes under tab-account-[cal|con|task]
- var conf = com.synckolab.settings.config;
+ var conf = synckolab.settings.config;
- com.synckolab.settings.batch = true;
+ synckolab.settings.batch = true;
// sorter for configuration names
var configSorter = function(a,b) {
@@ -496,8 +495,8 @@ com.synckolab.settings.repaintConfigTree = function() {
for(var i = 0; i < conf.accounts.length; i++) {
var acctName = conf.accounts[i].name;
- for (var j = 0; j < com.synckolab.settings.baseTypes.length;j++) {
- var cType = com.synckolab.settings.baseTypes[j];
+ for (var j = 0; j < synckolab.settings.baseTypes.length;j++) {
+ var cType = synckolab.settings.baseTypes[j];
var tItem = document.getElementById("tab-" + cType +"-" + acctName);
// delete the treechildren if exist
var cnode = tItem.firstChild;
@@ -537,7 +536,7 @@ com.synckolab.settings.repaintConfigTree = function() {
}
}
- com.synckolab.settings.batch = false;
+ synckolab.settings.batch = false;
};
/**
@@ -545,7 +544,7 @@ com.synckolab.settings.repaintConfigTree = function() {
* @param cn the abook cn
* @param ABook the address book to use
*/
-com.synckolab.settings.fillAddressBook = function (cn, ABook) {
+synckolab.settings.fillAddressBook = function (cn, ABook) {
var abList = document.getElementById("contactURL");
// delete the childs of the list
var cnode = abList.firstChild;
@@ -615,7 +614,7 @@ com.synckolab.settings.fillAddressBook = function (cn, ABook) {
/**
* set all folders after an account change
*/
-com.synckolab.settings.setFolders = function (act) {
+synckolab.settings.setFolders = function (act) {
this.updateFolder(act, [{
prefix: "contact",
@@ -634,7 +633,7 @@ com.synckolab.settings.setFolders = function (act) {
* @param act the account to search for
* @param sets an array of prefix/node object for each element to fill
*/
-com.synckolab.settings.updateFolder = function (act, sets) {
+synckolab.settings.updateFolder = function (act, sets) {
// dynamically read this...
var gAccountManager = Components.classes['@mozilla.org/messenger/account-manager;1'].getService(Components.interfaces.nsIMsgAccountManager);
for (var i = 0; i < gAccountManager.allServers.Count(); i++)
@@ -642,7 +641,7 @@ com.synckolab.settings.updateFolder = function (act, sets) {
try
{
var account = gAccountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
- if (account.rootMsgFolder.baseMessageURI === act || com.synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === act)
+ if (account.rootMsgFolder.baseMessageURI === act || synckolab.tools.text.fixNameToMiniCharset(account.prettyName) === act)
{
for(var j = 0; j < sets.length; j++) {
var cfold = sets[j].node;
@@ -663,7 +662,7 @@ com.synckolab.settings.updateFolder = function (act, sets) {
cfold.appendChild(tChildren);
sets[j].node = tChildren;
}
- com.synckolab.settings.updateFolderElements(account.rootFolder, sets, "");
+ synckolab.settings.updateFolderElements(account.rootFolder, sets, "");
return;
}
@@ -680,7 +679,7 @@ com.synckolab.settings.updateFolder = function (act, sets) {
* @param msgFolder the current folder
* @param root the current dom root
*/
-com.synckolab.settings.updateFolderElements = function (msgFolder, origSets)
+synckolab.settings.updateFolderElements = function (msgFolder, origSets)
{
var j, tItem, tRow, tCell, tChildren;
var sets = [];
@@ -780,7 +779,7 @@ com.synckolab.settings.updateFolderElements = function (msgFolder, origSets)
return (sa < sb) ? -1 : 1;
});
for(var i = 0; i < folders.length; i++) {
- com.synckolab.settings.updateFolderElements(folders[i], sets);
+ synckolab.settings.updateFolderElements(folders[i], sets);
}
}
@@ -796,7 +795,7 @@ com.synckolab.settings.updateFolderElements = function (msgFolder, origSets)
* </ul>
* @param viewname the item selected
*/
-com.synckolab.settings.setSyncPrefView = function(viewName) {
+synckolab.settings.setSyncPrefView = function(viewName) {
if (viewName.indexOf("-") === -1)
{
alert("Fatal ERROR - unable to get view - Pleasere install!");
@@ -804,7 +803,7 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
}
// skip this if we update the tree
- if (com.synckolab.settings.batch) {
+ if (synckolab.settings.batch) {
return;
}
@@ -818,14 +817,14 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
var tabs = document.getElementById("tabs");
// save changes if contact/cal or task was open before
- com.synckolab.settings.getInfo();
+ synckolab.settings.getInfo();
// remember the type
- com.synckolab.settings.activeType = opts[1];
+ synckolab.settings.activeType = opts[1];
if(opts.length > 2) {
- if(com.synckolab.settings.activeAccount !== opts[2]) {
- com.synckolab.settings.activeAccount = opts[2];
- com.synckolab.settings.setFolders(com.synckolab.settings.activeAccount);
+ if(synckolab.settings.activeAccount !== opts[2]) {
+ synckolab.settings.activeAccount = opts[2];
+ synckolab.settings.setFolders(synckolab.settings.activeAccount);
}
}
switch (opts[1])
@@ -836,13 +835,13 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
return;
case "Acct":
tabs.selectedPanel = document.getElementById("accountTab");
- com.synckolab.settings.fillAccountInfo(opts[2]);
+ synckolab.settings.fillAccountInfo(opts[2]);
document.getElementById("loadConfig").setAttribute("disabled", false);
break;
case "contact":
if(opts.length > 3) {
tabs.selectedPanel = document.getElementById("contactTab");
- com.synckolab.settings.fillInfo("contact", opts[2],opts[3]);
+ synckolab.settings.fillInfo("contact", opts[2],opts[3]);
document.getElementById("delConfig").setAttribute("disabled", false);
} else {
document.getElementById("newConfig").setAttribute("disabled", false);
@@ -851,7 +850,7 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
case "calendar":
if (this.isCalendar && opts.length > 3) {
tabs.selectedPanel = document.getElementById("calTab");
- com.synckolab.settings.fillInfo("calendar", opts[2],opts[3]);
+ synckolab.settings.fillInfo("calendar", opts[2],opts[3]);
document.getElementById("delConfig").setAttribute("disabled", false);
} else {
document.getElementById("newConfig").setAttribute("disabled", false);
@@ -860,7 +859,7 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
case "task":
if (this.isCalendar && opts.length > 3) {
tabs.selectedPanel = document.getElementById("taskTab");
- com.synckolab.settings.fillInfo("task", opts[2],opts[3]);
+ synckolab.settings.fillInfo("task", opts[2],opts[3]);
document.getElementById("delConfig").setAttribute("disabled", false);
} else {
document.getElementById("newConfig").setAttribute("disabled", false);
@@ -873,9 +872,9 @@ com.synckolab.settings.setSyncPrefView = function(viewName) {
/**
* fills the base info dialog from the current active config
*/
-com.synckolab.settings.fillBaseInfo = function() {
+synckolab.settings.fillBaseInfo = function() {
- var conf = com.synckolab.settings.config;
+ var conf = synckolab.settings.config;
document.getElementById("hideFolder").checked = conf.hideFolder;
document.getElementById("closeWindow").checked = conf.closeWindow;
document.getElementById("syncOnStart").checked = conf.syncOnStart;
@@ -894,7 +893,7 @@ com.synckolab.settings.fillBaseInfo = function() {
if (cLabel !== null) {
debugEle.setAttribute("label", cLabel.getAttribute("label"));
} else {
- com.synckolab.tools.logMessage("WARNING: could not find Label " + sCLabel, com.synckolab.global.LOG_WARNING);
+ synckolab.tools.logMessage("WARNING: could not find Label " + sCLabel, synckolab.global.LOG_WARNING);
}
}
@@ -903,7 +902,7 @@ com.synckolab.settings.fillBaseInfo = function() {
/**
* Enables/disables the controls on the page
*/
-com.synckolab.settings.setControlState = function (type, active)
+synckolab.settings.setControlState = function (type, active)
{
var fieldsArray = [
"URL",
@@ -926,7 +925,7 @@ com.synckolab.settings.setControlState = function (type, active)
* @param create set to true to create the account object if it doesnt exist
* @returns the account object and possibly null if create is false
*/
-com.synckolab.settings.getAccount = function(config, name, create) {
+synckolab.settings.getAccount = function(config, name, create) {
for(var i = 0; i < config.accounts.length; i++) {
if(config.accounts[i].name === name) {
return config.accounts[i];
@@ -952,7 +951,7 @@ com.synckolab.settings.getAccount = function(config, name, create) {
* @param create set to true to create the account object if it doesnt exist
* @returns the account object and possibly null if create is false
*/
-com.synckolab.settings.getAccountIdx = function(config, name) {
+synckolab.settings.getAccountIdx = function(config, name) {
for(var i = 0; i < config.accounts.length; i++) {
if(config.accounts[i].name === name) {
return i;
@@ -964,8 +963,8 @@ com.synckolab.settings.getAccountIdx = function(config, name) {
/**
* set the base information from the ui in the current conig object
*/
-com.synckolab.settings.getBaseInfo = function() {
- var conf = com.synckolab.settings.config;
+synckolab.settings.getBaseInfo = function() {
+ var conf = synckolab.settings.config;
conf.hideFolder = document.getElementById("hideFolder").checked;
conf.debugLevel = document.getElementById("debugLevel").value;
conf.closeWindow = document.getElementById("closeWindow").checked;
@@ -978,26 +977,26 @@ com.synckolab.settings.getBaseInfo = function() {
* It is based on Account+Type+Config name
* @returns null if not found, otherwise the config sub-object
*/
-com.synckolab.settings.getActiveConfig = function() {
+synckolab.settings.getActiveConfig = function() {
// nothing to save back
- if(!com.synckolab.settings.activeType || !com.synckolab.settings.activeAccount || !com.synckolab.settings.activeConfig) {
+ if(!synckolab.settings.activeType || !synckolab.settings.activeAccount || !synckolab.settings.activeConfig) {
return null;
}
// get the right tree in the configuration object
- var conf = com.synckolab.settings.config;
- var account = com.synckolab.settings.getAccount(conf, com.synckolab.settings.activeAccount, true);
+ var conf = synckolab.settings.config;
+ var account = synckolab.settings.getAccount(conf, synckolab.settings.activeAccount, true);
var config = null;
- for (var i=0; i < account[com.synckolab.settings.activeType].length; i++) {
- if(account[com.synckolab.settings.activeType][i].name === com.synckolab.settings.activeConfig) {
- config = account[com.synckolab.settings.activeType][i];
+ for (var i=0; i < account[synckolab.settings.activeType].length; i++) {
+ if(account[synckolab.settings.activeType][i].name === synckolab.settings.activeConfig) {
+ config = account[synckolab.settings.activeType][i];
break;
}
}
if(config === null) {
- config = { name: com.synckolab.settings.activeConfig };
- account[com.synckolab.settings.activeType].push(config);
+ config = { name: synckolab.settings.activeConfig };
+ account[synckolab.settings.activeType].push(config);
}
return config;
@@ -1006,21 +1005,21 @@ com.synckolab.settings.getActiveConfig = function() {
/**
* set the configuration of the open contact/calendar/task info
*/
-com.synckolab.settings.getInfo = function() {
+synckolab.settings.getInfo = function() {
// nothing to save back
- if(!com.synckolab.settings.activeType || !com.synckolab.settings.activeAccount || !com.synckolab.settings.activeConfig) {
+ if(!synckolab.settings.activeType || !synckolab.settings.activeAccount || !synckolab.settings.activeConfig) {
return;
}
- if(com.synckolab.settings.activeType !== "contact" && com.synckolab.settings.activeType !== "calendar" && com.synckolab.settings.activeType !== "task") {
+ if(synckolab.settings.activeType !== "contact" && synckolab.settings.activeType !== "calendar" && synckolab.settings.activeType !== "task") {
return;
}
- var config = com.synckolab.settings.getActiveConfig();
+ var config = synckolab.settings.getActiveConfig();
// fill all fields
- var prefix = com.synckolab.settings.activeType;
+ var prefix = synckolab.settings.activeType;
// the address book / calendar
config.source = document.getElementById(prefix + "URL").value;
@@ -1048,8 +1047,8 @@ com.synckolab.settings.getInfo = function() {
* function for the folder listing. once a folder is selected this is called and sets the new folder in
* the active config.
*/
-com.synckolab.settings.setFolder = function (uri) {
- var config = com.synckolab.settings.getActiveConfig();
+synckolab.settings.setFolder = function (uri) {
+ var config = synckolab.settings.getActiveConfig();
if (config === null)
{
return;
@@ -1057,7 +1056,7 @@ com.synckolab.settings.setFolder = function (uri) {
config.folderPath = uri;
};
-com.synckolab.settings.fillAccountInfo = function(acctName) {
+synckolab.settings.fillAccountInfo = function(acctName) {
};
@@ -1067,13 +1066,13 @@ com.synckolab.settings.fillAccountInfo = function(acctName) {
* @param acctName the account name
* @param confName the configuration name
*/
-com.synckolab.settings.fillInfo = function(type, acctName, confName) {
- com.synckolab.settings.activeType = type;
- com.synckolab.settings.activeAccount = acctName;
- com.synckolab.settings.activeConfig = confName;
+synckolab.settings.fillInfo = function(type, acctName, confName) {
+ synckolab.settings.activeType = type;
+ synckolab.settings.activeAccount = acctName;
+ synckolab.settings.activeConfig = confName;
- var config = com.synckolab.settings.getActiveConfig();
- var prefix = com.synckolab.settings.activeType;
+ var config = synckolab.settings.getActiveConfig();
+ var prefix = synckolab.settings.activeType;
var sCurFolder = config.folderPath;
if (sCurFolder !== null && sCurFolder !== "")
@@ -1163,24 +1162,24 @@ com.synckolab.settings.fillInfo = function(type, acctName, confName) {
/**
* adds a new configuration to an account
*/
-com.synckolab.settings.addConfig = function() {
- switch(com.synckolab.settings.activeType) {
+synckolab.settings.addConfig = function() {
+ switch(synckolab.settings.activeType) {
case "contact":
case "calendar":
case "task":
// make sure active config is NOT set (we are creating here)
- com.synckolab.settings.activeConfig = null;
+ synckolab.settings.activeConfig = null;
var retVals = { name: null };
var res = window.openDialog("chrome://synckolab/content/wndNewConfigType.xul",
"newCfg",
- "modal,width=360,height=200,resizable=0", retVals, com.synckolab.settings.activeType, com.synckolab.settings.config);
+ "modal,width=360,height=200,resizable=0", retVals, synckolab.settings.activeType, synckolab.settings.config);
if(retVals.name !== null && retVals.name.length > 2) {
- var acct = com.synckolab.settings.getAccount(com.synckolab.settings.config, com.synckolab.settings.activeAccount, true);
+ var acct = synckolab.settings.getAccount(synckolab.settings.config, synckolab.settings.activeAccount, true);
// check the configs
- for(var i = 0; i < acct[com.synckolab.settings.activeType].length; i++) {
+ for(var i = 0; i < acct[synckolab.settings.activeType].length; i++) {
// already go the configuration
- if(retVals.name === acct[com.synckolab.settings.activeType][i].name) {
+ if(retVals.name === acct[synckolab.settings.activeType][i].name) {
return;
}
}
@@ -1190,18 +1189,18 @@ com.synckolab.settings.addConfig = function() {
};
// read all the base settings
- for(var n in com.synckolab.config.baseSetting) {
+ for(var n in synckolab.config.baseSetting) {
// skip unwanted prototypes (without type)
- if(com.synckolab.config.baseSetting[n].type >= 0) {
- cConf[n] = com.synckolab.config.baseSetting[n].def;
+ if(synckolab.config.baseSetting[n].type >= 0) {
+ cConf[n] = synckolab.config.baseSetting[n].def;
}
}
- acct[com.synckolab.settings.activeType].push(cConf);
+ acct[synckolab.settings.activeType].push(cConf);
- com.synckolab.tools.logMessage("New config: " + com.synckolab.settings.config.toSource(), com.synckolab.global.LOG_DEBUG);
+ synckolab.tools.logMessage("New config: " + synckolab.settings.config.toSource(), synckolab.global.LOG_DEBUG);
// repaint the tree and select the newly created node
- com.synckolab.settings.repaintConfigTree("tab-"+com.synckolab.settings.activeType+"-" + com.synckolab.settings.activeAccount + "-" + retVals.name);
+ synckolab.settings.repaintConfigTree("tab-"+synckolab.settings.activeType+"-" + synckolab.settings.activeAccount + "-" + retVals.name);
}
}
};
@@ -1209,33 +1208,33 @@ com.synckolab.settings.addConfig = function() {
/**
* adds a new configuration to an account
*/
-com.synckolab.settings.delConfig = function() {
- switch(com.synckolab.settings.activeType) {
+synckolab.settings.delConfig = function() {
+ switch(synckolab.settings.activeType) {
case "contact":
case "calendar":
case "task":
- if (confirm(this.strBundle.getFormattedString("configDelete", [com.synckolab.settings.activeConfig]))) {
+ if (confirm(this.strBundle.getFormattedString("configDelete", [synckolab.settings.activeConfig]))) {
- var acctIdx = com.synckolab.settings.getAccountIdx(com.synckolab.settings.config, com.synckolab.settings.activeAccount);
- var acct = com.synckolab.settings.config.accounts[acctIdx];
+ var acctIdx = synckolab.settings.getAccountIdx(synckolab.settings.config, synckolab.settings.activeAccount);
+ var acct = synckolab.settings.config.accounts[acctIdx];
// update the configs
var configs = [];
- for(var i = 0; i < acct[com.synckolab.settings.activeType].length; i++) {
+ for(var i = 0; i < acct[synckolab.settings.activeType].length; i++) {
// already go the configuration
- if(com.synckolab.settings.activeConfig !== acct[com.synckolab.settings.activeType][i].name) {
- configs.push(acct[com.synckolab.settings.activeType][i]);
+ if(synckolab.settings.activeConfig !== acct[synckolab.settings.activeType][i].name) {
+ configs.push(acct[synckolab.settings.activeType][i]);
}
}
- acct[com.synckolab.settings.activeType] = configs;
+ acct[synckolab.settings.activeType] = configs;
- com.synckolab.settings.activeConfig = null;
- com.synckolab.settings.activeType = null;
+ synckolab.settings.activeConfig = null;
+ synckolab.settings.activeType = null;
// repaint the tree and select the parent
- com.synckolab.settings.repaintConfigTree();
+ synckolab.settings.repaintConfigTree();
// select root
- com.synckolab.settings.setSyncPrefView("Welcome-Welcome");
+ synckolab.settings.setSyncPrefView("Welcome-Welcome");
return;
@@ -1248,12 +1247,12 @@ com.synckolab.settings.delConfig = function() {
* @param config the config name
* @param type CALENDAR|TASK|CONTACT + FOLDER
*/
-com.synckolab.settings.resetConfiguration = function (account, type, config)
+synckolab.settings.resetConfiguration = function (account, type, config)
{
- com.synckolab.tools.logMessage("Resetting " + account + "!", com.synckolab.global.LOG_INFO);
+ synckolab.tools.logMessage("Resetting " + account + "!", synckolab.global.LOG_INFO);
var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- file.append("synckolab." + com.synckolab.tools.text.fixNameToMiniCharset(account) + "." + type + "." + config + ".hdb");
+ file.append("synckolab." + synckolab.tools.text.fixNameToMiniCharset(account) + "." + type + "." + config + ".hdb");
if (file.exists()) {
file.remove(true);
}
@@ -1265,7 +1264,7 @@ com.synckolab.settings.resetConfiguration = function (account, type, config)
return;
}
- file.append(com.synckolab.tools.text.fixNameToMiniCharset(account));
+ file.append(synckolab.tools.text.fixNameToMiniCharset(account));
if (file.exists())
{
file.append(type + "_" + config);
diff --git a/src/chrome/content/synckolab/wndConfig.xul b/src/chrome/content/synckolab/wndConfig.xul
index 354897f..4491cff 100644
--- a/src/chrome/content/synckolab/wndConfig.xul
+++ b/src/chrome/content/synckolab/wndConfig.xul
@@ -4,7 +4,7 @@
<!DOCTYPE loc SYSTEM "chrome://synckolab/locale/synckolab.dtd">
-<dialog id="syncKolabConfigDlg" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="com.synckolab.settings.init();" buttons="accept,cancel" ondialogaccept="return com.synckolab.settings.savePrefs();" persist="screenX screenY" width="0" title="SyncKolab 2.0.3">
+<dialog id="syncKolabConfigDlg" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="synckolab.settings.init();" buttons="accept,cancel" ondialogaccept="return synckolab.settings.savePrefs();" persist="screenX screenY" width="0" title="SyncKolab 2.0.3">
<script type="application/x-javascript" src="chrome://synckolab/content/calendarTools.js" />
<script type="application/x-javascript" src="chrome://synckolab/content/addressbookTools.js"/>
@@ -23,7 +23,7 @@
<hbox flex="1">
<vbox flex="1">
<!-- Tree with all configurations -->
- <tree class="synckolab" hidecolumnpicker="true" id="configTree" flex="1" onselect="com.synckolab.settings.setSyncPrefView(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));" width="150">
+ <tree class="synckolab" hidecolumnpicker="true" id="configTree" flex="1" onselect="synckolab.settings.setSyncPrefView(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));" width="150">
<treecols>
<treecol id="name" flex="1" primary="true" />
</treecols>
@@ -32,9 +32,9 @@
</treechildren>
</tree>
<hbox>
- <button id="newConfig" label="&synckolab.settings.add;" orient="vertical" oncommand="com.synckolab.settings.addConfig();" />
- <button id="loadConfig" label="&synckolab.settings.load;" orient="vertical" oncommand="com.synckolab.settings.loadConfig();" />
- <button id="delConfig" label="&synckolab.settings.del;" orient="vertical" oncommand="com.synckolab.settings.delConfig();" />
+ <button id="newConfig" label="&synckolab.settings.add;" orient="vertical" oncommand="synckolab.settings.addConfig();" />
+ <button id="loadConfig" label="&synckolab.settings.load;" orient="vertical" oncommand="synckolab.settings.loadConfig();" />
+ <button id="delConfig" label="&synckolab.settings.del;" orient="vertical" oncommand="synckolab.settings.delConfig();" />
</hbox>
</vbox>
<splitter collapse="before" resizeafter="farthest">
@@ -54,19 +54,19 @@
</description>
<hbox>
<label value="&synckolab.settings.Updates;" />
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://www.gargan.org')">www.gargan.org</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://www.gargan.org')">www.gargan.org</label>
</hbox>
<description style="width: 300px">
&synckolab.settings.DescKolabServer;
</description>
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://www.kolab.org')">www.kolab.org</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://www.kolab.org')">www.kolab.org</label>
<description style="width: 300px" flex="1">&synckolab.settings.DescOtherClients;</description>
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://www.kontact.org')">KDE Client (Kontact) (GPL)</label>
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://www.horde.org')">Horde Webmail (GPL)</label>
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://code.google.com/p/kolab-android/')">Kolab Android</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://www.kontact.org')">KDE Client (Kontact) (GPL)</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://www.horde.org')">Horde Webmail (GPL)</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://code.google.com/p/kolab-android/')">Kolab Android</label>
<separator class="thin" />
<hbox>
@@ -86,7 +86,7 @@
<checkbox id="hideFolder" style="width: 300px" label="&synckolab.settings.hideFolder;"/>
<checkbox id="closeWindow" style="width: 300px" label="&synckolab.settings.CloseWindow;" />
- <button label="&synckolab.settings.saveAll;" oncommand="com.synckolab.settings.saveAllConfig();" />
+ <button label="&synckolab.settings.saveAll;" oncommand="synckolab.settings.saveAllConfig();" />
</vbox>
</tabpanel>
<tabpanel id="accountTab" style="border:0px solid #000" flex="1">
@@ -95,7 +95,7 @@
<label value="&synckolab.settings.SyncKolabHeader;" style="font-size: 16pt;" />
</hbox>
<label value="&synckolab.settings.Updates;" />
- <label class="text-link" onclick="com.synckolab.tools.launchUrl('http://www.gargan.org')">www.gargan.org</label>
+ <label class="text-link" onclick="synckolab.tools.launchUrl('http://www.gargan.org')">www.gargan.org</label>
<separator class="thin" />
</vbox>
</tabpanel>
@@ -108,7 +108,7 @@
</menulist>
<separator class="thin" />
- <tree class="synckolab" flex="7" id="contactImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="com.synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
+ <tree class="synckolab" flex="7" id="contactImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
<treecols>
<treecol id="conFolder" label="&synckolab.settings.ContactFolder;" primary="true" flex="1" />
</treecols>
@@ -121,7 +121,7 @@
</menulist>
</hbox>
- <checkbox id="contactSync" label="&synckolab.settings.SyncContacts;" tooltiptext="&synckolab.settings.SyncContactsTip;" oncommand="com.synckolab.settings.setControlState('contact', this.checked)" />
+ <checkbox id="contactSync" label="&synckolab.settings.SyncContacts;" tooltiptext="&synckolab.settings.SyncContactsTip;" oncommand="synckolab.settings.setControlState('contact', this.checked)" />
<checkbox id="contactSyncListenerImap" label="&synckolab.settings.SyncListener;"/>
<checkbox id="contactSaveToImap" label="&synckolab.settings.SaveToImap;" tooltiptext="&synckolab.settings.SaveToImapTip;" />
@@ -145,7 +145,7 @@
<!-- <textbox id="contactSyncInterval" maxlength="5" style="width: 50px" /> -->
<!-- <label value="&synckolab.settings.SyncIntervalMinutes;" /> -->
<!-- </hbox> -->
- <button label="&synckolab.settings.saveSingle;" oncommand="com.synckolab.settings.saveSingleConfig();" />
+ <button label="&synckolab.settings.saveSingle;" oncommand="synckolab.settings.saveSingleConfig();" />
</vbox>
@@ -161,7 +161,7 @@
<separator class="thin" />
- <tree class="synckolab" flex="7" id="calendarImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="com.synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
+ <tree class="synckolab" flex="7" id="calendarImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
<treecols>
<treecol id="calFolder" label="&synckolab.settings.CalendarFolder;" primary="true" flex="1" />
</treecols>
@@ -176,7 +176,7 @@
<textbox id="calendarSyncTimeframe" maxlength="4" style="width: 30px" />
<label value="&synckolab.settings.TimeframeSyncDays;" />
</hbox>
- <checkbox id="calendarSync" label="&synckolab.settings.SyncCalendar;" tooltiptext="&synckolab.settings.SyncCalendarTip;" oncommand="com.synckolab.settings.setControlState('calendar', this.checked)" />
+ <checkbox id="calendarSync" label="&synckolab.settings.SyncCalendar;" tooltiptext="&synckolab.settings.SyncCalendarTip;" oncommand="synckolab.settings.setControlState('calendar', this.checked)" />
<checkbox id="calendarSyncListenerImap" label="&synckolab.settings.SyncListener;"/>
<checkbox id="calendarSaveToImap" label="&synckolab.settings.SaveToImap;" tooltiptext="&synckolab.settings.SaveToImapTip;" />
@@ -213,7 +213,7 @@
<separator class="thin" />
- <tree class="synckolab" flex="7" id="taskImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="com.synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
+ <tree class="synckolab" flex="7" id="taskImapFolder" rows="7" height="150" width="250" hidecolumnpicker="true" seltype="single" onselect="synckolab.settings.setFolder(this.view.getItemAtIndex(this.currentIndex).firstChild.firstChild.getAttribute('value'));">
<treecols>
<treecol id="taskFolder" label="&synckolab.settings.TaskFolder;" primary="true" flex="1" />
</treecols>
@@ -229,7 +229,7 @@
<textbox id="taskSyncTimeframe" maxlength="4" style="width: 30px" />
<label value="&synckolab.settings.TimeframeSyncDays;" />
</hbox>
- <checkbox id="taskSync" label="&synckolab.settings.SyncTasks;" tooltiptext="&synckolab.settings.SyncTasksTip;" oncommand="com.synckolab.settings.setControlState('task', this.checked)" />
+ <checkbox id="taskSync" label="&synckolab.settings.SyncTasks;" tooltiptext="&synckolab.settings.SyncTasksTip;" oncommand="synckolab.settings.setControlState('task', this.checked)" />
<checkbox id="taskSyncListenerImap" label="&synckolab.settings.SyncListener;"/>
<checkbox id="taskSaveToImap" label="&synckolab.settings.SaveToImap;" tooltiptext="&synckolab.settings.SaveToImapTip;" />
diff --git a/src/chrome/content/synckolab/wndNewConfigType.xul b/src/chrome/content/synckolab/wndNewConfigType.xul
index 42659be..b08e786 100644
--- a/src/chrome/content/synckolab/wndNewConfigType.xul
+++ b/src/chrome/content/synckolab/wndNewConfigType.xul
@@ -12,8 +12,8 @@
<script>
function checkConfigName(name)
{
- if(name !== com.synckolab.tools.text.fixNameToMiniCharset(name)) {
- document.getElementById("configName").value = com.synckolab.tools.text.fixNameToMiniCharset(name);
+ if(name !== synckolab.tools.text.fixNameToMiniCharset(name)) {
+ document.getElementById("configName").value = synckolab.tools.text.fixNameToMiniCharset(name);
}
}
@@ -25,7 +25,7 @@
return false;
}
- if(name !== com.synckolab.tools.text.fixNameToMiniCharset(name)) {
+ if(name !== synckolab.tools.text.fixNameToMiniCharset(name)) {
return false;
}
var retVals = window.arguments[0];