sync_ctx->ilist->ext_id, &irec, NULL);
node->corrupted_ext = FALSE;
}
- if ((node->flags & MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME) != 0) {
+ if (node->corrupted_flags) {
+ mail_index_update_flags(sync_ctx->trans, seq, MODIFY_REPLACE,
+ (enum mail_flags)node->flags);
+ node->corrupted_flags = FALSE;
+ } else if ((node->flags & MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME) != 0) {
/* rely on lib-index to drop unnecessary updates */
mail_index_update_flags(sync_ctx->trans, seq, MODIFY_ADD,
(enum mail_flags)MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME);
}
irec = data;
+ if (!ilist->has_backing_store && guid_128_is_empty(irec->guid) &&
+ (rec->flags & (MAILBOX_LIST_INDEX_FLAG_NONEXISTENT |
+ MAILBOX_LIST_INDEX_FLAG_NOSELECT)) == 0) {
+ /* no backing store and mailbox has no GUID.
+ it can't be selectable, but the flag is missing. */
+ node->flags |= MAILBOX_LIST_INDEX_FLAG_NOSELECT;
+ *error_r = "mailbox is missing guid - "
+ "setting it non-selectable";
+ node->corrupted_flags = TRUE;
+ }
+
node->name_id = irec->name_id;
if (node->name_id == 0) {
/* invalid name_id - assign a new one */
enum mailbox_list_index_flags flags;
/* extension data is corrupted on disk - need to update it */
bool corrupted_ext;
+ /* flags are corrupted on disk - need to update it */
+ bool corrupted_flags;
const char *name;
};