index_storage_mailbox_enable,
cydir_mailbox_open,
index_storage_mailbox_close,
+ NULL,
cydir_mailbox_create,
index_storage_mailbox_update,
index_storage_mailbox_delete,
index_storage_mailbox_enable,
dbox_mailbox_open,
index_storage_mailbox_close,
+ NULL,
dbox_mailbox_create,
mdbox_mailbox_update,
mdbox_mailbox_delete,
index_storage_mailbox_enable,
dbox_mailbox_open,
index_storage_mailbox_close,
+ NULL,
dbox_mailbox_create,
dbox_mailbox_update,
index_storage_mailbox_delete,
box->opened = TRUE;
- index_thread_mailbox_opened(box);
if (hook_mailbox_opened != NULL)
hook_mailbox_opened(box);
mail_index_set_permissions(box->index, box->file_create_mode,
box->file_create_gid,
box->file_create_gid_origin);
+
+ index_thread_mailbox_allocated(box);
}
int index_storage_mailbox_enable(struct mailbox *box,
enum mail_thread_type thread_type,
bool return_seqs);
-void index_thread_mailbox_opened(struct mailbox *box);
+void index_thread_mailbox_allocated(struct mailbox *box);
#endif
if (tbox->strmap_view != NULL)
mail_index_strmap_view_close(&tbox->strmap_view);
- mail_index_strmap_deinit(&tbox->strmap);
if (tbox->cache->search_result != NULL)
mailbox_search_result_free(&tbox->cache->search_result);
+ tbox->module_ctx.super.close(box);
+}
+
+static void mail_thread_mailbox_free(struct mailbox *box)
+{
+ struct mail_thread_mailbox *tbox = MAIL_THREAD_CONTEXT(box);
+
+ mail_index_strmap_deinit(&tbox->strmap);
+ tbox->module_ctx.super.free(box);
+
array_free(&tbox->cache->thread_nodes);
i_free(tbox->cache);
-
- tbox->module_ctx.super.close(box);
i_free(tbox);
}
-void index_thread_mailbox_opened(struct mailbox *box)
+void index_thread_mailbox_allocated(struct mailbox *box)
{
struct mail_thread_mailbox *tbox;
tbox = i_new(struct mail_thread_mailbox, 1);
tbox->module_ctx.super = box->v;
box->v.close = mail_thread_mailbox_close;
+ box->v.free = mail_thread_mailbox_free;
tbox->strmap = mail_index_strmap_init(box->index,
MAIL_THREAD_INDEX_SUFFIX);
mbox->maildir_ext_id =
mail_index_ext_register(mbox->box.index, "maildir",
sizeof(mbox->maildir_hdr), 0, 0);
- mbox->uidlist = maildir_uidlist_init(mbox);
- mbox->keywords = maildir_keywords_init(mbox);
return &mbox->box;
}
struct stat st;
const char *shared_path;
+ mbox->uidlist = maildir_uidlist_init(mbox);
+ mbox->keywords = maildir_keywords_init(mbox);
+
shared_path = t_strconcat(box->path, "/dovecot-shared", NULL);
if (stat(shared_path, &st) == 0)
box->private_flags_mask = MAIL_SEEN;
index_storage_mailbox_enable,
maildir_mailbox_open,
maildir_mailbox_close,
+ NULL,
maildir_mailbox_create,
maildir_mailbox_update,
index_storage_mailbox_delete,
index_storage_mailbox_enable,
mbox_mailbox_open,
mbox_mailbox_close,
+ NULL,
mbox_mailbox_create,
mbox_mailbox_update,
index_storage_mailbox_delete,
index_storage_mailbox_enable,
raw_mailbox_open,
index_storage_mailbox_close,
+ NULL,
raw_mailbox_create,
raw_mailbox_update,
index_storage_mailbox_delete,
int (*enable)(struct mailbox *box, enum mailbox_feature features);
int (*open)(struct mailbox *box);
void (*close)(struct mailbox *box);
+ void (*free)(struct mailbox *box);
int (*create)(struct mailbox *box, const struct mailbox_update *update,
bool directory);
*_box = NULL;
mailbox_close(box);
+
+ if (box->v.free != NULL)
+ box->v.free(box);
mail_index_alloc_cache_unref(&box->index);
pool_unref(&box->pool);
}
test_mailbox_enable,
test_mailbox_open,
test_mailbox_close,
+ NULL,
test_mailbox_create,
test_mailbox_update,
test_mailbox_delete,
return acl_mailbox_right_lookup(box, ACL_STORAGE_RIGHT_WRITE) > 0;
}
-static void acl_mailbox_close(struct mailbox *box)
+static void acl_mailbox_free(struct mailbox *box)
{
struct acl_mailbox *abox = ACL_CONTEXT(box);
acl_object_deinit(&abox->aclobj);
- abox->module_ctx.super.close(box);
+ abox->module_ctx.super.free(box);
}
static void acl_mailbox_copy_acls_from_parent(struct mailbox *box)
box->v.is_readonly = acl_is_readonly;
box->v.allow_new_keywords = acl_allow_new_keywords;
box->v.open = acl_mailbox_open;
- box->v.close = acl_mailbox_close;
+ box->v.free = acl_mailbox_free;
box->v.create = acl_mailbox_create;
box->v.update = acl_mailbox_update;
box->v.delete = acl_mailbox_delete;
&mail_storage_module_register);
static MODULE_CONTEXT_DEFINE_INIT(fts_mail_module, &mail_module_register);
-static void fts_mailbox_close(struct mailbox *box)
+static void fts_mailbox_free(struct mailbox *box)
{
struct fts_mailbox *fbox = FTS_CONTEXT(box);
if (fbox->backend_fast != NULL)
fts_backend_deinit(&fbox->backend_fast);
- fbox->module_ctx.super.close(box);
+ fbox->module_ctx.super.free(box);
i_free(fbox);
}
fbox->virtual = strcmp(box->storage->name, "virtual") == 0;
fbox->env = env;
fbox->module_ctx.super = box->v;
- box->v.close = fts_mailbox_close;
+ box->v.free = fts_mailbox_free;
box->v.search_init = fts_mailbox_search_init;
box->v.search_next_nonblock = fts_mailbox_search_next_nonblock;
box->v.search_next_update_seq = fbox->virtual ?
return qbox->module_ctx.super.delete(box);
}
-static void quota_mailbox_close(struct mailbox *box)
+static void quota_mailbox_free(struct mailbox *box)
{
struct quota_mailbox *qbox = QUOTA_CONTEXT(box);
i_assert(qbox->expunge_qt == NULL ||
qbox->expunge_qt->tmp_mail == NULL);
- qbox->module_ctx.super.close(box);
+ qbox->module_ctx.super.free(box);
}
void quota_mailbox_allocated(struct mailbox *box)
box->v.sync_notify = quota_mailbox_sync_notify;
box->v.sync_deinit = quota_mailbox_sync_deinit;
box->v.delete = quota_mailbox_delete;
- box->v.close = quota_mailbox_close;
+ box->v.free = quota_mailbox_free;
MODULE_CONTEXT_SET(box, quota_storage_module, qbox);
}
index_storage_mailbox_enable,
virtual_mailbox_open,
virtual_mailbox_close,
+ NULL,
virtual_mailbox_create,
virtual_mailbox_update,
index_storage_mailbox_delete,