]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Better fix to avoid counting quota for virtual mailboxes.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Nov 2010 18:56:47 +0000 (18:56 +0000)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Nov 2010 18:56:47 +0000 (18:56 +0000)
src/plugins/quota/quota-maildir.c
src/plugins/quota/quota-storage.c
src/plugins/quota/quota.c

index 51f3f6eb77d110dd50a438835ba5dfcc0cf6f195..89ddc365d364efa842c2ef11ea9e47bc7d37e784 100644 (file)
@@ -636,9 +636,12 @@ static bool maildirquota_limits_init(struct maildir_quota_root *root)
        if (mailbox_list_get_storage(&list, &name, &storage) == 0 &&
            strcmp(storage->name, MAILDIR_STORAGE_NAME) != 0) {
                /* non-maildir namespace, skip */
-               i_warning("quota: Namespace '%s' is not Maildir, "
-                         "skipping for Maildir++ quota",
-                         root->maildirsize_ns->prefix);
+               if ((storage->class_flags &
+                    MAIL_STORAGE_CLASS_FLAG_NOQUOTA) == 0) {
+                       i_warning("quota: Namespace '%s' is not Maildir, "
+                                 "skipping for Maildir++ quota",
+                                 root->maildirsize_ns->prefix);
+               }
                root->maildirsize_path = NULL;
                return FALSE;
        }
index 93324df0be3bc5be76508d825e8c4fa6a8da7361..9aebd7ac5c917ec6e7b0e1f40e559507e1eb3262 100644 (file)
@@ -405,6 +405,9 @@ void quota_mailbox_allocated(struct mailbox *box)
        if (QUOTA_LIST_CONTEXT(box->list) == NULL)
                return;
 
+       if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NOQUOTA) != 0)
+               return;
+
        qbox = p_new(box->pool, struct quota_mailbox, 1);
        qbox->module_ctx.super = *v;
        box->vlast = &qbox->module_ctx.super;
@@ -514,8 +517,7 @@ void quota_mailbox_list_created(struct mailbox_list *list)
        if (root != NULL)
                root->ns = list->ns;
 
-       if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0 ||
-           strncmp(list->ns->set->location, "virtual:", 8) == 0) /* FIXME: remove ugly workaround */
+       if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0)
                add = FALSE;
        else if (list->ns->owner == NULL) {
                /* public namespace - add quota only if namespace is
index fbf85bc7ed504c4abc18bb19d92f392ba4895480..eb5d5c4496ef3d65424a6785697e711f4f524481 100644 (file)
@@ -760,6 +760,15 @@ quota_root_iter_init(struct mailbox *box)
 bool quota_root_is_namespace_visible(struct quota_root *root,
                                     struct mail_namespace *ns)
 {
+       struct mailbox_list *list = ns->list;
+       struct mail_storage *storage;
+       const char *name = "";
+
+       /* this check works as long as there is only one storage per list */
+       if (mailbox_list_get_storage(&list, &name, &storage) == 0 &&
+           (storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NOQUOTA) != 0)
+               return FALSE;
+
        if (root->ns != NULL) {
                if (root->ns != ns)
                        return FALSE;