From: Timo Sirainen Date: Thu, 17 Jun 2010 19:57:22 +0000 (+0100) Subject: quota: Consistently assume that mailbox names in quota rules are virtual names. X-Git-Tag: 2.0.rc1~143 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc5e3d3391d7e54b643ab4949e8df465f37234bb;p=thirdparty%2Fdovecot%2Fcore.git quota: Consistently assume that mailbox names in quota rules are virtual names. The previous code mixed virtual/real name lookups. --HG-- branch : HEAD --- diff --git a/src/plugins/quota/quota-count.c b/src/plugins/quota/quota-count.c index 09214069a6..d8ba68a790 100644 --- a/src/plugins/quota/quota-count.c +++ b/src/plugins/quota/quota-count.c @@ -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 @@ quota_count_mailbox(struct quota_root *root, struct mail_namespace *ns, 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 @@ quota_count_namespace(struct quota_root *root, struct mail_namespace *ns, 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 --git a/src/plugins/quota/quota-maildir.c b/src/plugins/quota/quota-maildir.c index dfcdc2f04a..a2b60fc548 100644 --- a/src/plugins/quota/quota-maildir.c +++ b/src/plugins/quota/quota-maildir.c @@ -130,6 +130,7 @@ maildir_list_init(struct maildir_quota_root *root, struct mailbox_list *list) 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 @@ maildir_list_next(struct maildir_list_context *ctx, time_t *mtime_r) } 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);