Mercurial > dovecot > core-2.2
changeset 12391:5a10aaf6f510
quota: Better fix to avoid counting quota for virtual mailboxes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 04 Nov 2010 18:56:47 +0000 |
parents | 37833c393ef8 |
children | 55d144a33e62 |
files | src/plugins/quota/quota-maildir.c src/plugins/quota/quota-storage.c src/plugins/quota/quota.c |
diffstat | 3 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota-maildir.c Thu Nov 04 18:56:13 2010 +0000 +++ b/src/plugins/quota/quota-maildir.c Thu Nov 04 18:56:47 2010 +0000 @@ -636,9 +636,12 @@ 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; }
--- a/src/plugins/quota/quota-storage.c Thu Nov 04 18:56:13 2010 +0000 +++ b/src/plugins/quota/quota-storage.c Thu Nov 04 18:56:47 2010 +0000 @@ -405,6 +405,9 @@ 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 @@ 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
--- a/src/plugins/quota/quota.c Thu Nov 04 18:56:13 2010 +0000 +++ b/src/plugins/quota/quota.c Thu Nov 04 18:56:47 2010 +0000 @@ -760,6 +760,15 @@ 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;