In mailbox_list_created the storage hasn't yet overridden the list functions.
--HG--
branch : HEAD
MODULE_CONTEXT_SET(list, acl_mailbox_list_module, alist);
}
-void acl_mailbox_list_created(struct mailbox_list *list)
+void acl_mail_namespace_storage_added(struct mail_namespace *ns)
{
- struct acl_user *auser = ACL_USER_CONTEXT(list->ns->user);
+ struct acl_user *auser = ACL_USER_CONTEXT(ns->user);
if (auser == NULL) {
/* ACLs disabled for this user */
- } else if ((list->ns->flags & NAMESPACE_FLAG_NOACL) != 0) {
+ } else if ((ns->flags & NAMESPACE_FLAG_NOACL) != 0) {
/* no ACL checks for internal namespaces (lda, shared) */
- if (list->ns->type == NAMESPACE_SHARED)
- acl_mailbox_list_init_shared(list);
+ if (ns->type == NAMESPACE_SHARED)
+ acl_mailbox_list_init_shared(ns->list);
} else {
- acl_mailbox_list_init_default(list);
+ acl_mailbox_list_init_default(ns->list);
}
}
static struct mail_storage_hooks acl_mail_storage_hooks = {
.mail_user_created = acl_mail_user_created,
.mail_storage_created = acl_mail_storage_created,
- .mailbox_list_created = acl_mailbox_list_created
+ .mail_namespace_storage_added = acl_mail_namespace_storage_added
};
void acl_plugin_init(struct module *module)
&mailbox_list_module_register);
void acl_mail_storage_created(struct mail_storage *storage);
-void acl_mailbox_list_created(struct mailbox_list *list);
+void acl_mail_namespace_storage_added(struct mail_namespace *ns);
void acl_mail_user_created(struct mail_user *list);
struct mailbox *
return 0;
}
-static void lazy_expunge_mailbox_list_created(struct mailbox_list *list)
+static void lazy_expunge_mail_namespace_storage_added(struct mail_namespace *ns)
{
+ struct mailbox_list *list = ns->list;
struct lazy_expunge_mail_user *luser =
- LAZY_EXPUNGE_USER_CONTEXT(list->ns->user);
+ LAZY_EXPUNGE_USER_CONTEXT(ns->user);
struct lazy_expunge_mailbox_list *llist;
const char *const *p;
unsigned int i;
quota plugin sees it */
p = t_strsplit_spaces(luser->env, " ");
for (i = 0; i < LAZY_NAMESPACE_COUNT; i++, p++) {
- if (strcmp(list->ns->prefix, *p) == 0) {
- list->ns->flags |= NAMESPACE_FLAG_NOQUOTA;
+ if (strcmp(ns->prefix, *p) == 0) {
+ ns->flags |= NAMESPACE_FLAG_NOQUOTA;
break;
}
}
- if (luser != NULL && list->ns->type == NAMESPACE_PRIVATE) {
+ if (luser != NULL && ns->type == NAMESPACE_PRIVATE) {
llist = p_new(list->pool, struct lazy_expunge_mailbox_list, 1);
llist->module_ctx.super = list->v;
list->v.delete_mailbox = lazy_expunge_mailbox_list_delete;
static struct mail_storage_hooks lazy_expunge_mail_storage_hooks = {
.mail_user_created = lazy_expunge_mail_user_created,
.mail_namespaces_created = lazy_expunge_mail_namespaces_created,
- .mailbox_list_created = lazy_expunge_mailbox_list_created,
+ .mail_namespace_storage_added = lazy_expunge_mail_namespace_storage_added,
.mailbox_allocated = lazy_expunge_mailbox_allocated
};
MODULE_CONTEXT_SET(storage, listescape_storage_module, mstorage);
}
-static void listescape_mailbox_list_created(struct mailbox_list *list)
+static void listescape_mail_namespace_storage_added(struct mail_namespace *ns)
{
+ struct mailbox_list *list = ns->list;
struct listescape_mailbox_list *mlist;
const char *env;
- if (list->hierarchy_sep == list->ns->sep)
+ if (list->hierarchy_sep == ns->sep)
return;
- list->ns->real_sep = list->ns->sep;
+ ns->real_sep = ns->sep;
mlist = p_new(list->pool, struct listescape_mailbox_list, 1);
mlist->module_ctx.super = list->v;
static struct mail_storage_hooks listescape_mail_storage_hooks = {
.mail_storage_created = listescape_mail_storage_created,
- .mailbox_list_created = listescape_mailbox_list_created
+ .mail_namespace_storage_added = listescape_mail_namespace_storage_added
};
void listescape_plugin_init(struct module *module)
MODULE_CONTEXT_SET_SELF(storage, notify_storage_module, lstorage);
}
-static void notify_mailbox_list_created(struct mailbox_list *list)
+static void notify_mail_namespace_storage_added(struct mail_namespace *ns)
{
+ struct mailbox_list *list = ns->list;
union mailbox_list_module_context *llist;
llist = p_new(list->pool, union mailbox_list_module_context, 1);
static struct mail_storage_hooks notify_mail_storage_hooks = {
.mail_storage_created = notify_mail_storage_created,
- .mailbox_list_created = notify_mailbox_list_created
+ .mail_namespace_storage_added = notify_mail_namespace_storage_added
};
void notify_plugin_init_storage(struct module *module)
.mail_user_created = quota_mail_user_created,
.mail_namespaces_created = quota_mail_namespaces_created,
.mail_storage_created = quota_mail_storage_created,
- .mailbox_list_created = quota_mailbox_list_created
+ .mail_namespace_storage_added = quota_mail_namespace_storage_added
};
void quota_plugin_init(struct module *module)
void quota_mail_user_created(struct mail_user *user);
void quota_mail_storage_created(struct mail_storage *storage);
-void quota_mailbox_list_created(struct mailbox_list *list);
+void quota_mail_namespace_storage_added(struct mail_namespace *ns);
void quota_mail_namespaces_created(struct mail_namespace *namespaces);
void quota_plugin_init(struct module *module);
return NULL;
}
-void quota_mailbox_list_created(struct mailbox_list *list)
+void quota_mail_namespace_storage_added(struct mail_namespace *ns)
{
+ struct mailbox_list *list = ns->list;
struct quota_mailbox_list *qlist;
struct quota *quota = NULL;
struct quota_root *root;
bool add;
- if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0)
+ if ((ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0)
add = FALSE;
- else if (list->ns->owner == NULL) {
+ else if (ns->owner == NULL) {
/* see if we have a quota explicitly defined for
this namespace */
- quota = quota_get_mail_user_quota(list->ns->user);
- root = quota_find_root_for_ns(quota, list->ns);
+ quota = quota_get_mail_user_quota(ns->user);
+ root = quota_find_root_for_ns(quota, ns);
add = root != NULL;
if (root != NULL)
- root->ns = list->ns;
+ root->ns = ns;
} else {
add = TRUE;
}
MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist);
/* register to owner's quota roots */
- quota = list->ns->owner != NULL ?
- quota_get_mail_user_quota(list->ns->owner) :
- quota_get_mail_user_quota(list->ns->user);
- quota_add_user_namespace(quota, list->ns);
+ quota = ns->owner != NULL ?
+ quota_get_mail_user_quota(ns->owner) :
+ quota_get_mail_user_quota(ns->user);
+ quota_add_user_namespace(quota, ns);
}
}