]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: Use mailbox_list_created hook to override list methods.
authorTimo Sirainen <tss@iki.fi>
Thu, 5 Aug 2010 16:07:56 +0000 (17:07 +0100)
committerTimo Sirainen <tss@iki.fi>
Thu, 5 Aug 2010 16:07:56 +0000 (17:07 +0100)
src/plugins/lazy-expunge/lazy-expunge-plugin.c

index abae315eb068d7c9949a74ec4daec77f98087a3c..218daafd2e98773c180c6c5dc7aebe59c619e19f 100644 (file)
@@ -490,11 +490,10 @@ static void lazy_expunge_mailbox_allocated(struct mailbox *box)
        }
 }
 
-static void lazy_expunge_mail_namespace_storage_added(struct mail_namespace *ns)
+static void lazy_expunge_mailbox_list_created(struct mailbox_list *list)
 {
-       struct mailbox_list *list = ns->list;
        struct lazy_expunge_mail_user *luser =
-               LAZY_EXPUNGE_USER_CONTEXT(ns->user);
+               LAZY_EXPUNGE_USER_CONTEXT(list->ns->user);
        struct lazy_expunge_mailbox_list *llist;
        const char *const *p;
        unsigned int i;
@@ -506,13 +505,13 @@ static void lazy_expunge_mail_namespace_storage_added(struct mail_namespace *ns)
           quota plugin sees it */
        p = t_strsplit_spaces(luser->env, " ");
        for (i = 0; i < LAZY_NAMESPACE_COUNT && *p != NULL; i++, p++) {
-               if (strcmp(ns->prefix, *p) == 0) {
-                       ns->flags |= NAMESPACE_FLAG_NOQUOTA;
+               if (strcmp(list->ns->prefix, *p) == 0) {
+                       list->ns->flags |= NAMESPACE_FLAG_NOQUOTA;
                        break;
                }
        }
 
-       if (luser != NULL && ns->type == NAMESPACE_PRIVATE) {
+       if (luser != NULL && list->ns->type == NAMESPACE_PRIVATE) {
                llist = p_new(list->pool, struct lazy_expunge_mailbox_list, 1);
                MODULE_CONTEXT_SET(list, lazy_expunge_mailbox_list_module,
                                   llist);
@@ -589,7 +588,7 @@ static void lazy_expunge_mail_user_created(struct mail_user *user)
 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,
-       .mail_namespace_storage_added = lazy_expunge_mail_namespace_storage_added,
+       .mailbox_list_created = lazy_expunge_mailbox_list_created,
        .mailbox_allocated = lazy_expunge_mailbox_allocated,
        .mail_allocated = lazy_expunge_mail_allocated
 };