From 882c9825cd41ce88ce22f3c3a37f679d61f200df Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Feb 2022 14:32:55 +0100 Subject: [PATCH] fix handling of 'seen' flag wrt placeholders while we don't want to propagate seeing _from_ the placeholder, we do want to propagate it _to_ it, and consequently also un-seeing from it. --- src/run-tests.pl | 49 ++++++++++++++++++++++++++++++++++++++++-------- src/sync.c | 7 ++++--- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index deec504..74cb0c5 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -1113,35 +1113,49 @@ test("noop + expunge near side", \@x01, \@X0A, \@O0A); my @x20 = ( 0, 0, 0, A, "*", "", "", - B, "*FP*", "", "", - C, "", "", "*F*", + B, "*FPS*", "", "", + C, "", "", "*FS*", ); my @O21 = ("MaxSize 1k\n", "MaxSize 1k\n", "Expunge Near"); my @X21 = ( C, 0, B, - C, "*?", "*<", "", + C, "*S?", "*P", "*P?", + B, "", "*>PS", "*PS?", ); test("max size", \@x20, \@X21, \@O21); my @x22 = ( - E, 0, V, + L, 0, V, A, "*", "", "", B, "*PR*", "", "", V, "*FPR*", "", "", C, "*FPR?", "*DP", "*DP?", + F, "*S*", "*>", "*?", + G, "*S*", "*>S", "*?", + H, "*S*", "*>S", "*S?", + I, "*S*", "*>", "*S?", + J, "**", "*>S", "*S?", + K, "**", "*>", "*S?", + L, "**", "*>S", "*?", A, "", "*", "*", B, "", "*>DP", "*DFP?", V, "", "*>DP", "*DFP?", ); my @X22 = ( - W, 0, V, + S, 0, V, B, "", ">->D+R", "^PR*", B, "", "", "&1/", V, "", ">->D+FR", "^FPR*", @@ -1150,8 +1164,27 @@ my @X22 = ( C, "&1+T", "^", "&", W, "^FPR*", "<-D", "*DFP?", - B, "*DR*", "*>D", "*DFPT?", + A, "*DRT*", "*>DS", "*DFPS?", + B, "*DR*", "*>DS", "*DFPST?", C, "*", "*", "*", D, "*T", "", "", ); diff --git a/src/sync.c b/src/sync.c index d3899de..f476efb 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1054,7 +1054,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux if ((svars->chan->ops[t] & OP_RENEW) && (srec->status & S_DUMMY(t)) && srec->uid[t^1] && srec->msg[t]) { sflags = srec->msg[t]->flags; if (sflags & F_FLAGGED) { - sflags &= ~(F_SEEN | F_FLAGGED); // As below. + sflags &= ~(F_SEEN | F_FLAGGED) | (srec->flags & F_SEEN); // As below. // We save away the dummy's flags, because after an // interruption it may be already gone. srec->pflags = sflags; @@ -1136,9 +1136,10 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux } if (srec->status & S_DUMMY(t^1)) { // From placeholders, don't propagate: - // - Seen, because the real contents were obviously not seen yet + // - Seen, because the real contents were obviously not seen yet. + // However, we do propagate un-seeing. // - Flagged, because it's just a request to upgrade - sflags &= ~(F_SEEN|F_FLAGGED); + sflags &= ~(F_SEEN | F_FLAGGED) | (srec->flags & F_SEEN); } else if (srec->status & S_DUMMY(t)) { // Don't propagate Flagged to placeholders, as that would be // misunderstood as a request to upgrade next time around. We