isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 882c9825cd41ce88ce22f3c3a37f679d61f200df
parent cb687f1beeef8e90f4181b1788830ddbc8e26fdd
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Thu, 24 Feb 2022 14:32:55 +0100

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.

Diffstat:
Msrc/run-tests.pl | 49+++++++++++++++++++++++++++++++++++++++++--------
Msrc/sync.c | 7++++---
2 files changed, 45 insertions(+), 11 deletions(-)

diff --git 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?", "*<S", "", A, "", "*", "*", - B, "", "*>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*", W, "*FPR?", "*<DP", "*DFP*", + M, "*FS?", "*<", "**", + N, "*FS?", "*<S", "**", + O, "*FS?", "*<S", "*S*", + P, "*FS?", "*<", "*S*", + Q, "*F?", "*<S", "*S*", + R, "*F?", "*<", "*S*", + S, "*F?", "*<S", "**", D, "*PR?", "*<DP", "*DFP*", E, "*PR*", "*>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+FR", "-D+R", W, "&1+T", "^", "&", + M, "^*", "<-<", "", + M, "&1+T", "^", "&", + N, "^*", "<-<S", "", + N, "&1+T", "^", "&", + O, "^S*", "<-<", "", + O, "&1+T", "^", "&", + P, "^S*", "<-<+S", "", + P, "&1+T", "^", "&", + Q, "^*", "<-<S", "-S", + Q, "&1+T", "^", "&", + R, "^S*", "<-<+S", "", + R, "&1+T", "^", "&", + S, "^*", "<-<S", "", + S, "&1+T", "^", "&", D, "", "-D+R", "-D+R", E, "", "-D+R", "-D+R", + F, "", "+S", "+S", + G, "-S", "-S", "", + I, "", "+S", "", + J, "", "-S", "-S", + L, "", "-S", "", ); test("max size + flagging", \@x22, \@X22, \@O21); @@ -1308,8 +1341,8 @@ test("maxuid topping", \@x60, \@X61, \@O61); my @x90 = ( C, 0, C, - A, "*DRT*", "*>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 @@ -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