changeset 3313:2fbb6e7ca781 HEAD

When first message was expunged we might have gotten "uid-last unexpectedly lost" errors.
author Timo Sirainen <tss@iki.fi>
date Fri, 22 Apr 2005 23:31:27 +0300
parents 3cd4ae5f1210
children 3f0c6ed4a950
files src/lib-storage/index/mbox/mbox-sync-rewrite.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Apr 22 22:01:53 2005 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Apr 22 23:31:27 2005 +0300
@@ -208,13 +208,14 @@
 	/* FIXME: see if we could remove X-Keywords header completely */
 }
 
-static void mbox_sync_first_mail_written(struct mbox_sync_mail_context *ctx)
+static void mbox_sync_first_mail_written(struct mbox_sync_mail_context *ctx,
+					 uoff_t hdr_offset)
 {
 	/* we wrote the first mail. update the base_uid_last so we don't try
 	   to update it later unneededly. also update last-uid offset. */
 	i_assert(ctx->last_uid_value_start_pos != 0);
 
-	ctx->sync_ctx->base_uid_last_offset = ctx->hdr_offset +
+	ctx->sync_ctx->base_uid_last_offset = hdr_offset +
 		ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] +
 		ctx->last_uid_value_start_pos;
 	ctx->sync_ctx->base_uid_last = ctx->sync_ctx->next_uid - 1;
@@ -288,7 +289,7 @@
 	}
 
 	if (sync_ctx->dest_first_mail)
-		mbox_sync_first_mail_written(ctx);
+		mbox_sync_first_mail_written(ctx, ctx->hdr_offset + move_diff);
 
 	i_stream_sync(sync_ctx->input);
 	return 1;
@@ -388,7 +389,7 @@
 	}
 
 	if (sync_ctx->dest_first_mail) {
-		mbox_sync_first_mail_written(&mail_ctx);
+		mbox_sync_first_mail_written(&mail_ctx, dest_offset);
 		sync_ctx->dest_first_mail = FALSE;
 	}