const char *acl_env, *current_username, *owner_username;
bool owner = TRUE;
- if (acl_next_hook_mailbox_list_created != NULL)
- acl_next_hook_mailbox_list_created(list);
-
acl_env = getenv("ACL");
i_assert(acl_env != NULL);
acl_storage_rights_ctx_init(&alist->rights, backend);
MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist);
+
+ if (acl_next_hook_mailbox_list_created != NULL)
+ acl_next_hook_mailbox_list_created(list);
}
struct acl_mail_storage *astorage;
struct acl_backend *backend;
- if (acl_next_hook_mail_storage_created != NULL)
- acl_next_hook_mail_storage_created(storage);
-
astorage = p_new(storage->pool, struct acl_mail_storage, 1);
astorage->module_ctx.super = storage->v;
storage->v.destroy = acl_storage_destroy;
acl_storage_rights_ctx_init(&astorage->rights, backend);
MODULE_CONTEXT_SET(storage, acl_storage_module, astorage);
+
+ if (acl_next_hook_mail_storage_created != NULL)
+ acl_next_hook_mail_storage_created(storage);
}
static void (*convert_next_hook_mail_namespaces_created)
(struct mail_namespace *namespaces);
-static void
-convert_hook_mail_namespaces_created(struct mail_namespace *namespaces)
+static void convert_mail_storage(struct mail_namespace *namespaces,
+ const char *convert_mail)
{
- const char *convert_mail, *str;
+ const char *str;
struct convert_settings set;
- if (convert_next_hook_mail_namespaces_created != NULL)
- convert_next_hook_mail_namespaces_created(namespaces);
-
- convert_mail = getenv("CONVERT_MAIL");
- if (convert_mail == NULL)
- return;
-
memset(&set, 0, sizeof(set));
set.user = getenv("USER");
if (set.user == NULL)
i_fatal("Mailbox conversion failed, exiting");
}
+static void
+convert_hook_mail_namespaces_created(struct mail_namespace *namespaces)
+{
+ const char *convert_mail;
+
+ convert_mail = getenv("CONVERT_MAIL");
+ if (convert_mail != NULL)
+ convert_mail_storage(namespaces, convert_mail);
+
+ if (convert_next_hook_mail_namespaces_created != NULL)
+ convert_next_hook_mail_namespaces_created(namespaces);
+}
+
void convert_plugin_init(void)
{
convert_next_hook_mail_namespaces_created =
{
union mail_storage_module_context *xpr_storage;
- if (expire.next_hook_mail_storage_created != NULL)
- expire.next_hook_mail_storage_created(storage);
-
xpr_storage =
p_new(storage->pool, union mail_storage_module_context, 1);
xpr_storage->super = storage->v;
storage->v.mailbox_open = expire_mailbox_open;
MODULE_CONTEXT_SET_SELF(storage, expire_storage_module, xpr_storage);
+
+ if (expire.next_hook_mail_storage_created != NULL)
+ expire.next_hook_mail_storage_created(storage);
}
void expire_plugin_init(void)
return ret;
}
-void fts_mailbox_opened(struct mailbox *box)
+static void fts_mailbox_init(struct mailbox *box, const char *env)
{
struct fts_mailbox *fbox;
- const char *env;
-
- if (fts_next_hook_mailbox_opened != NULL)
- fts_next_hook_mailbox_opened(box);
-
- env = getenv("FTS");
- if (env == NULL)
- return;
fbox = i_new(struct fts_mailbox, 1);
fbox->env = env;
MODULE_CONTEXT_SET(box, fts_storage_module, fbox);
}
+
+void fts_mailbox_opened(struct mailbox *box)
+{
+ const char *env;
+
+ env = getenv("FTS");
+ if (env != NULL)
+ fts_mailbox_init(box, env);
+
+ if (fts_next_hook_mailbox_opened != NULL)
+ fts_next_hook_mailbox_opened(box);
+}
return 0;
}
-static void lazy_expunge_mail_storage_created(struct mail_storage *storage)
+static void lazy_expunge_mail_storage_init(struct mail_storage *storage)
{
struct lazy_expunge_mailbox_list *llist =
LAZY_EXPUNGE_LIST_CONTEXT(storage->list);
const char *const *p;
unsigned int i;
- if (lazy_expunge_next_hook_mail_storage_created != NULL)
- lazy_expunge_next_hook_mail_storage_created(storage);
-
- /* only maildir supported for now */
- if (strcmp(storage->name, "maildir") != 0)
- return;
-
/* if this is one of our internal storages, mark it as such before
quota plugin sees it */
p = t_strsplit_spaces(getenv("LAZY_EXPUNGE"), " ");
MODULE_CONTEXT_SET(storage, lazy_expunge_mail_storage_module, lstorage);
}
+static void lazy_expunge_mail_storage_created(struct mail_storage *storage)
+{
+ /* only maildir supported for now */
+ if (strcmp(storage->name, "maildir") == 0)
+ lazy_expunge_mail_storage_init(storage);
+
+ if (lazy_expunge_next_hook_mail_storage_created != NULL)
+ lazy_expunge_next_hook_mail_storage_created(storage);
+}
+
static void lazy_expunge_mailbox_list_created(struct mailbox_list *list)
{
struct lazy_expunge_mailbox_list *llist;
{
union mail_storage_module_context *lstorage;
- if (mail_log_next_hook_mail_storage_created != NULL)
- mail_log_next_hook_mail_storage_created(storage);
-
lstorage = p_new(storage->pool, union mail_storage_module_context, 1);
lstorage->super = storage->v;
storage->v.mailbox_open = mail_log_mailbox_open;
MODULE_CONTEXT_SET_SELF(storage, mail_log_storage_module, lstorage);
+
+ if (mail_log_next_hook_mail_storage_created != NULL)
+ mail_log_next_hook_mail_storage_created(storage);
}
static void mail_log_mailbox_list_created(struct mailbox_list *list)
{
union mailbox_list_module_context *llist;
- if (mail_log_next_hook_mailbox_list_created != NULL)
- mail_log_next_hook_mailbox_list_created(list);
-
llist = p_new(list->pool, union mailbox_list_module_context, 1);
llist->super = list->v;
list->v.delete_mailbox = mail_log_mailbox_list_delete;
list->v.rename_mailbox = mail_log_mailbox_list_rename;
MODULE_CONTEXT_SET_SELF(list, mail_log_mailbox_list_module, llist);
+
+ if (mail_log_next_hook_mailbox_list_created != NULL)
+ mail_log_next_hook_mailbox_list_created(list);
}
static enum mail_log_field mail_log_parse_fields(const char *str)
{
struct mbox_snarf_mail_storage *mstorage;
- if (mbox_snarf_next_hook_mail_storage_created != NULL)
- mbox_snarf_next_hook_mail_storage_created(storage);
-
mstorage = p_new(storage->pool, struct mbox_snarf_mail_storage, 1);
mstorage->snarf_inbox_path =
p_strdup(storage->pool, home_expand(getenv("MBOX_SNARF")));
storage->v.mailbox_open = mbox_snarf_mailbox_open;
MODULE_CONTEXT_SET(storage, mbox_snarf_storage_module, mstorage);
+
+ if (mbox_snarf_next_hook_mail_storage_created != NULL)
+ mbox_snarf_next_hook_mail_storage_created(storage);
}
void mbox_snarf_plugin_init(void)
struct quota_mailbox_list *qlist = QUOTA_LIST_CONTEXT(storage->list);
union mail_storage_module_context *qstorage;
- if (quota_next_hook_mail_storage_created != NULL)
- quota_next_hook_mail_storage_created(storage);
-
qlist->storage = storage;
qstorage = p_new(storage->pool, union mail_storage_module_context, 1);
/* register to user's quota roots */
quota_add_user_storage(quota_set, storage);
}
+
+ if (quota_next_hook_mail_storage_created != NULL)
+ quota_next_hook_mail_storage_created(storage);
}
void quota_mailbox_list_created(struct mailbox_list *list)
{
struct quota_mailbox_list *qlist;
- if (quota_next_hook_mailbox_list_created != NULL)
- quota_next_hook_mailbox_list_created(list);
-
qlist = p_new(list->pool, struct quota_mailbox_list, 1);
qlist->module_ctx.super = list->v;
list->v.delete_mailbox = quota_mailbox_list_delete;
MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist);
+
+ if (quota_next_hook_mailbox_list_created != NULL)
+ quota_next_hook_mailbox_list_created(list);
}
{
union mail_storage_module_context *qstorage;
- if (zlib_next_hook_mail_storage_created != NULL)
- zlib_next_hook_mail_storage_created(storage);
-
qstorage = p_new(storage->pool, union mail_storage_module_context, 1);
qstorage->super = storage->v;
storage->v.mailbox_open = zlib_mailbox_open;
MODULE_CONTEXT_SET_SELF(storage, zlib_storage_module, qstorage);
+
+ if (zlib_next_hook_mail_storage_created != NULL)
+ zlib_next_hook_mail_storage_created(storage);
}
void zlib_plugin_init(void)