changeset 19670:b467f6d24fd5

doveadm backup: If local mailbox has more mails than remote, detect and delete it earlier.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 28 Jan 2016 19:55:06 +0200
parents 2e624fd124c7
children 3b516415a5fa
files src/doveadm/dsync/dsync-mailbox-import.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-mailbox-import.c	Thu Jan 28 19:51:43 2016 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-import.c	Thu Jan 28 19:55:06 2016 +0200
@@ -751,6 +751,11 @@
 		/* add a record for local mail */
 		i_assert(importer->cur_mail != NULL);
 		if (importer->revert_local_changes) {
+			if (save_change == NULL) {
+				dsync_mailbox_revert_existing_uid(importer, importer->cur_mail->uid,
+					t_strdup_printf("highest than remote's UIDs (remote UIDNEXT=%u)", importer->remote_uid_next));
+				return TRUE;
+			}
 			mail_expunge(importer->cur_mail);
 			importer->cur_mail_skip = TRUE;
 			importer->next_local_seq++;