[dovecot-cvs] dovecot/src/lib-index mail-index-view-sync.c, 1.50, 1.51

tss-movial at dovecot.org tss-movial at dovecot.org
Mon Apr 24 12:19:35 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv16121

Modified Files:
	mail-index-view-sync.c 
Log Message:
When beginning to sync from old view, don't keep the old header completely, because there may have been some important new changes. Copy only the message counts and such manually now. Fixes an error message when sometimes adding keywords.



Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- mail-index-view-sync.c	23 Feb 2006 18:25:49 -0000	1.50
+++ mail-index-view-sync.c	24 Apr 2006 09:19:33 -0000	1.51
@@ -163,6 +163,29 @@
 	return 0;
 }
 
+static void mail_index_view_hdr_update(struct mail_index_view *view,
+				       struct mail_index_map *map)
+{
+	/* Keep message count the same. */
+	map->hdr.next_uid = view->hdr.next_uid;
+	map->hdr.messages_count = view->hdr.messages_count;
+
+	/* Keep the old message flag counts also, although they may be
+	   somewhat stale already. We just don't want them to be more than
+	   our old messages_count. */
+	map->hdr.recent_messages_count = view->hdr.recent_messages_count;
+	map->hdr.seen_messages_count = view->hdr.seen_messages_count;
+	map->hdr.deleted_messages_count = view->hdr.deleted_messages_count;
+
+	/* Keep log position so we know where to continue syncing */
+	map->hdr.log_file_seq = view->hdr.log_file_seq;
+	map->hdr.log_file_int_offset = view->hdr.log_file_int_offset;
+	map->hdr.log_file_ext_offset = view->hdr.log_file_ext_offset;
+
+	view->hdr = map->hdr;
+	buffer_write(map->hdr_copy_buf, 0, &map->hdr, sizeof(map->hdr));
+}
+
 #define MAIL_INDEX_VIEW_VISIBLE_FLAGS_MASK \
 	(MAIL_INDEX_SYNC_TYPE_FLAGS | \
 	 MAIL_INDEX_SYNC_TYPE_KEYWORD_RESET | \
@@ -268,9 +291,7 @@
 			   another view sharing the map with us had synced
 			   itself. */
 			i_assert(map->hdr_base == map->hdr_copy_buf->data);
-			buffer_write(map->hdr_copy_buf, 0,
-				     &view->hdr, sizeof(view->hdr));
-			map->hdr = view->hdr;
+			mail_index_view_hdr_update(view, map);
 		}
 
 		i_assert(map->records_count == map->hdr.messages_count);



More information about the dovecot-cvs mailing list