mbox->ibox.box.storage = storage;
mbox->ibox.box.list = list;
mbox->ibox.mail_vfuncs = &dbox_mail_vfuncs;
- mbox->ibox.keep_index_backups = TRUE;
- mbox->ibox.index_never_in_memory = TRUE;
index_storage_mailbox_alloc(&mbox->ibox, name, input, flags,
DBOX_INDEX_PREFIX);
MAIL_INDEX_SYNC_TYPE_APPEND |
MAIL_INDEX_SYNC_TYPE_EXPUNGE);
+ mbox->ibox.index_flags |= MAIL_INDEX_OPEN_FLAG_KEEP_BACKUPS |
+ MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY;
+
mbox->storage = (struct dbox_storage *)storage;
mbox->alt_path =
p_strdup(pool, dbox_get_alt_path(list, mbox->ibox.box.path));
i_assert(!box->opened);
- index_flags = mail_storage_settings_to_index_flags(box->storage->set);
- if (!ibox->move_to_memory)
- index_flags |= MAIL_INDEX_OPEN_FLAG_CREATE;
- if (ibox->keep_index_backups)
- index_flags |= MAIL_INDEX_OPEN_FLAG_KEEP_BACKUPS;
- if (ibox->index_never_in_memory) {
- index_flags |= MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY;
+ index_flags = ibox->index_flags;
+ if (ibox->move_to_memory)
+ ibox->index_flags &= ~MAIL_INDEX_OPEN_FLAG_CREATE;
+
+ if ((index_flags & MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) != 0) {
if (mail_index_is_in_memory(ibox->index)) {
mail_storage_set_critical(box->storage,
"Couldn't create index file");
ret = mail_index_open(ibox->index, index_flags, lock_method);
if (ret <= 0 || ibox->move_to_memory) {
- if (ibox->index_never_in_memory) {
+ if ((index_flags & MAIL_INDEX_OPEN_FLAG_NEVER_IN_MEMORY) != 0) {
mail_storage_set_index_error(ibox);
return -1;
}
MAILBOX_LIST_PATH_TYPE_MAILBOX);
ibox->box.path = p_strdup(box->pool, path);
+ ibox->index_flags = MAIL_INDEX_OPEN_FLAG_CREATE |
+ mail_storage_settings_to_index_flags(box->storage->set);
ibox->keep_recent = (flags & MAILBOX_FLAG_KEEP_RECENT) != 0;
ibox->keep_locked = (flags & MAILBOX_FLAG_KEEP_LOCKED) != 0;
struct index_mailbox {
struct mailbox box;
union mail_index_view_module_context view_module_ctx;
+ enum mail_index_open_flags index_flags;
struct mail_index *index;
struct mail_index_view *view;
unsigned int sent_readonly_flags_warning:1;
unsigned int notify_pending:1;
unsigned int move_to_memory:1;
- unsigned int keep_index_backups:1;
- unsigned int index_never_in_memory:1;
};
struct index_transaction_context {