[evolution-data-server/gnome-2-30] Add sanity check after QRESYNC



commit cfb0d65d041254790c3dd14ddbd714973e90fb47
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Jul 2 09:43:38 2010 +0100

    Add sanity check after QRESYNC
    
    If the total number of messages, unseen count and modseq don't match
    what we think they should be, then fall back to refetching all flags as
    we would have done without QRESYNC.
    (cherry picked from commit 2497833b3968fe5d8134c919d601a0dd9b23ab74)

 camel/providers/imapx/camel-imapx-server.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 5c67943..f2cbf61 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3780,10 +3780,8 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 			goto done;
 
 		/* If QRESYNC-capable we'll have got all flags changes in SELECT */
-		if (can_qresync) {
-			isum->modseq = ifolder->modseq_on_server;
-			goto done;
-		}
+		if (can_qresync)
+			goto qresync_done;
 	}
 
 	if (!need_rescan)
@@ -3792,8 +3790,23 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 	if (can_qresync) {
 		/* Actually we only want to select it; no need for the NOOP */
 		camel_imapx_server_noop(is, folder, ex);
+	qresync_done:
 		isum->modseq = ifolder->modseq_on_server;
-		goto done;
+		total = camel_folder_summary_count(job->folder->summary);
+		if (total != ifolder->exists_on_server ||
+		    folder->summary->unread_count != ifolder->unread_on_server ||
+		    (isum->modseq != ifolder->modseq_on_server)) {
+			c(printf("Eep, after QRESYNC we're out of sync. total %u / %u, unread %u / %u, modseq %lu / %lu\n",
+				 total, ifolder->exists_on_server,
+				 folder->summary->unread_count, ifolder->unread_on_server,
+				 isum->modseq, ifolder->modseq_on_server));
+		} else {
+			c(printf("OK, after QRESYNC we're still in sync. total %u / %u, unread %u / %u, modseq %lu / %lu\n",
+				 total, ifolder->exists_on_server,
+				 folder->summary->unread_count, ifolder->unread_on_server,
+				 isum->modseq, ifolder->modseq_on_server));
+			goto done;
+		}
 	}
 
 	imapx_job_scan_changes_start (is, job);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]