changeset 3382:f3696949cb7c HEAD

last-uid fix
author Timo Sirainen <tss@iki.fi>
date Sat, 14 May 2005 17:01:03 +0300
parents 91cc142dd4a2
children bfba2219b586
files src/lib-storage/index/mbox/mbox-sync-rewrite.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Sat May 14 15:51:28 2005 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Sat May 14 17:01:03 2005 +0300
@@ -211,14 +211,19 @@
 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. */
+	/* we wrote the first mail. update last-uid offset so we can find
+	   it later */
 	i_assert(ctx->last_uid_value_start_pos != 0);
 
 	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;
+
+	if (ctx->imapbase_updated) {
+		/* update so a) we don't try to update it later unneededly,
+		   b) if we do actually update it, we see the correct value */
+		ctx->sync_ctx->base_uid_last = ctx->sync_ctx->next_uid - 1;
+	}
 }
 
 int mbox_sync_try_rewrite(struct mbox_sync_mail_context *ctx, off_t move_diff)