|
|
|
@ -147,7 +147,7 @@ typedef struct sync_rec {
|
|
|
|
|
typedef struct { |
|
|
|
|
int t[2]; |
|
|
|
|
void (*cb)( int sts, void *aux ), *aux; |
|
|
|
|
char *dname, *jname, *nname, *lname; |
|
|
|
|
char *dname, *jname, *nname, *lname, *box_name[2]; |
|
|
|
|
FILE *jfp, *nfp; |
|
|
|
|
sync_rec_t *srecs, **srecadd; |
|
|
|
|
channel_conf_t *chan; |
|
|
|
@ -598,14 +598,13 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan,
|
|
|
|
|
svars->uidval[0] = svars->uidval[1] = -1; |
|
|
|
|
svars->srecadd = &svars->srecs; |
|
|
|
|
|
|
|
|
|
ctx[0]->name = ctx[1]->name = 0; |
|
|
|
|
for (t = 0; t < 2; t++) { |
|
|
|
|
ctx[t]->orig_name = |
|
|
|
|
(!names[t] || (ctx[t]->conf->map_inbox && !strcmp( ctx[t]->conf->map_inbox, names[t] ))) ? |
|
|
|
|
"INBOX" : names[t]; |
|
|
|
|
if (!ctx[t]->conf->flat_delim) { |
|
|
|
|
ctx[t]->name = nfstrdup( ctx[t]->orig_name ); |
|
|
|
|
} else if (map_name( ctx[t]->orig_name, &ctx[t]->name, 0, "/", ctx[t]->conf->flat_delim ) < 0) { |
|
|
|
|
svars->box_name[t] = nfstrdup( ctx[t]->orig_name ); |
|
|
|
|
} else if (map_name( ctx[t]->orig_name, &svars->box_name[t], 0, "/", ctx[t]->conf->flat_delim ) < 0) { |
|
|
|
|
error( "Error: canonical mailbox name '%s' contains flattened hierarchy delimiter\n", ctx[t]->orig_name ); |
|
|
|
|
svars->ret = SYNC_FAIL; |
|
|
|
|
sync_bail3( svars ); |
|
|
|
@ -620,7 +619,7 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan,
|
|
|
|
|
sync_ref( svars ); |
|
|
|
|
for (t = 0; t < 2; t++) { |
|
|
|
|
info( "Selecting %s %s...\n", str_ms[t], ctx[t]->orig_name ); |
|
|
|
|
svars->drv[t]->select( ctx[t], (chan->ops[t] & OP_CREATE) != 0, box_selected, AUX ); |
|
|
|
|
svars->drv[t]->select( ctx[t], svars->box_name[t], (chan->ops[t] & OP_CREATE) != 0, box_selected, AUX ); |
|
|
|
|
if (check_cancel( svars )) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -665,11 +664,11 @@ box_selected( int sts, void *aux )
|
|
|
|
|
} |
|
|
|
|
nfasprintf( &svars->dname, "%s/." EXE "state", ctx[S]->path ); |
|
|
|
|
} else { |
|
|
|
|
csname = clean_strdup( ctx[S]->name ); |
|
|
|
|
csname = clean_strdup( svars->box_name[S] ); |
|
|
|
|
if (chan->sync_state) |
|
|
|
|
nfasprintf( &svars->dname, "%s%s", chan->sync_state, csname ); |
|
|
|
|
else { |
|
|
|
|
cmname = clean_strdup( ctx[M]->name ); |
|
|
|
|
cmname = clean_strdup( svars->box_name[M] ); |
|
|
|
|
nfasprintf( &svars->dname, "%s:%s:%s_:%s:%s", global_conf.sync_state, |
|
|
|
|
chan->stores[M]->name, cmname, chan->stores[S]->name, csname ); |
|
|
|
|
free( cmname ); |
|
|
|
@ -1919,8 +1918,8 @@ sync_bail2( sync_vars_t *svars )
|
|
|
|
|
static void |
|
|
|
|
sync_bail3( sync_vars_t *svars ) |
|
|
|
|
{ |
|
|
|
|
free( svars->ctx[M]->name ); |
|
|
|
|
free( svars->ctx[S]->name ); |
|
|
|
|
free( svars->box_name[M] ); |
|
|
|
|
free( svars->box_name[S] ); |
|
|
|
|
sync_deref( svars ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|