isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 86d9a3140d315e821b6fdf6752a588e932101969
parent acabdc43b178f1735ba311ba88d2b9ab5d9a0919
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Wed,  8 Sep 2004 14:52:22 +0000

first check _both_ bounds, then compare ...

Diffstat:
Msrc/drv_maildir.c | 23++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c @@ -822,11 +822,28 @@ maildir_rescan( maildir_store_t *ctx ) for (msgapp = &ctx->gen.msgs, i = 0; (msg = (maildir_message_t *)*msgapp) || i < msglist.nents; ) { - if (!msg || msglist.ents[i].uid < msg->gen.uid) { + if (!msg) { +#if 0 + debug( "adding new message %d\n", msglist.ents[i].uid ); + maildir_app_msg( ctx, &msgapp, msglist.ents + i ); +#else debug( "ignoring new message %d\n", msglist.ents[i].uid ); - /* maildir_app_msg( ctx, &msgapp, msglist.ents + i ); */ +#endif + i++; + } else if (i >= msglist.nents) { + debug( "purging deleted message %d\n", msg->gen.uid ); + msg->gen.status = M_DEAD; + msgapp = &msg->gen.next; + } else if (msglist.ents[i].uid < msg->gen.uid) { + /* this should not happen, actually */ +#if 0 + debug( "adding new message %d\n", msglist.ents[i].uid ); + maildir_app_msg( ctx, &msgapp, msglist.ents + i ); +#else + debug( "ignoring new message %d\n", msglist.ents[i].uid ); +#endif i++; - } else if (i >= msglist.nents || msglist.ents[i].uid > msg->gen.uid) { + } else if (msglist.ents[i].uid > msg->gen.uid) { debug( "purging deleted message %d\n", msg->gen.uid ); msg->gen.status = M_DEAD; msgapp = &msg->gen.next;