Mercurial > dovecot > core-2.2
diff src/lib-storage/list/mailbox-list-index.c @ 22697:bc0c97a0c7d6
LAYOUT=index: Rebuild list index if INBOX is missing on inbox=yes namespace
This avoids having to manually rebuild the list index afterwards if it
becomes lost.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Wed, 29 Nov 2017 14:51:02 +0200 |
parents | 090bb542ae58 |
children | 324bc758ebf7 |
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index.c Wed Nov 29 15:39:45 2017 +0200 +++ b/src/lib-storage/list/mailbox-list-index.c Wed Nov 29 14:51:02 2017 +0200 @@ -398,6 +398,8 @@ parent->children = node; continue; } + } else if (strcasecmp(node->name, "INBOX") == 0) { + ilist->rebuild_on_missing_inbox = FALSE; } if (hash_table_lookup(duplicate_hash, node) == NULL) hash_table_insert(duplicate_hash, node, node); @@ -592,6 +594,8 @@ if (ilist->call_corruption_callback) reason = MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_CORRUPTED; + else if (ilist->rebuild_on_missing_inbox) + reason = MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_NO_INBOX; else return 0; @@ -624,6 +628,7 @@ struct mailbox_list_index_sync_context *sync_ctx; ilist->call_corruption_callback = FALSE; + ilist->rebuild_on_missing_inbox = FALSE; if (mailbox_list_index_sync_begin(list, &sync_ctx) < 0) return -1; @@ -904,6 +909,8 @@ ilist->path = dir == NULL ? "(in-memory mailbox list index)" : p_strdup_printf(list->pool, "%s/%s", dir, list->set.list_index_fname); ilist->index = mail_index_alloc(dir, list->set.list_index_fname); + ilist->rebuild_on_missing_inbox = + (list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0; ilist->ext_id = mail_index_ext_register(ilist->index, "list", sizeof(struct mailbox_list_index_header),