dovecot: If a flag is added and then removed, remove it from the...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 18 03:53:09 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/07d08be5bbb8
changeset: 6058:07d08be5bbb8
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 18 03:15:53 2007 +0300
description:
If a flag is added and then removed, remove it from the transaction
completely.

diffstat:

1 file changed, 9 insertions(+), 1 deletion(-)
src/lib-index/mail-index-transaction.c |   10 +++++++++-

diffs (21 lines):

diff -r 4d14254bc40a -r 07d08be5bbb8 src/lib-index/mail-index-transaction.c
--- a/src/lib-index/mail-index-transaction.c	Wed Jul 18 03:15:08 2007 +0300
+++ b/src/lib-index/mail-index-transaction.c	Wed Jul 18 03:15:53 2007 +0300
@@ -680,8 +680,16 @@ mail_index_insert_flag_update(struct mai
 		updates[idx].remove_flags =
 			(updates[idx].remove_flags | u.remove_flags) &
 			~u.add_flags;
-
 		u.uid1 = updates[idx].uid2 + 1;
+
+		if (updates[idx].add_flags == 0 &&
+		    updates[idx].remove_flags == 0) {
+			/* we can remove this update completely */
+			array_delete(&t->updates, idx, 1);
+			updates = array_get_modifiable(&t->updates, &count);
+			idx--;
+		}
+
 		if (u.uid1 > u.uid2) {
 			/* break here before idx++ so last_update_idx is set
 			   correctly */


More information about the dovecot-cvs mailing list