dovecot-1.1: maildir: Add ,S=<size> to maildir filename with all...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 8 13:17:54 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/8edec84d8a9d
changeset: 7727:8edec84d8a9d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 08 15:47:31 2008 +0530
description:
maildir: Add ,S=<size> to maildir filename with all quota backends.

diffstat:

2 files changed, 20 insertions(+), 11 deletions(-)
src/plugins/quota/quota-maildir.c |   16 +++++-----------
src/plugins/quota/quota.c         |   15 +++++++++++++++

diffs (73 lines):

diff -r 574fef904d3f -r 8edec84d8a9d src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Tue Jul 08 14:52:19 2008 +0530
+++ b/src/plugins/quota/quota-maildir.c	Tue Jul 08 15:47:31 2008 +0530
@@ -676,25 +676,19 @@ maildir_quota_root_storage_added(struct 
 }
 
 static void
-maildir_quota_storage_added(struct quota *quota,
-			    struct mail_storage *_storage)
-{
-	struct maildir_storage *storage =
-		(struct maildir_storage *)_storage;
+maildir_quota_storage_added(struct quota *quota, struct mail_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);
-	}
-
-	/* For newly generated filenames add ,S=size. */
-	storage->save_size_in_filename = TRUE;
+			maildir_quota_root_storage_added(roots[i], storage);
+	}
 }
 
 static const char *const *
diff -r 574fef904d3f -r 8edec84d8a9d src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Tue Jul 08 14:52:19 2008 +0530
+++ b/src/plugins/quota/quota.c	Tue Jul 08 15:47:31 2008 +0530
@@ -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(s
 	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;
@@ -432,6 +445,8 @@ void quota_add_user_storage(struct quota
 	const char *path, *path2;
 	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. */


More information about the dovecot-cvs mailing list