dovecot: Add ,W=<virtual size> to saved maildir filenames.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 12 06:15:56 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/29d08e7bbf63
changeset: 5964:29d08e7bbf63
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 12 06:14:37 2007 +0300
description:
Add ,W=<virtual size> to saved maildir filenames.

diffstat:

1 file changed, 9 insertions(+), 1 deletion(-)
src/lib-storage/index/maildir/maildir-save.c |   10 +++++++++-

diffs (41 lines):

diff -r 9bef18690777 -r 29d08e7bbf63 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Thu Jul 12 06:12:44 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c	Thu Jul 12 06:14:37 2007 +0300
@@ -27,7 +27,7 @@ struct maildir_filename {
 	struct maildir_filename *next;
 	const char *basename;
 
-	uoff_t size;
+	uoff_t size, vsize;
 	enum mail_flags flags;
 	unsigned int keywords_count;
 	/* unsigned int keywords[]; */
@@ -193,6 +193,7 @@ uint32_t maildir_save_add(struct maildir
 	mf->basename = p_strdup(ctx->pool, base_fname);
 	mf->flags = flags;
 	mf->size = (uoff_t)-1;
+	mf->vsize = (uoff_t)-1;
 
 	ctx->file_last = mf;
 	i_assert(*ctx->files_tail == NULL);
@@ -270,6 +271,11 @@ maildir_get_updated_filename(struct mail
 	    mf->size != (uoff_t)-1) {
 		basename = t_strdup_printf("%s,S=%"PRIuUOFF_T,
 					   basename, mf->size);
+	}
+
+	if (mf->vsize != (uoff_t)-1) {
+		basename = t_strdup_printf("%s,W=%"PRIuUOFF_T,
+					   basename, mf->vsize);
 	}
 
 	if (mf->keywords_count == 0) {
@@ -490,6 +496,8 @@ int maildir_save_finish(struct mail_save
 
 	/* remember the size in case we want to add it to filename */
 	ctx->file_last->size = ctx->output->offset;
+	ctx->file_last->vsize = ctx->cur_dest_mail == NULL ? (uoff_t)-1 :
+		mail_get_virtual_size(ctx->cur_dest_mail);
 
 	t_push();
 	path = t_strconcat(ctx->tmpdir, "/", ctx->file_last->basename, NULL);


More information about the dovecot-cvs mailing list