aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-store.c18
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)",