commit f4ce961bab5d6999dfcf39a528b9550a8253fe8a
parent a1c402678c99a551ee076d8cf972eac6b91dfb2e
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sun, 29 Jan 2006 11:35:22 +0000
move driver options composition below journal replay - it might make
additional actions necessary (it doesn't, yet).
Diffstat:
M | src/sync.c | | | 71 | ++++++++++++++++++++++++++++++++++++----------------------------------- |
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/src/sync.c b/src/sync.c
@@ -196,40 +196,6 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan )
ret = SYNC_OK;
recs = 0, srecadd = &recs;
- opts[M] = opts[S] = 0;
- for (t = 0; t < 2; t++) {
- if (chan->ops[t] & (OP_DELETE|OP_FLAGS)) {
- opts[t] |= OPEN_SETFLAGS;
- opts[1-t] |= OPEN_OLD;
- if (chan->ops[t] & OP_FLAGS)
- opts[1-t] |= OPEN_FLAGS;
- }
- if (chan->ops[t] & (OP_NEW|OP_RENEW)) {
- opts[t] |= OPEN_APPEND;
- if (chan->ops[t] & OP_RENEW)
- opts[1-t] |= OPEN_OLD;
- if (chan->ops[t] & OP_NEW)
- opts[1-t] |= OPEN_NEW;
- if (chan->ops[t] & OP_EXPUNGE)
- opts[1-t] |= OPEN_FLAGS;
- if (chan->stores[t]->max_size)
- opts[1-t] |= OPEN_SIZE;
- }
- if (chan->ops[t] & OP_EXPUNGE) {
- opts[t] |= OPEN_EXPUNGE;
- if (chan->stores[t]->trash) {
- if (!chan->stores[t]->trash_only_new)
- opts[t] |= OPEN_OLD;
- opts[t] |= OPEN_NEW|OPEN_FLAGS;
- } else if (chan->stores[1-t]->trash && chan->stores[1-t]->trash_remote_new)
- opts[t] |= OPEN_NEW|OPEN_FLAGS;
- }
- if (chan->ops[t] & OP_CREATE)
- opts[t] |= OPEN_CREATE;
- }
- if ((chan->ops[S] & (OP_NEW|OP_RENEW)) && chan->max_messages)
- opts[S] |= OPEN_OLD|OPEN_NEW|OPEN_FLAGS;
-
for (t = 0; t < 2; t++) {
ctx[t]->name =
(!names[t] || (ctx[t]->conf->map_inbox && !strcmp( ctx[t]->conf->map_inbox, names[t] ))) ?
@@ -237,7 +203,6 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan )
ctx[t]->uidvalidity = 0;
driver[t] = ctx[t]->conf->driver;
driver[t]->prepare_paths( ctx[t] );
- driver[t]->prepare_opts( ctx[t], opts[t] );
}
if (!strcmp( chan->sync_state ? chan->sync_state : global_sync_state, "*" )) {
@@ -440,6 +405,42 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan )
}
skiprd:
+ opts[M] = opts[S] = 0;
+ for (t = 0; t < 2; t++) {
+ if (chan->ops[t] & (OP_DELETE|OP_FLAGS)) {
+ opts[t] |= OPEN_SETFLAGS;
+ opts[1-t] |= OPEN_OLD;
+ if (chan->ops[t] & OP_FLAGS)
+ opts[1-t] |= OPEN_FLAGS;
+ }
+ if (chan->ops[t] & (OP_NEW|OP_RENEW)) {
+ opts[t] |= OPEN_APPEND;
+ if (chan->ops[t] & OP_RENEW)
+ opts[1-t] |= OPEN_OLD;
+ if (chan->ops[t] & OP_NEW)
+ opts[1-t] |= OPEN_NEW;
+ if (chan->ops[t] & OP_EXPUNGE)
+ opts[1-t] |= OPEN_FLAGS;
+ if (chan->stores[t]->max_size)
+ opts[1-t] |= OPEN_SIZE;
+ }
+ if (chan->ops[t] & OP_EXPUNGE) {
+ opts[t] |= OPEN_EXPUNGE;
+ if (chan->stores[t]->trash) {
+ if (!chan->stores[t]->trash_only_new)
+ opts[t] |= OPEN_OLD;
+ opts[t] |= OPEN_NEW|OPEN_FLAGS;
+ } else if (chan->stores[1-t]->trash && chan->stores[1-t]->trash_remote_new)
+ opts[t] |= OPEN_NEW|OPEN_FLAGS;
+ }
+ if (chan->ops[t] & OP_CREATE)
+ opts[t] |= OPEN_CREATE;
+ }
+ if ((chan->ops[S] & (OP_NEW|OP_RENEW)) && chan->max_messages)
+ opts[S] |= OPEN_OLD|OPEN_NEW|OPEN_FLAGS;
+ driver[M]->prepare_opts( ctx[M], opts[M] );
+ driver[S]->prepare_opts( ctx[S], opts[S] );
+
if (ctx[S]->opts & OPEN_NEW)
maxwuid = INT_MAX;
else if (ctx[S]->opts & OPEN_OLD) {