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.
This commit is contained in:
parent
9e186ae88b
commit
83b834cdfd
15
src/sync.c
15
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) {
|
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. */
|
/* Note: When this branch is entered, we have loaded all slave messages. */
|
||||||
/* Expire excess messages. Flagged messages and not yet synced messages older
|
/* Expire excess messages. Important (flagged, unread, or unpropagated) messages
|
||||||
* than the first not expired message are not counted towards the total. */
|
* 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;
|
todel = svars->ctx[S]->count + svars->new_total[S] - svars->chan->max_messages;
|
||||||
debug( "%d excess messages on slave\n", todel );
|
debug( "%d excess messages on slave\n", todel );
|
||||||
for (tmsg = svars->ctx[S]->msgs; tmsg && todel > 0; tmsg = tmsg->next) {
|
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];
|
nflags = (tmsg->flags | srec->aflags[S]) & ~srec->dflags[S];
|
||||||
if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) {
|
if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) {
|
||||||
/* The message is not deleted, or is already (being) expired. */
|
/* The message is not deleted, or is already (being) expired. */
|
||||||
if (nflags & F_FLAGGED) {
|
if ((nflags & F_FLAGGED) || !(nflags & F_SEEN)) {
|
||||||
/* Flagged messages are always kept. */
|
/* Important messages are always kept. */
|
||||||
todel--;
|
todel--;
|
||||||
} else if ((nflags & F_SEEN) &&
|
} else if (todel > 0 ||
|
||||||
(todel > 0 ||
|
|
||||||
((srec->status & (S_EXPIRE|S_EXPIRED)) == (S_EXPIRE|S_EXPIRED)) ||
|
((srec->status & (S_EXPIRE|S_EXPIRED)) == (S_EXPIRE|S_EXPIRED)) ||
|
||||||
((srec->status & (S_EXPIRE|S_EXPIRED)) && (tmsg->flags & F_DELETED)))) {
|
((srec->status & (S_EXPIRE|S_EXPIRED)) && (tmsg->flags & F_DELETED))) {
|
||||||
/* The message is not new, and it is excess or was already (being) expired. */
|
/* The message is excess or was already (being) expired. */
|
||||||
srec->status |= S_NEXPIRE;
|
srec->status |= S_NEXPIRE;
|
||||||
debug( " pair(%d,%d)\n", srec->uid[M], srec->uid[S] );
|
debug( " pair(%d,%d)\n", srec->uid[M], srec->uid[S] );
|
||||||
todel--;
|
todel--;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user