isync

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

commit f1809ddd2b32d01d8fd7161040768ab4377285ce
parent f43617cd94553a46945eabb6ce7cf56fb1375651
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat,  3 Jan 2015 23:16:20 +0100

open the mailboxes after loading the sync state

this allows us to react differently to a box'es absence depending on the
state. hypothetically, so far.

Diffstat:
Msrc/sync.c | 39++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/sync.c b/src/sync.c @@ -924,6 +924,7 @@ load_state( sync_vars_t *svars ) } static void box_opened( int sts, void *aux ); +static void load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int nmexcs ); void sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan, @@ -968,48 +969,48 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan, return; } } + + if (!prepare_state( svars )) { + svars->ret = SYNC_FAIL; + sync_bail2( svars ); + return; + } + if (!load_state( svars )) { + svars->ret = SYNC_FAIL; + sync_bail( svars ); + return; + } + sync_ref( svars ); - for (t = 0; t < 2; t++) { + for (t = 0; ; t++) { info( "Opening %s box %s...\n", str_ms[t], svars->orig_name[t] ); svars->drv[t]->open_box( ctx[t], (chan->ops[t] & OP_CREATE) != 0, box_opened, AUX ); - if (check_cancel( svars )) + if (t || check_cancel( svars )) break; } sync_deref( svars ); } -static void load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int nmexcs ); - static void box_opened( int sts, void *aux ) { DECL_SVARS; - sync_rec_t *srec; store_t *ctx[2]; channel_conf_t *chan; + sync_rec_t *srec; int opts[2], fails; int *mexcs, nmexcs, rmexcs, minwuid; if (check_ret( sts, aux )) return; INIT_SVARS(aux); - ctx[0] = svars->ctx[0]; - ctx[1] = svars->ctx[1]; - chan = svars->chan; + svars->state[t] |= ST_SELECTED; if (!(svars->state[1-t] & ST_SELECTED)) return; - - if (!prepare_state( svars )) { - svars->ret = SYNC_FAIL; - sync_bail2( svars ); - return; - } - if (!load_state( svars )) { - svars->ret = SYNC_FAIL; - sync_bail( svars ); - return; - } + ctx[0] = svars->ctx[0]; + ctx[1] = svars->ctx[1]; + chan = svars->chan; fails = 0; for (t = 0; t < 2; t++)