commit 83b834cdfdc68334a365894bd9250147e4ca4862 Author: Oswald Buddenhagen <o...@users.sf.net> Date: Sun Nov 10 19:57:08 2013 +0100
count unread messages like flagged messages when expiring that is, don't count them towards the total only below the cut-off point. making them extend the working set even though they are inside it is counterintuitive. src/sync.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sync.c b/src/sync.c index bc2f1a4..c0abd5a 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1354,8 +1354,8 @@ box_loaded( int sts, void *aux ) if ((svars->chan->ops[S] & (OP_NEW|OP_RENEW|OP_FLAGS)) && svars->chan->max_messages) { /* Note: When this branch is entered, we have loaded all slave messages. */ - /* Expire excess messages. Flagged messages and not yet synced messages older - * than the first not expired message are not counted towards the total. */ + /* Expire excess messages. Important (flagged, unread, or unpropagated) messages + * older than the first not expired message are not counted towards the total. */ todel = svars->ctx[S]->count + svars->new_total[S] - svars->chan->max_messages; debug( "%d excess messages on slave\n", todel ); for (tmsg = svars->ctx[S]->msgs; tmsg && todel > 0; tmsg = tmsg->next) { @@ -1377,14 +1377,13 @@ box_loaded( int sts, void *aux ) nflags = (tmsg->flags | srec->aflags[S]) & ~srec->dflags[S]; if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) { /* The message is not deleted, or is already (being) expired. */ - if (nflags & F_FLAGGED) { - /* Flagged messages are always kept. */ + if ((nflags & F_FLAGGED) || !(nflags & F_SEEN)) { + /* Important messages are always kept. */ todel--; - } else if ((nflags & F_SEEN) && - (todel > 0 || - ((srec->status & (S_EXPIRE|S_EXPIRED)) == (S_EXPIRE|S_EXPIRED)) || - ((srec->status & (S_EXPIRE|S_EXPIRED)) && (tmsg->flags & F_DELETED)))) { - /* The message is not new, and it is excess or was already (being) expired. */ + } else if (todel > 0 || + ((srec->status & (S_EXPIRE|S_EXPIRED)) == (S_EXPIRE|S_EXPIRED)) || + ((srec->status & (S_EXPIRE|S_EXPIRED)) && (tmsg->flags & F_DELETED))) { + /* The message is excess or was already (being) expired. */ srec->status |= S_NEXPIRE; debug( " pair(%d,%d)\n", srec->uid[M], srec->uid[S] ); todel--; ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel