Browse Source

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.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
95a22739fa
  1. 13
      src/drv_imap.c

13
src/drv_imap.c

@ -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 );
} }

Loading…
Cancel
Save