isync

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

commit e4243debb64dabd27db1def2468d95a12c8c1e2c
parent ca3a319e60935ebe70472b5e645edc4ad54df681
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat, 11 May 2013 10:12:33 +0200

use INT_MAX instead of zero for "no size limit"

this simplifies the actual conditions

Diffstat:
Msrc/config.c | 2++
Msrc/sync.c | 6+++---
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/config.c b/src/config.c @@ -343,6 +343,8 @@ load_config( const char *where, int pseudo ) if (store) { if (!store->path) store->path = ""; + if (!store->max_size) + store->max_size = INT_MAX; *storeapp = store; storeapp = &store->next; *storeapp = 0; diff --git a/src/sync.c b/src/sync.c @@ -941,7 +941,7 @@ box_selected( int sts, void *aux ) opts[1-t] |= OPEN_NEW; if (chan->ops[t] & OP_EXPUNGE) opts[1-t] |= OPEN_FLAGS; - if (chan->stores[t]->max_size) + if (chan->stores[t]->max_size != INT_MAX) opts[1-t] |= OPEN_SIZE; } if (chan->ops[t] & OP_EXPUNGE) { @@ -1185,7 +1185,7 @@ box_loaded( int sts, void *aux ) Fprintf( svars->jfp, "+ %d %d\n", srec->uid[M], srec->uid[S] ); debug( " -> pair(%d,%d) created\n", srec->uid[M], srec->uid[S] ); } - if ((tmsg->flags & F_FLAGGED) || !svars->chan->stores[t]->max_size || tmsg->size <= svars->chan->stores[t]->max_size) { + if ((tmsg->flags & F_FLAGGED) || tmsg->size <= svars->chan->stores[t]->max_size) { if (tmsg->flags) { srec->flags = tmsg->flags; Fprintf( svars->jfp, "* %d %d %u\n", srec->uid[M], srec->uid[S], srec->flags ); @@ -1558,7 +1558,7 @@ msgs_flags_set( sync_vars_t *svars, int t ) debug( "%s: not trashing message %d - not new\n", str_ms[t], tmsg->uid ); } else { if (!tmsg->srec || tmsg->srec->uid[1-t] < 0) { - if (!svars->ctx[1-t]->conf->max_size || tmsg->size <= svars->ctx[1-t]->conf->max_size) { + if (tmsg->size <= svars->ctx[1-t]->conf->max_size) { debug( "%s: remote trashing message %d\n", str_ms[t], tmsg->uid ); svars->trash_total[t]++; stats( svars );