dovecot-2.0: quota: Consistently assume that mailbox names in qu...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 17 22:57:42 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6d0b4dfc0829
changeset: 11575:6d0b4dfc0829
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 17 20:57:22 2010 +0100
description:
quota: Consistently assume that mailbox names in quota rules are virtual names.
The previous code mixed virtual/real name lookups.

diffstat:

 src/plugins/quota/quota-count.c   |  10 +++++++---
 src/plugins/quota/quota-maildir.c |   7 +++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diffs (68 lines):

diff -r 7330bb240c75 -r 6d0b4dfc0829 src/plugins/quota/quota-count.c
--- a/src/plugins/quota/quota-count.c	Thu Jun 17 20:28:06 2010 +0100
+++ b/src/plugins/quota/quota-count.c	Thu Jun 17 20:57:22 2010 +0100
@@ -9,7 +9,7 @@
 
 static int
 quota_count_mailbox(struct quota_root *root, struct mail_namespace *ns,
-		    const char *name, uint64_t *bytes_r, uint64_t *count_r)
+		    const char *vname, uint64_t *bytes_r, uint64_t *count_r)
 {
 	struct quota_rule *rule;
 	struct mailbox *box;
@@ -17,17 +17,20 @@
 	struct mail_search_context *ctx;
 	struct mail *mail;
 	struct mail_search_args *search_args;
+	const char *storage_name;
 	enum mail_error error;
 	uoff_t size;
 	int ret = 0;
 
-	rule = quota_root_rule_find(root->set, name);
+	storage_name = mail_namespace_get_storage_name(ns, vname);
+
+	rule = quota_root_rule_find(root->set, vname);
 	if (rule != NULL && rule->ignore) {
 		/* mailbox not included in quota */
 		return 0;
 	}
 
-	box = mailbox_alloc(ns->list, name,
+	box = mailbox_alloc(ns->list, storage_name,
 			    MAILBOX_FLAG_READONLY | MAILBOX_FLAG_KEEP_RECENT);
 	if (mailbox_open(box) < 0) {
 		mail_storage_get_last_error(mailbox_get_storage(box), &error);
@@ -78,6 +81,7 @@
 	int ret = 0;
 
 	ctx = mailbox_list_iter_init(ns->list, "*",
+				     MAILBOX_LIST_ITER_VIRTUAL_NAMES |
 				     MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
 	while ((info = mailbox_list_iter_next(ctx)) != NULL) {
 		if ((info->flags & (MAILBOX_NONEXISTENT |
diff -r 7330bb240c75 -r 6d0b4dfc0829 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Thu Jun 17 20:28:06 2010 +0100
+++ b/src/plugins/quota/quota-maildir.c	Thu Jun 17 20:57:22 2010 +0100
@@ -130,6 +130,7 @@
 	ctx->path = str_new(default_pool, 512);
 	ctx->list = list;
 	ctx->iter = mailbox_list_iter_init(list, "*",
+					   MAILBOX_LIST_ITER_VIRTUAL_NAMES |
 					   MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
 	return ctx;
 }
@@ -155,9 +156,11 @@
 		}
 
 		T_BEGIN {
-			const char *path;
+			const char *path, *storage_name;
 
-			path = mailbox_list_get_path(ctx->list, ctx->info->name,
+			storage_name = mail_namespace_get_storage_name(
+				ctx->info->ns, ctx->info->name);
+			path = mailbox_list_get_path(ctx->list, storage_name,
 					MAILBOX_LIST_PATH_TYPE_MAILBOX);
 			str_truncate(ctx->path, 0);
 			str_append(ctx->path, path);


More information about the dovecot-cvs mailing list