From a1c402678c99a551ee076d8cf972eac6b91dfb2e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 29 Jan 2006 11:22:45 +0000 Subject: [PATCH] split driver->prepare into ->prepare_opts and ->prepare_paths --- src/drv_imap.c | 10 ++++++++-- src/drv_maildir.c | 10 ++++++++-- src/isync.h | 3 ++- src/sync.c | 3 ++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index f930764..e344a3a 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -1398,10 +1398,15 @@ imap_open_store( store_conf_t *conf, store_t *oldctx ) } static void -imap_prepare( store_t *gctx, int opts ) +imap_prepare_paths( store_t *gctx ) { free_generic_messages( gctx->msgs ); gctx->msgs = 0; +} + +static void +imap_prepare_opts( store_t *gctx, int opts ) +{ gctx->opts = opts; } @@ -1812,7 +1817,8 @@ struct driver imap_driver = { imap_open_store, imap_close_store, imap_list, - imap_prepare, + imap_prepare_paths, + imap_prepare_opts, imap_select, imap_fetch_msg, imap_store_msg, diff --git a/src/drv_maildir.c b/src/drv_maildir.c index e5235c1..ba52eca 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -703,7 +703,7 @@ maildir_app_msg( maildir_store_t *ctx, message_t ***msgapp, msg_t *entry ) } static void -maildir_prepare( store_t *gctx, int opts ) +maildir_prepare_paths( store_t *gctx ) { maildir_store_t *ctx = (maildir_store_t *)gctx; @@ -717,6 +717,11 @@ maildir_prepare( store_t *gctx, int opts ) gctx->path = nfstrdup( ((maildir_store_conf_t *)gctx->conf)->inbox ); else nfasprintf( &gctx->path, "%s%s", gctx->conf->path, gctx->name ); +} + +static void +maildir_prepare_opts( store_t *gctx, int opts ) +{ if (opts & OPEN_SETFLAGS) opts |= OPEN_OLD; if (opts & OPEN_EXPUNGE) @@ -1188,7 +1193,8 @@ struct driver maildir_driver = { maildir_open_store, maildir_close_store, maildir_list, - maildir_prepare, + maildir_prepare_paths, + maildir_prepare_opts, maildir_select, maildir_fetch_msg, maildir_store_msg, diff --git a/src/isync.h b/src/isync.h index 6a70b07..3fd1f6d 100644 --- a/src/isync.h +++ b/src/isync.h @@ -171,7 +171,8 @@ struct driver { store_t *(*open_store)( store_conf_t *conf, store_t *oldctx ); void (*close_store)( store_t *ctx ); int (*list)( store_t *ctx, string_list_t **boxes ); - void (*prepare)( store_t *ctx, int opts ); + void (*prepare_paths)( store_t *ctx ); + void (*prepare_opts)( store_t *ctx, int opts ); int (*select)( store_t *ctx, int minuid, int maxuid, int *excs, int nexcs ); int (*fetch_msg)( store_t *ctx, message_t *msg, msg_data_t *data ); int (*store_msg)( store_t *ctx, msg_data_t *data, int *uid ); /* if uid is null, store to trash */ diff --git a/src/sync.c b/src/sync.c index 939d09b..9993e12 100644 --- a/src/sync.c +++ b/src/sync.c @@ -236,7 +236,8 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan ) "INBOX" : names[t]; ctx[t]->uidvalidity = 0; driver[t] = ctx[t]->conf->driver; - driver[t]->prepare( ctx[t], opts[t] ); + 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, "*" )) {