aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-08-23 04:23:16 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-08-23 04:23:16 +0800
commit808e179d48cc2f3f7400b5007949064b147db7e4 (patch)
treeedc6cf1f12781bbfbc6c6d92adad4dea63bec6b1
parentd05a75a2b84c23d1f94233c14a632898663f28d1 (diff)
downloadgsoc2013-evolution-808e179d48cc2f3f7400b5007949064b147db7e4.tar.gz
gsoc2013-evolution-808e179d48cc2f3f7400b5007949064b147db7e4.tar.zst
gsoc2013-evolution-808e179d48cc2f3f7400b5007949064b147db7e4.zip
If current_folder is not NULL and the summary for that folder is dirty,
2002-08-22 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (imap_noop): If current_folder is not NULL and the summary for that folder is dirty, sync the flags rather than sending a NOOP. svn path=/trunk/; revision=17842
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/providers/imap/camel-imap-store.c38
-rw-r--r--camel/providers/imap/camel-imap-utils.c2
3 files changed, 36 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 224b3e2dc6..20bdd64d8e 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,9 @@
2002-08-22 Jeffrey Stedfast <fejj@ximian.com>
+ * providers/imap/camel-imap-store.c (imap_noop): If current_folder
+ is not NULL and the summary for that folder is dirty, sync the
+ flags rather than sending a NOOP.
+
* providers/imap/camel-imap-utils.c (imap_parse_list_response):
Workaround for Courier imap's brokeness when LSUBing the INBOX
folder when it isn't subscribed to. Fixes bug #28929.
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index d269df71a5..63ca5834f7 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1405,23 +1405,47 @@ imap_disconnect_online (CamelService *service, gboolean clean, CamelException *e
return TRUE;
}
+
+static gboolean
+imap_summary_is_dirty (CamelFolderSummary *summary)
+{
+ CamelMessageInfo *info;
+ int max, i;
+
+ max = camel_folder_summary_count (summary);
+ for (i = 0; i < max; i++) {
+ info = camel_folder_summary_index (summary, i);
+ if (info && (info->flags & CAMEL_MESSAGE_FOLDER_FLAGGED))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
imap_noop (CamelStore *store, CamelException *ex)
{
CamelImapStore *imap_store = (CamelImapStore *) store;
CamelDiscoStore *disco = (CamelDiscoStore *) store;
CamelImapResponse *response;
+ CamelFolder *current_folder;
- switch (camel_disco_store_status (disco)) {
- case CAMEL_DISCO_STORE_ONLINE:
- case CAMEL_DISCO_STORE_RESYNCING:
- response = camel_imap_command (imap_store, NULL, NULL, "NOOP");
+ if (camel_disco_store_status (disco) != CAMEL_DISCO_STORE_ONLINE)
+ return;
+
+ CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
+
+ current_folder = imap_store->current_folder;
+ if (current_folder && imap_summary_is_dirty (current_folder->summary)) {
+ /* let's sync the flags instead */
+ camel_folder_sync (current_folder, FALSE, ex);
+ } else {
+ response = camel_imap_command (imap_store, NULL, ex, "NOOP");
if (response)
camel_imap_response_free (imap_store, response);
- break;
- case CAMEL_DISCO_STORE_OFFLINE:
- break;
}
+
+ CAMEL_IMAP_STORE_UNLOCK (imap_store, command_lock);
}
static guint
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index e07d1ccac3..4f0f9f143b 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -380,7 +380,7 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch
* can ya do when ya got the ignorance of marketing breathing
* down your neck?)
*/
- if (is_lsub && !strcasecmp (mailbox, "INBOX"))
+ if (is_lsub && flags && !strcasecmp (mailbox, "INBOX"))
*flags &= ~CAMEL_FOLDER_NOSELECT;
*folder = mailbox;