backport:

- sanitize flag handling of expired messages
- don't record we synced flags if we didn't
- remove now superfluous temporary rflags
This commit is contained in:
Oswald Buddenhagen 2006-01-31 15:12:34 +00:00
parent 9a5920c028
commit 161a4b1159

View File

@ -251,7 +251,7 @@ sync_old( int tops, store_t *sctx, store_t *tctx, store_conf_t *tconf, FILE *jfp
{ {
driver_t *tdriver = tctx->conf->driver, *sdriver = sctx->conf->driver; driver_t *tdriver = tctx->conf->driver, *sdriver = sctx->conf->driver;
int uid, tuid, unex; int uid, tuid, unex;
unsigned char sflags, aflags, dflags, rflags; unsigned char sflags, aflags, dflags;
msg_data_t msgdata; msg_data_t msgdata;
/* excludes (push) c.3) d.2) d.3) d.4) / (pull) b.3) d.7) d.8) d.9) */ /* excludes (push) c.3) d.2) d.3) d.4) / (pull) b.3) d.7) d.8) d.9) */
@ -332,20 +332,18 @@ sync_old( int tops, store_t *sctx, store_t *tctx, store_conf_t *tconf, FILE *jfp
unex = 0; unex = 0;
if (srec->status & S_EXPIRED) { if (srec->status & S_EXPIRED) {
if (!pull) { if (!pull) {
if (sflags & F_DELETED) { if ((aflags & ~F_DELETED) || dflags)
if (!(sflags & F_FLAGGED)) info( "Info: Flags of expired message changed in (%d,%d)\n", srec->muid, srec->suid );
aflags &= ~F_DELETED; return SYNC_OK;
} else
unex = 1;
} else { } else {
if ((sflags & F_FLAGGED) && !(sflags & F_DELETED)) { if ((sflags & F_FLAGGED) && !(sflags & F_DELETED)) {
unex = 1; unex = 1;
dflags |= F_DELETED; dflags |= F_DELETED;
} else
return SYNC_OK;
} }
} }
} if ((tops & OP_EXPUNGE) && (sflags & F_DELETED) &&
rflags = (*nflags | aflags) & ~dflags;
if ((tops & OP_EXPUNGE) && (rflags & F_DELETED) &&
(!tctx->conf->trash || tctx->conf->trash_only_new)) (!tctx->conf->trash || tctx->conf->trash_only_new))
{ {
aflags &= F_DELETED; aflags &= F_DELETED;
@ -356,7 +354,7 @@ sync_old( int tops, store_t *sctx, store_t *tctx, store_conf_t *tconf, FILE *jfp
case DRV_BOX_BAD: return SYNC_FAIL; case DRV_BOX_BAD: return SYNC_FAIL;
default: /* ok */ break; default: /* ok */ break;
case DRV_OK: case DRV_OK:
*nflags = rflags; *nflags = (*nflags | aflags) & ~dflags;
if (unex) { if (unex) {
debug( "unexpiring pair(%d,%d)\n", srec->muid, srec->suid ); debug( "unexpiring pair(%d,%d)\n", srec->muid, srec->suid );
/* log last, so deletion can't be misinterpreted! */ /* log last, so deletion can't be misinterpreted! */