dovecot-2.0: maildir: When copying can't preserve filename, pres...

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 4 18:15:51 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/33ea7477c6a9
changeset: 11928:33ea7477c6a9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 04 16:15:48 2010 +0100
description:
maildir: When copying can't preserve filename, preserve S/W sizes anyway.

diffstat:

 src/lib-storage/index/maildir/maildir-save.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r 353d73775b69 -r 33ea7477c6a9 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Wed Aug 04 16:02:54 2010 +0100
+++ b/src/lib-storage/index/maildir/maildir-save.c	Wed Aug 04 16:15:48 2010 +0100
@@ -764,6 +764,8 @@
 maildir_filename_check_conflicts(struct maildir_save_context *ctx,
 				 struct maildir_filename *mf)
 {
+	uoff_t size;
+
 	if (!ctx->locked_uidlist_refresh) {
 		(void)maildir_uidlist_refresh(ctx->mbox->uidlist);
 		ctx->locked_uidlist_refresh = TRUE;
@@ -771,9 +773,19 @@
 
 	if (maildir_uidlist_get_full_filename(ctx->mbox->uidlist,
 					      mf->dest_basename) != NULL) {
-		/* file already exists. give it another name. */
+		/* file already exists. give it another name.
+		   but preserve the size/vsize in the filename if possible */
+		if (maildir_filename_get_size(mf->dest_basename,
+					      MAILDIR_EXTRA_FILE_SIZE, &size))
+			mf->size = size;
+		if (maildir_filename_get_size(mf->dest_basename,
+					      MAILDIR_EXTRA_VIRTUAL_SIZE,
+					      &size))
+			mf->vsize = size;
+
 		mf->dest_basename = p_strdup(ctx->pool,
 					     maildir_filename_generate());
+		mf->preserve_filename = FALSE;
 	}
 }
 


More information about the dovecot-cvs mailing list