aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-04-14 14:53:57 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-04-14 14:53:57 +0800
commitf429462f66d31fab7f1f16c7a94b05c41bc58ee7 (patch)
treeb8d605e976d6abfee17ae5f414d42384c9613293
parent87141d1b51df4638cac9d48f3753748e09203585 (diff)
downloadgsoc2013-evolution-f429462f66d31fab7f1f16c7a94b05c41bc58ee7.tar.gz
gsoc2013-evolution-f429462f66d31fab7f1f16c7a94b05c41bc58ee7.tar.zst
gsoc2013-evolution-f429462f66d31fab7f1f16c7a94b05c41bc58ee7.zip
do offline mail syncing (only for open folders so far). If we fail doing
2004-04-14 Not Zed <NotZed@Ximian.com> * camel-disco-store.c (set_status): do offline mail syncing (only for open folders so far). If we fail doing syncing or store sync, don't abort. svn path=/trunk/; revision=25453
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-disco-store.c37
2 files changed, 38 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6ad5407bc5..78cb12f9eb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-14 Not Zed <NotZed@Ximian.com>
+
+ * camel-disco-store.c (set_status): do offline mail syncing (only
+ for open folders so far). If we fail doing syncing or store sync,
+ don't abort.
+
2004-04-13 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (get_folder_online):
diff --git a/camel/camel-disco-store.c b/camel/camel-disco-store.c
index f674eb797c..a4e2e4990e 100644
--- a/camel/camel-disco-store.c
+++ b/camel/camel-disco-store.c
@@ -29,6 +29,7 @@
#include "camel-disco-store.h"
#include "camel-disco-diary.h"
+#include "camel-disco-folder.h"
#include "camel-exception.h"
#include "camel-session.h"
@@ -300,15 +301,41 @@ camel_disco_store_status (CamelDiscoStore *store)
static void
-set_status (CamelDiscoStore *disco_store, CamelDiscoStoreStatus status,
- CamelException *ex)
+set_status(CamelDiscoStore *disco_store, CamelDiscoStoreStatus status, CamelException *ex)
{
+ CamelException x;
+
if (disco_store->status == status)
return;
- camel_store_sync (CAMEL_STORE (disco_store), FALSE, ex);
- if (camel_exception_is_set (ex))
- return;
+ camel_exception_init(&x);
+ /* Sync the folder fully if we've been told to sync online for this store or this folder
+ and we're going offline */
+ if (disco_store->status == CAMEL_DISCO_STORE_ONLINE
+ && status == CAMEL_DISCO_STORE_OFFLINE) {
+ if (((CamelStore *)disco_store)->folders) {
+ GPtrArray *folders;
+ CamelFolder *folder;
+ int i, sync;
+
+ sync = camel_url_get_param(((CamelService *)disco_store)->url, "offline_sync") != NULL;
+
+ folders = camel_object_bag_list(((CamelStore *)disco_store)->folders);
+ for (i=0;i<folders->len;i++) {
+ folder = folders->pdata[i];
+ if (CAMEL_CHECK_TYPE(folder, CAMEL_DISCO_FOLDER_TYPE)
+ && (sync || ((CamelDiscoFolder *)folder)->offline_sync)) {
+ camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "(match-all)", &x);
+ camel_exception_clear(&x);
+ }
+ camel_object_unref(folder);
+ }
+ g_ptr_array_free(folders, TRUE);
+ }
+ }
+
+ camel_store_sync(CAMEL_STORE (disco_store), FALSE, &x);
+ camel_exception_clear(&x);
if (!camel_service_disconnect (CAMEL_SERVICE (disco_store), TRUE, ex))
return;