]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Recalculation now also counts the namespace prefix mailbox's quota if it exists.
authorTimo Sirainen <tss@iki.fi>
Mon, 23 Apr 2012 10:19:44 +0000 (13:19 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 23 Apr 2012 10:19:44 +0000 (13:19 +0300)
src/plugins/quota/quota-count.c

index d693f90fc1ac72e911882858fe7f636e8e50ced4..e1ede1f51751d5a14fe8e634d7920d64183749d5 100644 (file)
@@ -83,7 +83,12 @@ quota_count_namespace(struct quota_root *root, struct mail_namespace *ns,
        }
        if (mailbox_list_iter_deinit(&ctx) < 0)
                ret = -1;
-
+       if (ns->prefix_len > 0 && ret == 0 &&
+           (ns->prefix_len != 6 || strncasecmp(ns->prefix, "INBOX", 5) != 0)) {
+               /* if the namespace prefix itself exists, count it also */
+               const char *name = t_strndup(ns->prefix, ns->prefix_len-1);
+               ret = quota_count_mailbox(root, ns, name, bytes, count);
+       }
        return ret;
 }