fix off-by-one when loading messages outside the bulk range

this would lead to a bogus deletion being propagated to the near side.
This commit is contained in:
Oswald Buddenhagen 2022-02-21 10:07:00 +01:00
parent 0089f49c4a
commit 3febb16fd5
2 changed files with 23 additions and 1 deletions

View File

@ -1246,6 +1246,28 @@ my @X34 = (
);
test("max messages + expire - new", \@x33, \@X34, \@O34);
my @x35 = (
B, 0, B,
A, "*F", "*F", "*F",
B, "*", "*", "*",
C, "*", "", "",
D, "*", "", "",
E, "*", "", "",
F, "*", "", "",
G, "*", "", "",
H, "*", "", "",
);
my @O35 = ("", "", "Sync New\nMaxMessages 3\nExpireUnread yes\n");
my @X35 = (
H, E, H,
B, "", "+~", "+T",
F, "", "*", "*",
G, "", "*", "*",
H, "", "*", "*",
);
test("max messages + expire - too many new", \@x35, \@X35, \@O35);
my @x38 = (
F, C, 0,
A, "*FS", "*FS", "*S",

View File

@ -813,7 +813,7 @@ box_opened2( sync_vars_t *svars, int t )
continue; // No message; other state is irrelevant
if (srec->uid[F] >= minwuid)
continue; // Message is in non-expired range
if ((svars->opts[F] & OPEN_NEW) && srec->uid[F] >= svars->maxuid[F])
if ((svars->opts[F] & OPEN_NEW) && srec->uid[F] > svars->maxuid[F])
continue; // Message is in expired range, but new range overlaps that
if (!srec->uid[N] && !(srec->status & S_PENDING))
continue; // Only actually paired up messages matter