]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Make sure MAIL_RECENT flag is cleared from index file's flags so it can be
authorTimo Sirainen <tss@iki.fi>
Sat, 24 May 2008 22:00:27 +0000 (01:00 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 24 May 2008 22:00:27 +0000 (01:00 +0300)
used in future for other purposes. Increased minor version number because of
this.

--HG--
branch : HEAD

src/lib-index/mail-index-map.c
src/lib-index/mail-index.h

index bdb74d206b99c23a864f4f59848e4e3eb16c67ce..75d43165c96cd56fc95bffcd09fa49eeec9aca26 100644 (file)
@@ -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 ||
index 9a0b8e71aa09613ca4cc4a8ae7756d2994721028..ef5a1fef4654e1a14fd45156968471992af87d7b 100644 (file)
@@ -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