dovecot-1.1: Make sure MAIL_RECENT flag is cleared from index fi...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 25 01:00:31 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/b6b3ea77e83e
changeset: 7536:b6b3ea77e83e
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 25 01:00:27 2008 +0300
description:
Make sure MAIL_RECENT flag is cleared from index file's flags so it can be
used in future for other purposes. Increased minor version number because of
this.

diffstat:

2 files changed, 19 insertions(+), 3 deletions(-)
src/lib-index/mail-index-map.c |   20 ++++++++++++++++++--
src/lib-index/mail-index.h     |    2 +-

diffs (54 lines):

diff -r 0b9a5a7a0b3e -r b6b3ea77e83e src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c	Sun May 25 00:47:27 2008 +0300
+++ b/src/lib-index/mail-index-map.c	Sun May 25 01:00:27 2008 +0300
@@ -418,6 +418,17 @@ static bool mail_index_check_header_comp
 	return TRUE;
 }
 
+static void mail_index_map_clear_recent_flags(struct mail_index_map *map)
+{
+	struct mail_index_record *rec;
+	unsigned int i;
+
+	for (i = 0; i < map->hdr.messages_count; i++) {
+		rec = MAIL_INDEX_MAP_IDX(map, i);
+		rec->flags &= ~MAIL_RECENT;
+	}
+}
+
 int mail_index_map_check_header(struct mail_index_map *map)
 {
 	struct mail_index *index = map->index;
@@ -445,13 +456,18 @@ int mail_index_map_check_header(struct m
 	if (hdr->seen_messages_count > hdr->messages_count ||
 	    hdr->deleted_messages_count > hdr->messages_count)
 		return 0;
-	if (hdr->minor_version == 0) {
+	switch (hdr->minor_version) {
+	case 0:
 		/* upgrade silently from v1.0 */
-		map->hdr.minor_version = MAIL_INDEX_MINOR_VERSION;
 		map->hdr.unused_old_recent_messages_count = 0;
 		if (hdr->first_recent_uid == 0)
 			map->hdr.first_recent_uid = 1;
 		index->need_recreate = TRUE;
+		/* fall through */
+	case 1:
+		/* pre-v1.1.rc6: make sure the \Recent flags are gone */
+		mail_index_map_clear_recent_flags(map);
+		map->hdr.minor_version = MAIL_INDEX_MINOR_VERSION;
 	}
 	if (hdr->first_recent_uid == 0 ||
 	    hdr->first_recent_uid > hdr->next_uid ||
diff -r 0b9a5a7a0b3e -r b6b3ea77e83e src/lib-index/mail-index.h
--- a/src/lib-index/mail-index.h	Sun May 25 00:47:27 2008 +0300
+++ b/src/lib-index/mail-index.h	Sun May 25 01:00:27 2008 +0300
@@ -6,7 +6,7 @@
 #include "seq-range-array.h"
 
 #define MAIL_INDEX_MAJOR_VERSION 7
-#define MAIL_INDEX_MINOR_VERSION 1
+#define MAIL_INDEX_MINOR_VERSION 2
 
 #define MAIL_INDEX_HEADER_MIN_SIZE 120
 


More information about the dovecot-cvs mailing list