Mercurial > dovecot > core-2.2
changeset 11575:6d0b4dfc0829 HEAD
quota: Consistently assume that mailbox names in quota rules are virtual names.
The previous code mixed virtual/real name lookups.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 17 Jun 2010 20:57:22 +0100 |
parents | 7330bb240c75 |
children | 99d56a37edd0 |
files | src/plugins/quota/quota-count.c src/plugins/quota/quota-maildir.c |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 |
--- 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);