dovecot-2.0: maildir: Always add S=size to filenames.

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 15 21:06:25 EET 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/eabe311c8649
changeset: 10492:eabe311c8649
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 15 14:06:18 2009 -0500
description:
maildir: Always add S=size to filenames.
It's necessary for using zlib plugin and doesn't hurt much anyway.

diffstat:

4 files changed, 2 insertions(+), 19 deletions(-)
src/lib-storage/index/maildir/maildir-copy.c    |    3 +--
src/lib-storage/index/maildir/maildir-save.c    |    3 +--
src/lib-storage/index/maildir/maildir-storage.h |    2 --
src/plugins/quota/quota-storage.c               |   13 -------------

diffs (68 lines):

diff -r 617fa0739538 -r eabe311c8649 src/lib-storage/index/maildir/maildir-copy.c
--- a/src/lib-storage/index/maildir/maildir-copy.c	Tue Dec 15 14:01:20 2009 -0500
+++ b/src/lib-storage/index/maildir/maildir-copy.c	Tue Dec 15 14:06:18 2009 -0500
@@ -84,8 +84,7 @@ static int do_hardlink(struct maildir_ma
 	int ret;
 
 	if (!ctx->preserve_filename) {
-		if (mbox->storage->save_size_in_filename &&
-		    !ctx->size_set) {
+		if (!ctx->size_set) {
 			if ((ret = do_save_mail_size(mbox, path, ctx)) <= 0)
 				return ret;
 		}
diff -r 617fa0739538 -r eabe311c8649 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Tue Dec 15 14:01:20 2009 -0500
+++ b/src/lib-storage/index/maildir/maildir-save.c	Tue Dec 15 14:06:18 2009 -0500
@@ -227,8 +227,7 @@ maildir_get_updated_filename(struct mail
 {
 	const char *basename = mf->basename;
 
-	if (ctx->mbox->storage->save_size_in_filename &&
-	    mf->size != (uoff_t)-1 && !mf->preserve_filename) {
+	if (mf->size != (uoff_t)-1 && !mf->preserve_filename) {
 		basename = t_strdup_printf("%s,%c=%"PRIuUOFF_T, basename,
 					   MAILDIR_EXTRA_FILE_SIZE, mf->size);
 	}
diff -r 617fa0739538 -r eabe311c8649 src/lib-storage/index/maildir/maildir-storage.h
--- a/src/lib-storage/index/maildir/maildir-storage.h	Tue Dec 15 14:01:20 2009 -0500
+++ b/src/lib-storage/index/maildir/maildir-storage.h	Tue Dec 15 14:06:18 2009 -0500
@@ -72,8 +72,6 @@ struct maildir_storage {
 	const char *temp_prefix;
 
 	uint32_t maildir_list_ext_id;
-
-	unsigned int save_size_in_filename:1;
 };
 
 struct maildir_mailbox {
diff -r 617fa0739538 -r eabe311c8649 src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c	Tue Dec 15 14:01:20 2009 -0500
+++ b/src/plugins/quota/quota-storage.c	Tue Dec 15 14:06:18 2009 -0500
@@ -489,18 +489,6 @@ void quota_mail_user_created(struct mail
 	}
 }
 
-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_mail_storage_created(struct mail_storage *storage)
 {
 	union mail_storage_module_context *qstorage;
@@ -510,7 +498,6 @@ void quota_mail_storage_created(struct m
 	storage->v.mailbox_alloc = quota_mailbox_alloc;
 
 	MODULE_CONTEXT_SET_SELF(storage, quota_storage_module, qstorage);
-	quota_maildir_storage_set(storage);
 }
 
 static struct quota_root *


More information about the dovecot-cvs mailing list