diff options
author | Dan Winship <danw@src.gnome.org> | 2001-01-11 01:10:44 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-01-11 01:10:44 +0800 |
commit | 54c085cc3cec41cc3d5a77efadb98450a7c5b4b6 (patch) | |
tree | d2a6bb21bfc182acdfb83535dd8b311abb5fb4ad /camel/providers | |
parent | 4d9047b9b04e1dc5fc74d8bcc2bd360948d6dd76 (diff) | |
download | gsoc2013-evolution-54c085cc3cec41cc3d5a77efadb98450a7c5b4b6.tar.gz gsoc2013-evolution-54c085cc3cec41cc3d5a77efadb98450a7c5b4b6.tar.zst gsoc2013-evolution-54c085cc3cec41cc3d5a77efadb98450a7c5b4b6.zip |
New class function, parallel to camel_folder_sync. (The default
* camel-store.c (camel_store_sync): New class function, parallel
to camel_folder_sync. (The default implementation just calls
camel_folder_sync on each cached folder.)
* providers/imap/camel-imap-store.c (get_folder_info): Call
camel_store_sync before doing anything else so that the IMAP
server and Camel are working from the same data. Don't ask the
server for the unread message count of the current folder, since
UW will return often-incorrect cached data, and we can calculate
it without talking to the server anyway.
svn path=/trunk/; revision=7365
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index d3701ca5b7..ca4ca2e0d7 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -773,6 +773,13 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex)) return NULL; + /* Sync flag changes to the server so it has the same ideas about + * read/unread as we do. + */ + camel_store_sync (store, ex); + if (camel_exception_is_set (ex)) + return NULL; + name = top; if (!name) { need_inbox = TRUE; @@ -838,6 +845,17 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, if (!fi->url || fi->unread_message_count != -1) continue; + /* UW will give cached data for the currently + * selected folder. Grr. Well, I guess this + * also potentially saves us one IMAP command. + */ + if (imap_store->current_folder && + !strcmp (imap_store->current_folder->full_name, + fi->full_name)) { + fi->unread_message_count = camel_folder_get_unread_message_count (imap_store->current_folder); + continue; + } + CAMEL_IMAP_STORE_LOCK (imap_store, command_lock); response = camel_imap_command (imap_store, NULL, NULL, "STATUS %S (UNSEEN)", |