Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5254:46e3249aa15b HEAD
Yet another try at fixing this piece of code. The mbox code is way too
complex and could use better comments..
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 09 Mar 2007 22:22:50 +0200 |
parents | 535ff7687388 |
children | 005d73928f8f |
files | src/lib-storage/index/mbox/mbox-sync-rewrite.c |
diffstat | 1 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c Fri Mar 09 21:37:23 2007 +0200 +++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c Fri Mar 09 22:22:50 2007 +0200 @@ -330,16 +330,13 @@ istream_raw_mbox_get_header_offset(sync_ctx->input); mail_ctx->mail.body_size = mails[idx].body_size; - if (mails[idx].uid_broken || mails[idx].uid == 0) { - sync_ctx->next_uid = 1; - sync_ctx->prev_msg_uid = 0; - } else { - /* If we originally thought that the UID was broken, force the - brokeness now also. Otherwise try to make the UID what we - wanted it originally. */ - sync_ctx->next_uid = mails[idx].uid; - sync_ctx->prev_msg_uid = sync_ctx->next_uid - 1; - } + /* only expunged mails have uid=0 */ + i_assert(mails[idx].uid != 0); + + /* This will force the UID to be the one that we originally assigned + to it, regardless of whether it's broken or not in the file. */ + sync_ctx->next_uid = mails[idx].uid; + sync_ctx->prev_msg_uid = mails[idx].uid - 1; first_mail_expunge_extra = 1 + sync_ctx->first_mail_crlf_expunged ? 1 : 0;