changeset 3221:af8fc972fe95 HEAD

If want_mail = TRUE for mbox_save_init() and we sync the mbox, we'll have to open a new view to get the next_uid or it might not be updated.
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Mar 2005 22:17:00 +0200
parents 0220c7d37fc8
children e38e04c7c67c
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Thu Mar 24 22:09:50 2005 +0200
+++ b/src/lib-storage/index/mbox/mbox-save.c	Thu Mar 24 22:17:00 2005 +0200
@@ -184,12 +184,18 @@
 {
 	struct mbox_save_context *ctx = t->save_ctx;
 	const struct mail_index_header *hdr;
+	struct mail_index_view *view;
 
-	hdr = mail_index_get_header(t->ictx.trans_view);
+	/* open a new view to get the header. this is required if we just
+	   synced the mailbox so we can get updated next_uid. */
+	view = mail_index_view_open(t->ictx.ibox->index);
+	hdr = mail_index_get_header(view);
 
 	ctx->next_uid = hdr->next_uid;
 	ctx->synced = TRUE;
         t->mbox_modified = TRUE;
+
+	mail_index_view_close(view);
 }
 
 static void status_flags_append(string_t *str, enum mail_flags flags,