commit a9a331c98ad72d335e01539adb3fa9aa4a02a88c
parent 03f8bfdfb2ad46bc92e54b19ce68c6c95cc5ae53
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sat, 2 Nov 2013 20:02:54 +0100
simplify condition
... and document the cases.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/sync.c b/src/sync.c
@@ -1167,8 +1167,14 @@ box_loaded( int sts, void *aux )
for (t = 0; t < 2; t++) {
Fprintf( svars->jfp, "%c %d\n", "{}"[t], svars->ctx[t]->uidnext );
for (tmsg = svars->ctx[1-t]->msgs; tmsg; tmsg = tmsg->next) {
+ /* If we have a srec:
+ * - message is old (> 0) or expired (0) => ignore
+ * - message was skipped (-1) => ReNew
+ * - message was attempted, but failed (-2) => New
+ * If new have no srec, the message is always New. */
srec = tmsg->srec;
- if (srec ? srec->uid[t] < 0 && (srec->uid[t] == -1 ? (svars->chan->ops[t] & OP_RENEW) : (svars->chan->ops[t] & OP_NEW)) : (svars->chan->ops[t] & OP_NEW)) {
+ if (srec ? srec->uid[t] < 0 && (svars->chan->ops[t] & (srec->uid[t] == -1 ? OP_RENEW : OP_NEW))
+ : (svars->chan->ops[t] & OP_NEW)) {
debug( "new message %d on %s\n", tmsg->uid, str_ms[1-t] );
if ((svars->chan->ops[t] & OP_EXPUNGE) && (tmsg->flags & F_DELETED))
debug( " -> not %sing - would be expunged anyway\n", str_hl[t] );