return abox->module_ctx.super.open(box);
}
-struct mailbox *
-acl_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
- const char *name, struct istream *input,
- enum mailbox_flags flags)
+void acl_mailbox_allocated(struct mailbox *box)
{
- union mail_storage_module_context *astorage = ACL_CONTEXT(storage);
- struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(list);
+ struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(box->list);
struct acl_mailbox *abox;
- struct mailbox *box;
- box = astorage->super.mailbox_alloc(storage, list, name, input, flags);
+ if (alist == NULL) {
+ /* ACLs disabled */
+ return;
+ }
abox = p_new(box->pool, struct acl_mailbox, 1);
abox->module_ctx.super = box->v;
box->v.transaction_commit = acl_transaction_commit;
}
MODULE_CONTEXT_SET(box, acl_storage_module, abox);
- return box;
}
static struct mail_storage_hooks acl_mail_storage_hooks = {
.mail_user_created = acl_mail_user_created,
- .mail_storage_created = acl_mail_storage_created,
- .mail_namespace_storage_added = acl_mail_namespace_storage_added
+ .mail_namespace_storage_added = acl_mail_namespace_storage_added,
+ .mailbox_allocated = acl_mailbox_allocated
};
void acl_plugin_init(struct module *module)
extern MODULE_CONTEXT_DEFINE(acl_mailbox_list_module,
&mailbox_list_module_register);
-void acl_mail_storage_created(struct mail_storage *storage);
void acl_mail_namespace_storage_added(struct mail_namespace *ns);
void acl_mail_user_created(struct mail_user *list);
-struct mailbox *
-acl_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
- const char *name, struct istream *input,
- enum mailbox_flags flags);
+void acl_mailbox_allocated(struct mailbox *box);
struct acl_backend *acl_mailbox_list_get_backend(struct mailbox_list *list);
int acl_mailbox_list_have_right(struct mailbox_list *list, const char *name,
struct acl_user_module acl_user_module =
MODULE_CONTEXT_INIT(&mail_user_module_register);
-void acl_mail_storage_created(struct mail_storage *storage)
-{
- struct acl_user *auser = ACL_USER_CONTEXT(storage->user);
- union mail_storage_module_context *astorage;
-
- if (auser == NULL) {
- /* ACLs disabled for this user */
- return;
- }
-
- astorage = p_new(storage->pool, union mail_storage_module_context, 1);
- astorage->super = storage->v;
- storage->v.mailbox_alloc = acl_mailbox_alloc;
-
- MODULE_CONTEXT_SET_SELF(storage, acl_storage_module, astorage);
-}
-
static void acl_user_deinit(struct mail_user *user)
{
struct acl_user *auser = ACL_USER_CONTEXT(user);
lbox->super.transaction_rollback(t);
}
-static struct mailbox *
-notify_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
- const char *name, struct istream *input,
- enum mailbox_flags flags)
+static void notify_mailbox_allocated(struct mailbox *box)
{
- union mail_storage_module_context *lstorage = NOTIFY_CONTEXT(storage);
- struct mailbox *box;
union mailbox_module_context *lbox;
- box = lstorage->super.mailbox_alloc(storage, list, name, input, flags);
-
lbox = p_new(box->pool, union mailbox_module_context, 1);
lbox->super = box->v;
box->v.transaction_commit = notify_transaction_commit;
box->v.transaction_rollback = notify_transaction_rollback;
MODULE_CONTEXT_SET_SELF(box, notify_storage_module, lbox);
- return box;
}
static int
return 0;
}
-static void notify_mail_storage_created(struct mail_storage *storage)
-{
- union mail_storage_module_context *lstorage;
-
- lstorage = p_new(storage->pool, union mail_storage_module_context, 1);
- lstorage->super = storage->v;
- storage->v.mailbox_alloc = notify_mailbox_alloc;
-
- MODULE_CONTEXT_SET_SELF(storage, notify_storage_module, lstorage);
-}
-
static void notify_mail_namespace_storage_added(struct mail_namespace *ns)
{
struct mailbox_list *list = ns->list;
}
static struct mail_storage_hooks notify_mail_storage_hooks = {
- .mail_storage_created = notify_mail_storage_created,
+ .mailbox_allocated = notify_mailbox_allocated,
.mail_namespace_storage_added = notify_mail_namespace_storage_added
};
static struct mail_storage_hooks quota_mail_storage_hooks = {
.mail_user_created = quota_mail_user_created,
.mail_namespaces_created = quota_mail_namespaces_created,
- .mail_storage_created = quota_mail_storage_created,
- .mail_namespace_storage_added = quota_mail_namespace_storage_added
+ .mail_namespace_storage_added = quota_mail_namespace_storage_added,
+ .mailbox_allocated = quota_mailbox_allocated
};
void quota_plugin_init(struct module *module)
extern MODULE_CONTEXT_DEFINE(quota_user_module, &mail_user_module_register);
void quota_mail_user_created(struct mail_user *user);
-void quota_mail_storage_created(struct mail_storage *storage);
void quota_mail_namespace_storage_added(struct mail_namespace *ns);
void quota_mail_namespaces_created(struct mail_namespace *namespaces);
+void quota_mailbox_allocated(struct mailbox *box);
void quota_plugin_init(struct module *module);
void quota_plugin_deinit(void);
qbox->module_ctx.super.close(box);
}
-static struct mailbox *
-quota_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
- const char *name, struct istream *input,
- enum mailbox_flags flags)
+void quota_mailbox_allocated(struct mailbox *box)
{
- union mail_storage_module_context *qstorage = QUOTA_CONTEXT(storage);
- struct mailbox *box;
struct quota_mailbox *qbox;
- box = qstorage->super.mailbox_alloc(storage, list, name, input, flags);
- if (box == NULL || QUOTA_LIST_CONTEXT(list) == NULL)
- return box;
+ if (QUOTA_LIST_CONTEXT(box->list) == NULL)
+ return;
qbox = p_new(box->pool, struct quota_mailbox, 1);
qbox->module_ctx.super = box->v;
box->v.sync_deinit = quota_mailbox_sync_deinit;
box->v.close = quota_mailbox_close;
MODULE_CONTEXT_SET(box, quota_storage_module, qbox);
- return box;
}
static int
}
}
-void quota_mail_storage_created(struct mail_storage *storage)
-{
- union mail_storage_module_context *qstorage;
-
- qstorage = p_new(storage->pool, union mail_storage_module_context, 1);
- qstorage->super = storage->v;
- storage->v.mailbox_alloc = quota_mailbox_alloc;
-
- MODULE_CONTEXT_SET_SELF(storage, quota_storage_module, qstorage);
-}
-
static struct quota_root *
quota_find_root_for_ns(struct quota *quota, struct mail_namespace *ns)
{