dovecot-2.2: lib-storage: Don't add first_saved to mailbox list ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 27 12:12:09 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d4e5b4ab01dd
changeset: 19423:d4e5b4ab01dd
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 27 14:11:57 2015 +0200
description:
lib-storage: Don't add first_saved to mailbox list index unless autoexpunge is set.

diffstat:

 src/lib-storage/list/mailbox-list-index-status.c |  9 +++++++--
 src/lib-storage/mail-storage-private.h           |  2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 1217e5610865 -r d4e5b4ab01dd src/lib-storage/list/mailbox-list-index-status.c
--- a/src/lib-storage/list/mailbox-list-index-status.c	Fri Nov 27 14:01:14 2015 +0200
+++ b/src/lib-storage/list/mailbox-list-index-status.c	Fri Nov 27 14:11:57 2015 +0200
@@ -336,6 +336,10 @@
 	if ((items & MAILBOX_METADATA_FIRST_SAVE_DATE) != 0) {
 		struct mailbox_index_first_saved first_saved;
 
+		/* start writing first_saved to mailbox list index if it wasn't
+		   there already. */
+		box->update_first_saved = TRUE;
+
 		if ((ret = index_list_get_cached_first_saved(box, &first_saved)) <= 0)
 			return ret;
 		metadata_r->first_save_date =
@@ -441,8 +445,9 @@
 	if (mail_index_view_get_messages_count(box->view) > 0)
 		mail_index_lookup_uid(box->view, 1, &changes->first_uid);
 	if (first_saved.uid == 0 && first_saved.timestamp == 0) {
-		/* first time setting this */
-		changes->first_saved_changed = TRUE;
+		/* it's not in the index yet. we'll set it only if we've
+		   just called MAILBOX_METADATA_FIRST_SAVE_DATE. */
+		changes->first_saved_changed = box->update_first_saved;
 	} else {
 		changes->first_saved_changed =
 			changes->first_uid != first_saved.uid;
diff -r 1217e5610865 -r d4e5b4ab01dd src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Fri Nov 27 14:01:14 2015 +0200
+++ b/src/lib-storage/mail-storage-private.h	Fri Nov 27 14:11:57 2015 +0200
@@ -378,6 +378,8 @@
 	unsigned int synced:1;
 	/* Updating cache file is disabled */
 	unsigned int mail_cache_disabled:1;
+	/* Update first_saved field to mailbox list index. */
+	unsigned int update_first_saved:1;
 };
 
 struct mail_vfuncs {


More information about the dovecot-cvs mailing list