make sure we fetch source flags when expiring while pulling new

otherwise important messages may be incorrectly aborted.
This commit is contained in:
Oswald Buddenhagen 2022-02-20 12:39:19 +01:00
parent 3febb16fd5
commit e6a15bee59
2 changed files with 6 additions and 3 deletions

View File

@ -1251,20 +1251,21 @@ my @x35 = (
A, "*F", "*F", "*F", A, "*F", "*F", "*F",
B, "*", "*", "*", B, "*", "*", "*",
C, "*", "", "", C, "*", "", "",
D, "*", "", "", D, "*F", "", "",
E, "*", "", "", E, "*", "", "",
F, "*", "", "", F, "*", "", "",
G, "*", "", "", G, "*", "", "",
H, "*", "", "", H, "*F", "", "",
); );
my @O35 = ("", "", "Sync New\nMaxMessages 3\nExpireUnread yes\n"); my @O35 = ("", "", "Sync New\nMaxMessages 3\nExpireUnread yes\n");
my @X35 = ( my @X35 = (
H, E, H, H, E, H,
B, "", "+~", "+T", B, "", "+~", "+T",
D, "", "*F", "*F",
F, "", "*", "*", F, "", "*", "*",
G, "", "*", "*", G, "", "*", "*",
H, "", "*", "*", H, "", "*F", "*F",
); );
test("max messages + expire - too many new", \@x35, \@X35, \@O35); test("max messages + expire - too many new", \@x35, \@X35, \@O35);

View File

@ -792,6 +792,8 @@ box_opened2( sync_vars_t *svars, int t )
svars->any_expiring = 1; svars->any_expiring = 1;
if (svars->any_expiring) { if (svars->any_expiring) {
opts[N] |= OPEN_OLD | OPEN_FLAGS; opts[N] |= OPEN_OLD | OPEN_FLAGS;
if (chan->ops[N] & (OP_NEW | OP_RENEW))
opts[F] |= OPEN_FLAGS;
} }
svars->opts[F] = svars->drv[F]->prepare_load_box( ctx[F], opts[F] ); svars->opts[F] = svars->drv[F]->prepare_load_box( ctx[F], opts[F] );
svars->opts[N] = svars->drv[N]->prepare_load_box( ctx[N], opts[N] ); svars->opts[N] = svars->drv[N]->prepare_load_box( ctx[N], opts[N] );