[evolution-data-server] Fix APPENDUID handling of uidvalidity.



commit 573ad77df8814a5f72593292bc6e96ef4140e1a3
Author: David Woodhouse <David Woodhouse intel com>
Date:   Tue Jun 29 16:45:56 2010 +0100

    Fix APPENDUID handling of uidvalidity.
    
    We shouldn't be comparing with is->uidvalidity; that's just short-term
    storage for use _during_ a SELECT. Compare with ifolder->uidvalidity instead.
    
    Oh, and let's try to make sure that's actually set somewhere...

 camel/providers/imapx/camel-imapx-folder.h |    1 +
 camel/providers/imapx/camel-imapx-server.c |    8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-folder.h b/camel/providers/imapx/camel-imapx-folder.h
index 9bbccea..1ac0b18 100644
--- a/camel/providers/imapx/camel-imapx-folder.h
+++ b/camel/providers/imapx/camel-imapx-folder.h
@@ -60,6 +60,7 @@ struct _CamelIMAPXFolder {
 	guint32 exists_on_server;
 	guint32 unread_on_server;
 	guint64 modseq_on_server;
+	guint64 uidvalidity_on_server;
 	guint32 uidnext_on_server;
 
 	/* hash table of UIDs to ignore as recent when updating folder */
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 9eb6e50..e04a20a 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1516,6 +1516,7 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 				ifolder->exists_on_server = sinfo->messages;
 				ifolder->modseq_on_server = sinfo->highestmodseq;
 				ifolder->uidnext_on_server = sinfo->uidnext;
+				ifolder->uidvalidity_on_server = sinfo->uidvalidity;
 			} else {
 				c(printf("Received STATUS for unknown folder '%s'\n", sinfo->name));
 			}
@@ -2284,6 +2285,7 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 		ifolder->exists_on_server = is->exists;
 		ifolder->modseq_on_server = is->highestmodseq;
 		ifolder->uidnext_on_server = is->uidnext;
+		ifolder->uidvalidity_on_server = is->uidvalidity;
 #if 0
 		/* This must trigger a complete index rebuild! */
 		if (is->uidvalidity && is->uidvalidity != ((CamelIMAPXSummary *)is->select_folder->summary)->uidvalidity)
@@ -3126,7 +3128,7 @@ imapx_command_append_message_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 	if (!camel_exception_is_set (ic->ex) && ic->status->result == IMAPX_OK) {
 		if (ic->status->condition == IMAPX_APPENDUID) {
 			c(printf("Got appenduid %d %d\n", (gint)ic->status->u.appenduid.uidvalidity, (gint)ic->status->u.appenduid.uid));
-			if (ic->status->u.appenduid.uidvalidity == is->uidvalidity) {
+			if (ic->status->u.appenduid.uidvalidity == ifolder->uidvalidity_on_server) {
 				CamelFolderChangeInfo *changes;
 				gchar *uid;
 
@@ -3660,9 +3662,9 @@ imapx_job_refresh_info_start (CamelIMAPXServer *is, CamelIMAPXJob *job)
 			}
 		} else {
 			if (is->cinfo->capa & IMAPX_CAPABILITY_CONDSTORE)
-				ic = camel_imapx_command_new (is, "STATUS", NULL, "STATUS %f (MESSAGES UNSEEN UIDNEXT HIGHESTMODSEQ)", folder);
+				ic = camel_imapx_command_new (is, "STATUS", NULL, "STATUS %f (MESSAGES UNSEEN UIDVALIDITY UIDNEXT HIGHESTMODSEQ)", folder);
 			else
-				ic = camel_imapx_command_new (is, "STATUS", NULL, "STATUS %f (MESSAGES UNSEEN UIDNEXT)", folder);
+				ic = camel_imapx_command_new (is, "STATUS", NULL, "STATUS %f (MESSAGES UNSEEN UIDVALIDITY UIDNEXT)", folder);
 		
 			ic->job = job;
 			ic->pri = job->pri;



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