changeset 5303:70fea9bab837 HEAD

View syncing fixes
author Timo Sirainen <tss@iki.fi>
date Wed, 14 Mar 2007 15:49:21 +0200
parents db232a079106
children afcb29d8faff
files src/lib-index/mail-index-view-sync.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-view-sync.c	Wed Mar 14 14:42:27 2007 +0200
+++ b/src/lib-index/mail-index-view-sync.c	Wed Mar 14 15:49:21 2007 +0200
@@ -452,7 +452,7 @@
 
 		/* Apply transaction to view's mapping if needed (meaning we
 		   didn't just re-map the view to head mapping). */
-		if (ctx->sync_map_update) {
+		if (ctx->sync_map_update && !synced_to_map) {
 			i_assert((ctx->hdr->type &
 				  MAIL_TRANSACTION_EXPUNGE) == 0);
 
@@ -646,10 +646,22 @@
 	}
 
 	if (ctx->sync_map_update) {
-		view->map->hdr.log_file_seq = view->log_file_seq;
-		view->map->hdr.log_file_int_offset =
+		if (view->log_file_seq != view->map->hdr.log_file_seq) {
+			i_assert(view->log_file_seq >
+				 view->map->hdr.log_file_seq);
+			view->map->hdr.log_file_seq = view->log_file_seq;
 			view->map->hdr.log_file_ext_offset =
-			view->log_file_offset;
+				view->log_file_offset;
+		} else {
+			i_assert(view->log_file_offset >=
+				 view->map->hdr.log_file_int_offset);
+			if (view->log_file_offset >
+			    view->map->hdr.log_file_ext_offset) {
+				view->map->hdr.log_file_ext_offset =
+					view->log_file_offset;
+			}
+		}
+		view->map->hdr.log_file_int_offset = view->log_file_offset;
 	}
 	view->hdr = view->map->hdr;