don't UID EXPUNGE too many messages

we didn't check that the UIDs are adjacent, so we might have caught
not fetched deleted messages between two fetched messages below the
bulk load range.

checking adjacency of UIDs would make expunges in the bulk range (which
is likely to be full of holes) rather inefficient. so we use sequence
numbers instead.

this is admittedly a rather academical fix ...

amends 18225344.
This commit is contained in:
Oswald Buddenhagen 2021-12-29 14:42:22 +01:00
parent 1631361f66
commit 95a22739fa

View File

@ -3128,7 +3128,18 @@ imap_close_box( store_t *gctx,
buf[bl++] = ','; buf[bl++] = ',';
bl += sprintf( buf + bl, "%u", msg->uid ); bl += sprintf( buf + bl, "%u", msg->uid );
fmsg = msg; fmsg = msg;
for (; (nmsg = msg->next) && (nmsg->flags & F_DELETED); msg = nmsg) {} for (; (nmsg = msg->next); msg = nmsg) {
if (nmsg->status & M_DEAD) {
// Messages that jump a gap interrupt the range, even expunged ones.
if (nmsg->seq)
break;
} else {
if (nmsg->seq > 1)
break;
if (!(nmsg->flags & F_DELETED))
break;
}
}
if (msg != fmsg) if (msg != fmsg)
bl += sprintf( buf + bl, ":%u", msg->uid ); bl += sprintf( buf + bl, ":%u", msg->uid );
} }