dovecot-2.1: imapc: Syncing fixes

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 4 18:29:50 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/581597411f6b
changeset: 13388:581597411f6b
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 04 18:29:21 2011 +0300
description:
imapc: Syncing fixes

diffstat:

 src/lib-storage/index/imapc/imapc-mailbox.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r 26c38da7b7fc -r 581597411f6b src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Sun Sep 04 17:59:58 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Sun Sep 04 18:29:21 2011 +0300
@@ -73,6 +73,7 @@
 				  struct imapc_mailbox *mbox)
 {
 	struct mail_index_view *view = mbox->delayed_sync_view;
+	uint32_t rcount = reply->num;
 	const struct mail_index_header *hdr;
 
 	if (mbox == NULL)
@@ -183,8 +184,11 @@
 	msg_count = imapc_msgmap_count(msgmap);
 	if (rseq > msg_count) {
 		/* newly seen message */
-		if (!mbox->syncing || fetch_uid == 0 || rseq != msg_count+1)
+		if (fetch_uid == 0 || rseq != msg_count+1) {
+			/* can't handle this one now. we should get another
+			   FETCH reply for it. */
 			return;
+		}
 		uid = fetch_uid;
 
 		if (uid < imapc_msgmap_uidnext(msgmap)) {
@@ -199,7 +203,7 @@
 		if (uid < mbox->min_append_uid) {
 			/* message is already added to index */
 			lseq = 0;
-		} else {
+		} else if (mbox->syncing) {
 			mail_index_append(mbox->delayed_sync_trans, uid, &lseq);
 			mbox->min_append_uid = uid + 1;
 		}
@@ -213,6 +217,14 @@
 		}
 		lseq = 0;
 	}
+	/* if this is a reply to some FETCH request, update the mail's fields */
+	array_foreach(&mbox->fetch_mails, mailp) {
+		struct imapc_mail *mail = *mailp;
+
+		if (mail->imail.mail.mail.uid == uid)
+			imapc_mail_fetch_update(mail, reply, list);
+	}
+
 	if (lseq == 0) {
 		if (!mail_index_lookup_seq(mbox->delayed_sync_view,
 					   uid, &lseq)) {
@@ -222,14 +234,6 @@
 		rec = mail_index_lookup(mbox->delayed_sync_view, lseq);
 	}
 
-	/* if this is a reply to some FETCH request, update the mail's fields */
-	array_foreach(&mbox->fetch_mails, mailp) {
-		struct imapc_mail *mail = *mailp;
-
-		if (mail->imail.mail.mail.uid == uid)
-			imapc_mail_fetch_update(mail, reply, list);
-	}
-
 	if (rseq == mbox->sync_next_rseq) {
 		/* we're doing the initial full sync of mails. expunge any
 		   mails that no longer exist. */
@@ -244,6 +248,7 @@
 		mbox->sync_next_rseq++;
 		mbox->sync_next_lseq++;
 	}
+
 	if (seen_flags && (rec == NULL || rec->flags != flags)) {
 		mail_index_update_flags(mbox->delayed_sync_trans, lseq,
 					MODIFY_REPLACE, flags);


More information about the dovecot-cvs mailing list