dovecot-2.0: quota: Better fix to avoid counting quota for virtu...

dovecot at dovecot.org dovecot at dovecot.org
Thu Nov 4 20:56:51 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/5a10aaf6f510
changeset: 12391:5a10aaf6f510
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 04 18:56:47 2010 +0000
description:
quota: Better fix to avoid counting quota for virtual mailboxes.

diffstat:

 src/plugins/quota/quota-maildir.c |  9 ++++++---
 src/plugins/quota/quota-storage.c |  6 ++++--
 src/plugins/quota/quota.c         |  9 +++++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 37833c393ef8 -r 5a10aaf6f510 src/plugins/quota/quota-maildir.c
--- 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;
 	}
diff -r 37833c393ef8 -r 5a10aaf6f510 src/plugins/quota/quota-storage.c
--- 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
diff -r 37833c393ef8 -r 5a10aaf6f510 src/plugins/quota/quota.c
--- 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;


More information about the dovecot-cvs mailing list