dovecot-2.1: maildir: Preserve [SW]=sizes when renaming a maildi...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 25 16:45:08 EET 2013
details: http://hg.dovecot.org/dovecot-2.1/rev/cfd3f39102bd
changeset: 14924:cfd3f39102bd
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 25 16:44:57 2013 +0200
description:
maildir: Preserve [SW]=sizes when renaming a maildir duplicate file.
diffstat:
src/lib-storage/index/maildir/maildir-sync.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diffs (28 lines):
diff -r 10c1eb4ddef2 -r cfd3f39102bd src/lib-storage/index/maildir/maildir-sync.c
--- a/src/lib-storage/index/maildir/maildir-sync.c Sun Feb 24 15:52:57 2013 +0200
+++ b/src/lib-storage/index/maildir/maildir-sync.c Mon Feb 25 16:44:57 2013 +0200
@@ -288,6 +288,7 @@
const char *fname1, *path1, *path2;
const char *new_fname, *new_path;
struct stat st1, st2;
+ uoff_t size;
fname1 = maildir_uidlist_sync_get_full_filename(ctx->uidlist_sync_ctx,
fname2);
@@ -330,6 +331,16 @@
}
new_fname = maildir_filename_generate();
+ /* preserve S= and W= sizes if they're available.
+ (S=size is required for zlib plugin to work) */
+ if (maildir_filename_get_size(fname2, MAILDIR_EXTRA_FILE_SIZE, &size)) {
+ new_fname = t_strdup_printf("%s,%c=%"PRIuUOFF_T,
+ new_fname, MAILDIR_EXTRA_FILE_SIZE, size);
+ }
+ if (maildir_filename_get_size(fname2, MAILDIR_EXTRA_VIRTUAL_SIZE, &size)) {
+ new_fname = t_strdup_printf("%s,%c=%"PRIuUOFF_T,
+ new_fname, MAILDIR_EXTRA_VIRTUAL_SIZE, size);
+ }
new_path = t_strconcat(mailbox_get_path(&ctx->mbox->box),
"/new/", new_fname, NULL);
More information about the dovecot-cvs
mailing list