dovecot-2.1: lib-storage: When copying a mail, use a new timesta...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jul 28 20:32:11 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/b13b8267999d
changeset: 14636:b13b8267999d
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jul 28 20:31:13 2012 +0300
description:
lib-storage: When copying a mail, use a new timestamp for date.save instead of preserving it.

diffstat:

 src/lib-storage/index/index-storage.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 77f2510bb009 -r b13b8267999d src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Sat Jul 28 20:00:32 2012 +0300
+++ b/src/lib-storage/index/index-storage.c	Sat Jul 28 20:31:13 2012 +0300
@@ -625,6 +625,7 @@
 	struct mailbox_transaction_context *dest_trans = ctx->transaction;
 	const struct mail_cache_field *dest_field;
 	unsigned int src_field_idx, dest_field_idx;
+	uint32_t t;
 
 	src_field_idx = mail_cache_register_lookup(src_mail->box->cache, name);
 	i_assert(src_field_idx != -1U);
@@ -643,8 +644,16 @@
 	}
 
 	buffer_set_used_size(buf, 0);
-	if (mail_cache_lookup_field(src_mail->transaction->cache_view, buf,
-				    src_mail->seq, src_field_idx) > 0) {
+	if (strcmp(name, "date.save") == 0) {
+		/* save date must update when mail is copied */
+		t = ioloop_time;
+		buffer_append(buf, &t, sizeof(t));
+	} else {
+		if (mail_cache_lookup_field(src_mail->transaction->cache_view, buf,
+					    src_mail->seq, src_field_idx) <= 0)
+			buffer_set_used_size(buf, 0);
+	}
+	if (buf->used > 0) {
 		mail_cache_add(dest_trans->cache_trans, dest_seq,
 			       dest_field_idx, buf->data, buf->used);
 	}


More information about the dovecot-cvs mailing list