changeset 2610:664c732ae195 HEAD

Last from offset sync fix broke everything. Another try.
author Timo Sirainen <tss@iki.fi>
date Sat, 11 Sep 2004 21:30:50 +0300
parents 71a0b646fd28
children 8ab92fe191c9
files src/lib-storage/index/mbox/mbox-sync-private.h src/lib-storage/index/mbox/mbox-sync.c
diffstat 2 files changed, 7 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-private.h	Sat Sep 11 21:14:24 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-private.h	Sat Sep 11 21:30:50 2004 +0300
@@ -37,6 +37,7 @@
 
 struct mbox_sync_mail {
 	uint32_t uid;
+	uint32_t idx_seq;
 	uint8_t flags;
 	keywords_mask_t keywords;
 
--- a/src/lib-storage/index/mbox/mbox-sync.c	Sat Sep 11 21:14:24 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sat Sep 11 21:30:50 2004 +0300
@@ -470,7 +470,7 @@
 static int update_from_offsets(struct mbox_sync_context *sync_ctx)
 {
 	const struct mbox_sync_mail *mails;
-	uint32_t idx, idx_seq, uid, extra_idx;
+	uint32_t idx, extra_idx;
 	uint64_t offset;
 	size_t size;
 
@@ -480,37 +480,13 @@
 	size /= sizeof(*mails);
 	i_assert(sync_ctx->seq - sync_ctx->need_space_seq + 1 == size);
 
-	idx_seq = 0;
 	for (idx = 0; idx < size; idx++) {
-		if (mails[idx].uid == 0)
+		if (mails[idx].idx_seq == 0)
 			continue;
 
-		if (idx_seq != 0) {
-			/* it's probably the next one */
-			idx_seq++;
-			if (mail_index_lookup_uid(sync_ctx->sync_view, idx_seq,
-						  &uid) < 0) {
-				mail_storage_set_index_error(sync_ctx->ibox);
-				return -1;
-			}
-			if (uid != mails[idx].uid)
-				idx_seq = 0;
-		}
-
-		if (idx_seq == 0) {
-			if (mail_index_lookup_uid_range(sync_ctx->sync_view,
-							mails[idx].uid,
-							mails[idx].uid,
-							&idx_seq,
-							&idx_seq) < 0) {
-				mail_storage_set_index_error(sync_ctx->ibox);
-				return -1;
-			}
-		}
-
 		offset = mails[idx].from_offset;
-		mail_index_update_extra_rec(sync_ctx->t, idx_seq, extra_idx,
-					    &offset);
+		mail_index_update_extra_rec(sync_ctx->t, mails[idx].idx_seq,
+					    extra_idx, &offset);
 	}
 	return 0;
 }
@@ -795,6 +771,8 @@
 			sync_ctx->prev_msg_uid = mail_ctx->mail.uid;
 		}
 
+		mail_ctx->mail.idx_seq = sync_ctx->idx_seq;
+
 		if (!expunged) {
 			ret = mbox_sync_handle_header(mail_ctx);
 			sync_ctx->dest_first_mail = FALSE;