diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2005-01-07 06:12:57 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2005-01-07 06:12:57 +0800 |
commit | 5effb957e90226a4c99e9f9bbbf6b27378d943c8 (patch) | |
tree | 3e13d2c695953472661b536ff24334ebbdcceb61 /mail | |
parent | 2c781417e6356ca0b5ce223ef2e3297b52396fea (diff) | |
download | gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar.gz gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar.bz2 gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar.lz gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar.xz gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.tar.zst gsoc2013-evolution-5effb957e90226a4c99e9f9bbbf6b27378d943c8.zip |
Handle the CamelOfflineStore case just like the CamelDiscoStore case.
2005-01-06 Jeffrey Stedfast <fejj@novell.com>
* mail-folder-cache.c (mail_note_store): Handle the
CamelOfflineStore case just like the CamelDiscoStore case.
* mail-ops.c (prep_offline_do): Since we can't kill off
CamelDisco* (groupwise is using it), we have to handle both
CamelOfflineFolder and CamelDiscoFolder for now.
(set_offline_do): Same.
svn path=/trunk/; revision=28256
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 49 | ||||
-rw-r--r-- | mail/mail-ops.c | 16 |
3 files changed, 53 insertions, 22 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index c6041a0119..83db804e81 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2005-01-06 Jeffrey Stedfast <fejj@novell.com> + + * mail-folder-cache.c (mail_note_store): Handle the + CamelOfflineStore case just like the CamelDiscoStore case. + + * mail-ops.c (prep_offline_do): Since we can't kill off + CamelDisco* (groupwise is using it), we have to handle both + CamelOfflineFolder and CamelDiscoFolder for now. + (set_offline_do): Same. + 2005-01-05 Not Zed <NotZed@Ximian.com> * em-menu.c: (emph_targets[]): Add the widget target, missed this. diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 9c96112514..689b7c5c76 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -40,6 +40,7 @@ #include <camel/camel-folder.h> #include <camel/camel-vtrash-folder.h> #include <camel/camel-vee-store.h> +#include <camel/camel-offline-store.h> #include <camel/camel-disco-store.h> #include "mail-mt.h" @@ -924,32 +925,36 @@ mail_note_store(CamelStore *store, CamelOperation *op, e_dlist_init(&si->folderinfo_updates); hook = TRUE; } - + + ud = g_malloc(sizeof(*ud)); + ud->done = done; + ud->data = data; + ud->cancel = 0; + /* We might get a race when setting up a store, such that it is still left in offline mode, after we've gone online. This catches and fixes it up when the shell opens us */ - if (CAMEL_IS_DISCO_STORE(store) - && camel_session_is_online(session) - && camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) { - ud = g_malloc(sizeof(*ud)); - ud->done = done; - ud->data = data; - ud->cancel = 0; - /* Note: we use the 'id' here, even though its not the right id, its still ok */ - ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud); - - e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); - } else if (!CAMEL_IS_DISCO_STORE(store) - || camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_ONLINE - || camel_disco_store_can_work_offline (CAMEL_DISCO_STORE (store))) { - ud = g_malloc (sizeof (*ud)); - ud->done = done; - ud->data = data; - ud->cancel = 0; + if (CAMEL_IS_DISCO_STORE (store)) { + if (camel_session_is_online (session) + && camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) { + /* Note: we use the 'id' here, even though its not the right id, its still ok */ + ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud); + } else { + goto normal_setup; + } + } else if (CAMEL_IS_OFFLINE_STORE (store)) { + if (camel_session_is_online (session) && CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + /* Note: we use the 'id' here, even though its not the right id, its still ok */ + ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud); + } else { + goto normal_setup; + } + } else { + normal_setup: ud->id = mail_get_folderinfo (store, op, update_folders, ud); - - e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); } - + + e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); + UNLOCK(info_lock); /* there is potential for race here, but it is safe as we check for the store anyway */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 1d7c7b710d..76fe6a5533 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -42,6 +42,8 @@ #include <camel/camel-stream-filter.h> #include <camel/camel-stream-fs.h> #include <camel/camel-mime-filter-charset.h> +#include <camel/camel-offline-folder.h> +#include <camel/camel-offline-store.h> #include <camel/camel-disco-folder.h> #include <camel/camel-disco-store.h> #include <camel/camel-operation.h> @@ -2107,6 +2109,8 @@ static void prep_offline_do(struct _mail_msg *mm) camel_disco_folder_prepare_for_offline((CamelDiscoFolder *)folder, "(match-all)", &mm->ex); + } else if (CAMEL_IS_OFFLINE_FOLDER (folder)) { + camel_offline_folder_downsync ((CamelOfflineFolder *) folder, "(match-all)", &mm->ex); } /* prepare_for_offline should do this? */ /* of course it should all be atomic, but ... */ @@ -2200,6 +2204,18 @@ static void set_offline_do(struct _mail_msg *mm) &mm->ex); return; } + } else if (CAMEL_IS_OFFLINE_STORE (m->store)) { + if (!m->offline) { + camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (m->store), + CAMEL_OFFLINE_STORE_NETWORK_AVAIL, + &mm->ex); + return; + } else { + camel_offline_store_set_network_state (CAMEL_OFFLINE_STORE (m->store), + CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL, + &mm->ex); + return; + } } if (m->offline) |