diff --git a/ChangeLog b/ChangeLog.old
similarity index 100%
rename from ChangeLog
rename to ChangeLog.old
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d32c492..ea8914a 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,7 +1,10 @@
NEWS
====
-For later changes see ChangeLog.
+24.0.4 Improved etag handling (#1411 and #1624)
+ Handle periodic syncing of address books
+
+For later changes see ChangeLog.old
0.92
Fixed unescaping of special characters (\r, \n, ...) from VCARD content
diff --git a/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.js b/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.js
index a45a405..b9fe3f3 100644
--- a/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.js
+++ b/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.js
@@ -579,7 +579,7 @@ function SCAbConfirmDeleteDirectory(selectedDir) {
}
function SCSynchronizeFromChildWindow(uri) {
- this.setTimeout(SynchronizeGroupdavAddressbook, 1, uri, null);
+ this.setTimeout(SynchronizeGroupdavAddressbook, 1, uri, null, 1);
}
let groupdavSynchronizationObserver = {
@@ -847,7 +847,7 @@ function SCCommandSynchronize() {
SynchronizeGroupdavAddressbook(gSelectedDir, SCCommandSynchronizeCallback);
}
-function SCCommandSynchronizeCallback(url, code, failures) {
+function SCCommandSynchronizeCallback(url, code, failures, datas) {
dump("SCCommandSynchronizeCallback\n");
dump(" url: " + url + "\n");
dump(" code: " + code + "\n");
diff --git a/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.xul b/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.xul
index d29d5c3..366f5d3 100644
--- a/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.xul
+++ b/chrome/content/sogo-connector/addressbook/addressbook.groupdav.overlay.xul
@@ -44,6 +44,15 @@
+
+
+
+
+
+
diff --git a/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.js b/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.js
index c6a2ef1..df12da7 100644
--- a/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.js
+++ b/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.js
@@ -214,21 +214,59 @@ function _migrateOldCardDAVDirs(prefs, uniqueChildren) {
}
}
+// TODO : better handling of that var
+var SOGO_Timers = [];
+
function startFolderSync() {
let abManager = Components.classes["@mozilla.org/abmanager;1"]
.getService(Components.interfaces.nsIAbManager);
+
let children = abManager.directories;
while (children.hasMoreElements()) {
let ab = children.getNext().QueryInterface(Components.interfaces.nsIAbDirectory);
- if (isGroupdavDirectory(ab.URI)) {
- let synchronizer = new GroupDavSynchronizer(ab.URI, false);
- synchronizer.start();
+ if (isGroupdavDirectory(ab.URI)) {
+ let dirPrefId = ab.dirPrefId;
+ let groupdavPrefService = new GroupdavPreferenceService(dirPrefId);
+ let periodicSync = false;
+ let periodicSyncInterval = 60;
+ let notifications = false;
+ let notificationsOnlyIfNotEmpty = false;
+ try {
+ periodicSync = groupdavPrefService.getPeriodicSync();
+ periodicSyncInterval = groupdavPrefService.getPeriodicSyncInterval();
+ notifications = groupdavPrefService.getNotifications();
+ notificationsOnlyIfNotEmpty = groupdavPrefService.getNotificationsOnlyIfNotEmpty();
+ } catch(e) {
+ }
+
+
+ // handle startup sync
+ sync = GetSyncNotifyGroupdavAddressbook(ab.URI, ab, SOGOC_SYNC_STARTUP);
+ sync.notify();
+
+ if (periodicSync) {
+ // handle future periodic sync
+ psync = GetSyncNotifyGroupdavAddressbook(ab.URI, ab, SOGOC_SYNC_PERIODIC);
+
+ // TODO : handle syncInterval and Notifications in a dynamic way :
+ // today, we have to restart TB if we change those values.
+
+ // Now it is time to create the timer.
+ var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
+
+ let delay = periodicSyncInterval;
+ delay = delay *60; // min --> sec
+ // delay = delay * 3; // min --> sec DEBUG
+ delay = delay * 1000; // sec --> ms
+ timer.initWithCallback(psync, delay, Components.interfaces.nsITimer.TYPE_REPEATING_PRECISE_CAN_SKIP);
+ SOGO_Timers.push(timer);
+ }
}
}
}
function SCSynchronizeFromChildWindow(uri) {
- this.setTimeout(SynchronizeGroupdavAddressbook, 100, uri, null);
+ this.setTimeout(SynchronizeGroupdavAddressbook, 100, uri, null, SOGOC_SYNC_WRITE);
}
window.addEventListener("load", OnLoadMessengerOverlay, false);
diff --git a/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.xul b/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.xul
index 065dae4..30b92a7 100644
--- a/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.xul
+++ b/chrome/content/sogo-connector/addressbook/messenger.groupdav.overlay.xul
@@ -30,4 +30,13 @@
+
+
+
+
+
+
diff --git a/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.js b/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.js
index 6988848..cad7ee0 100644
--- a/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.js
+++ b/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.js
@@ -108,11 +108,34 @@ function onAcceptWebDAV() {
done */);
}
- let groupdavPrefService = new GroupdavPreferenceService(prefId);
- groupdavPrefService.setURL(document.getElementById("groupdavURL").value);
+ try {
+ let groupdavPrefService = new GroupdavPreferenceService(prefId);
+ groupdavPrefService.setURL(document.getElementById("groupdavURL").value);
+
+ groupdavPrefService.setPeriodicSync(document.getElementById("periodicSync").checked);
+ groupdavPrefService.setPeriodicSyncInterval(document.getElementById("periodicSyncInterval").value);
+
+ groupdavPrefService.setNotifications(document.getElementById("notifications").checked);
+ groupdavPrefService.setNotificationsOnlyIfNotEmpty(document.getElementById("notificationsOnlyIfNotEmpty").checked);
+
+ groupdavPrefService.setNotificationsManual(document.getElementById("notificationsManual").checked);
+ groupdavPrefService.setNotificationsSave(document.getElementById("notificationsSave").checked);
+ groupdavPrefService.setNotificationsStart(document.getElementById("notificationsStart").checked);
+ } catch(e) {
+ }
}
function onLoad() {
+ let description = "";
+ let url = "";
+ let periodicSync = false;
+ let periodicSyncInterval = 15;
+ let notifications = true;
+ let notificationsOnlyIfNotEmpty = false;
+ let notificationsManual = true;
+ let notificationsSave = false;
+ let notificationsStart = true;
+
let directory = SCGetCurrentDirectory();
if (directory) {
let uri = directory.URI;
@@ -121,22 +144,58 @@ function onLoad() {
roElem.setAttribute("checked", readOnly);
roElem.disabled = true;
- let description = "";
- let url = "";
-
+
if (readOnly) {
description = directory.dirName;
directory = directory.wrappedJSObject;
url = directory.serverURL;
}
- else {
+
+ try {
let groupdavPrefService = new GroupdavPreferenceService(directory.dirPrefId);
description = directory.dirName;
url = groupdavPrefService.getURL();
+
+ periodicSync = groupdavPrefService.getPeriodicSync();
+ periodicSyncInterval = groupdavPrefService.getPeriodicSyncInterval();
+
+ notifications = groupdavPrefService.getNotifications();
+ notificationsOnlyIfNotEmpty = groupdavPrefService.getNotificationsOnlyIfNotEmpty();
+ notificationsManual = groupdavPrefService.getNotificationsManual();
+ notificationsSave = groupdavPrefService.getNotificationsSave();
+ notificationsStart = groupdavPrefService.getNotificationsStart();
+ } catch(e) {
}
- document.getElementById("description").value = description;
- document.getElementById("groupdavURL").value = url;
+
}
+
+ // always define values
+ document.getElementById("description").value = description;
+ document.getElementById("groupdavURL").value = url;
+
+ document.getElementById("periodicSync").checked = periodicSync;
+ document.getElementById("periodicSyncInterval").value = periodicSyncInterval;
+
+ document.getElementById("notifications").checked = notifications;
+ document.getElementById("notificationsOnlyIfNotEmpty").checked = notificationsOnlyIfNotEmpty;
+ document.getElementById("notificationsManual").checked = notificationsManual;
+ document.getElementById("notificationsSave").checked = notificationsSave;
+ document.getElementById("notificationsStart").checked = notificationsStart;
+
+ onUpdateCheck();
+}
+
+function onUpdateCheck() {
+ var psc = document.getElementById("periodicSync").checked;
+ var nc = document.getElementById("notifications").checked;
+ document.getElementById("periodicSyncInterval").disabled = !psc;
+ document.getElementById("notifications").disabled = !psc;
+ document.getElementById("notificationsOnlyIfNotEmpty").disabled = !nc || !psc;
+}
+
+function onShowRestart() {
+ // show the info about restart
+ document.getElementById("periodicSync_restart").hidden = false;
}
//TODO:catch the directory delete and delete preferences
diff --git a/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.xul b/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.xul
index b372ea3..598986c 100644
--- a/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.xul
+++ b/chrome/content/sogo-connector/addressbook/preferences.addressbook.groupdav.xul
@@ -113,10 +113,65 @@ Modifications by
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+