]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Add ,S=<size> to maildir filename with all quota backends.
authorTimo Sirainen <tss@iki.fi>
Tue, 8 Jul 2008 10:17:31 +0000 (15:47 +0530)
committerTimo Sirainen <tss@iki.fi>
Tue, 8 Jul 2008 10:17:31 +0000 (15:47 +0530)
--HG--
branch : HEAD

src/plugins/quota/quota-maildir.c
src/plugins/quota/quota.c

index d4f9884f2e02dce42b809ff2fff36d60ebe66c42..053ddca876f3f9ffe0edf178bec67e870a99f756 100644 (file)
@@ -676,25 +676,19 @@ maildir_quota_root_storage_added(struct quota_root *_root,
 }
 
 static void
-maildir_quota_storage_added(struct quota *quota,
-                           struct mail_storage *_storage)
+maildir_quota_storage_added(struct quota *quota, struct mail_storage *storage)
 {
-       struct maildir_storage *storage =
-               (struct maildir_storage *)_storage;
        struct quota_root **roots;
        unsigned int i, count;
 
-       if (strcmp(_storage->name, "maildir") != 0)
+       if (strcmp(storage->name, "maildir") != 0)
                return;
 
        roots = array_get_modifiable(&quota->roots, &count);
        for (i = 0; i < count; i++) {
                if (roots[i]->backend.name == quota_backend_maildir.name)
-                       maildir_quota_root_storage_added(roots[i], _storage);
+                       maildir_quota_root_storage_added(roots[i], storage);
        }
-
-       /* For newly generated filenames add ,S=size. */
-       storage->save_size_in_filename = TRUE;
 }
 
 static const char *const *
index dcebdce3bfb1c73b2a001e5826850423713b9614..7f512944f71f900c1d9dfde2d41c3552ee22bbde 100644 (file)
@@ -4,6 +4,7 @@
 #include "array.h"
 #include "hash.h"
 #include "mailbox-list-private.h"
+#include "maildir-storage.h"
 #include "quota-private.h"
 #include "quota-fs.h"
 
@@ -424,6 +425,18 @@ static bool quota_root_get_rule_limits(struct quota_root *root,
        return found;
 }
 
+static void quota_maildir_storage_set(struct mail_storage *storage)
+{
+       /* FIXME: a bit ugly location for this code. */
+       if (strcmp(storage->name, "maildir") == 0) {
+               /* For newly generated filenames add ,S=size. */
+               struct maildir_storage *mstorage =
+                       (struct maildir_storage *)storage;
+
+               mstorage->save_size_in_filename = TRUE;
+       }
+}
+
 void quota_add_user_storage(struct quota *quota, struct mail_storage *storage)
 {
        struct quota_root *const *roots;
@@ -433,6 +446,8 @@ void quota_add_user_storage(struct quota *quota, struct mail_storage *storage)
        unsigned int i, j, count;
        bool is_file;
 
+       quota_maildir_storage_set(storage);
+
        /* first check if there already exists a storage with the exact same
           path. we don't want to count them twice. */
        path = mail_storage_get_mailbox_path(storage, "", &is_file);