From: Timo Sirainen Date: Sat, 24 May 2008 22:00:27 +0000 (+0300) Subject: Make sure MAIL_RECENT flag is cleared from index file's flags so it can be X-Git-Tag: 1.1.rc6~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50031a6b36a6051512bd18f39e4bbabe54acf565;p=thirdparty%2Fdovecot%2Fcore.git 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. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-map.c b/src/lib-index/mail-index-map.c index bdb74d206b..75d43165c9 100644 --- a/src/lib-index/mail-index-map.c +++ b/src/lib-index/mail-index-map.c @@ -418,6 +418,17 @@ static bool mail_index_check_header_compat(struct mail_index *index, 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 mail_index_map *map) 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 --git a/src/lib-index/mail-index.h b/src/lib-index/mail-index.h index 9a0b8e71aa..ef5a1fef46 100644 --- a/src/lib-index/mail-index.h +++ b/src/lib-index/mail-index.h @@ -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