Mercurial > dovecot > core-2.2
changeset 15618:b338c4a08f42
dsync: Mailbox syncing fix
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 09 Jan 2013 09:11:09 +0200 |
parents | 2c4394d0360b |
children | b27245a6adde |
files | src/doveadm/dsync/dsync-mailbox-import.c |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-mailbox-import.c Wed Jan 09 07:53:53 2013 +0200 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Wed Jan 09 09:11:09 2013 +0200 @@ -1076,6 +1076,7 @@ { struct importer_new_mail *newmail, *const *newmailp; uint32_t common_uid_next, new_uid; + bool linked_uid; common_uid_next = I_MAX(importer->local_uid_next, importer->remote_uid_next); @@ -1094,19 +1095,28 @@ if (newmail->uid_is_usable) { /* keep the UID */ new_uid = newmail->uid; + linked_uid = FALSE; } else if (newmail->link != NULL && - newmail->link->uid_is_usable) + newmail->link->uid_is_usable) { new_uid = newmail->link->uid; - else + linked_uid = TRUE; + } else { new_uid = common_uid_next++; + linked_uid = FALSE; + } if (newmail->uid_in_local && newmail->uid != new_uid) { /* local UID changed, reassign it by copying */ dsync_msg_update_uid(importer, newmail->uid, new_uid); + } else if (linked_uid && newmail->link->uid_in_local) { + /* the linked message already exists. we'll just need + to forget about this message. */ + i_assert(!newmail->uid_in_local); + newmail->skip = TRUE; } newmail->uid = new_uid; - if (newmail->link != NULL) { + if (newmail->link != NULL && !newmail->skip) { /* skip the linked mail */ newmail->link->skip = TRUE; }