|
|
|
@ -511,7 +511,7 @@ box_opened2( sync_vars_t *svars, int t )
|
|
|
|
|
channel_conf_t *chan; |
|
|
|
|
sync_rec_t *srec; |
|
|
|
|
uint_array_alloc_t mexcs; |
|
|
|
|
uint opts[2], minwuid; |
|
|
|
|
uint opts[2], fails, minwuid; |
|
|
|
|
|
|
|
|
|
svars->state[t] |= ST_SELECTED; |
|
|
|
|
if (!(svars->state[t^1] & ST_SELECTED)) |
|
|
|
@ -520,13 +520,23 @@ box_opened2( sync_vars_t *svars, int t )
|
|
|
|
|
ctx[1] = svars->ctx[1]; |
|
|
|
|
chan = svars->chan; |
|
|
|
|
|
|
|
|
|
if (!lock_state( svars )) { |
|
|
|
|
fails = 0; |
|
|
|
|
for (t = 0; t < 2; t++) |
|
|
|
|
if (svars->uidval[t] != UIDVAL_BAD && svars->uidval[t] != svars->newuidval[t]) |
|
|
|
|
fails++; |
|
|
|
|
// If only one side changed UIDVALIDITY, we will try to re-approve it further down.
|
|
|
|
|
if (fails == 2) { |
|
|
|
|
error( "Error: channel %s: UIDVALIDITY of both far side %s and near side %s changed.\n", |
|
|
|
|
svars->chan->name, svars->orig_name[F], svars->orig_name[N]); |
|
|
|
|
bail: |
|
|
|
|
svars->ret = SYNC_FAIL; |
|
|
|
|
sync_bail( svars ); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!lock_state( svars )) |
|
|
|
|
goto bail; |
|
|
|
|
|
|
|
|
|
int any_dummies[2] = { 0, 0 }; |
|
|
|
|
int any_purges[2] = { 0, 0 }; |
|
|
|
|
int any_upgrades[2] = { 0, 0 }; |
|
|
|
@ -564,11 +574,9 @@ box_opened2( sync_vars_t *svars, int t )
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
opts[F] = opts[N] = 0; |
|
|
|
|
if (fails) |
|
|
|
|
opts[F] = opts[N] = OPEN_PAIRED | OPEN_PAIRED_IDS; |
|
|
|
|
for (t = 0; t < 2; t++) { |
|
|
|
|
if (svars->uidval[t] != UIDVAL_BAD && svars->uidval[t] != svars->newuidval[t]) { |
|
|
|
|
opts[F] |= OPEN_PAIRED | OPEN_PAIRED_IDS; |
|
|
|
|
opts[N] |= OPEN_PAIRED | OPEN_PAIRED_IDS; |
|
|
|
|
} |
|
|
|
|
if (any_purges[t]) { |
|
|
|
|
debug( "resuming %d %s purge(s)\n", any_purges[t], str_fn[t] ); |
|
|
|
|
opts[t] |= OPEN_SETFLAGS; |
|
|
|
@ -851,15 +859,8 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
|
|
|
|
|
if (!srec->msg[t^1]) |
|
|
|
|
continue; // Partner disappeared.
|
|
|
|
|
if (!srec->msg[t^1]->msgid || strcmp( srec->msg[F]->msgid, srec->msg[N]->msgid )) { |
|
|
|
|
if (svars->uidval[t^1] != svars->newuidval[t^1]) { |
|
|
|
|
error( "Error: channel %s, %s box %s (at UID %u):" |
|
|
|
|
" Unable to recover from both-sided UIDVALIDITY change," |
|
|
|
|
" as it is genuine on at least one side.\n", |
|
|
|
|
svars->chan->name, str_fn[t], svars->orig_name[t], srec->uid[t] ); |
|
|
|
|
} else { |
|
|
|
|
error( "Error: channel %s, %s box %s (at UID %u): UIDVALIDITY genuinely changed.\n", |
|
|
|
|
svars->chan->name, str_fn[t], svars->orig_name[t], srec->uid[t] ); |
|
|
|
|
} |
|
|
|
|
error( "Error: channel %s, %s box %s: UIDVALIDITY genuinely changed (at UID %u).\n", |
|
|
|
|
svars->chan->name, str_fn[t], svars->orig_name[t], srec->uid[t] ); |
|
|
|
|
uvchg: |
|
|
|
|
svars->ret |= SYNC_FAIL; |
|
|
|
|
cancel_sync( svars ); |
|
|
|
@ -1013,7 +1014,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
|
|
|
|
|
sflags = sanitize_flags( sflags, svars, t ); |
|
|
|
|
if ((t != xt) && (srec->status & (S_EXPIRE | S_EXPIRED))) { |
|
|
|
|
/* Don't propagate deletion resulting from expiration. */ |
|
|
|
|
debug( " %s side expiring\n", str_fn[xt] ); |
|
|
|
|
debug( " near side expiring\n" ); |
|
|
|
|
sflags &= ~F_DELETED; |
|
|
|
|
} |
|
|
|
|
if (srec->status & S_DUMMY(t^1)) { |
|
|
|
@ -1204,7 +1205,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
|
|
|
|
|
if (!srec->uid[xt^1]) |
|
|
|
|
continue; |
|
|
|
|
if (!(srec->status & S_PENDING)) { |
|
|
|
|
// We ignore unpaired keep-side messages, as there is obviously nothing
|
|
|
|
|
// We ignore unpaired far-side messages, as there is obviously nothing
|
|
|
|
|
// to expire in the first place.
|
|
|
|
|
if (!srec->msg[xt]) |
|
|
|
|
continue; |
|
|
|
@ -1229,8 +1230,6 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
|
|
|
|
|
// but we may be pulling in the real ones.
|
|
|
|
|
nflags = (srec->pflags | srec->aflags[xt]) & ~srec->dflags[xt]; |
|
|
|
|
} else { |
|
|
|
|
if (!srec->msg[xt^1]) |
|
|
|
|
continue; |
|
|
|
|
nflags = srec->msg[xt^1]->flags; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|