Browse Source

rename driver::prepare_opts() => prepare_load()

... and move it to the right place in the structure and fix the doc to
not claim that it is called before select().
wip/server-refactor
Oswald Buddenhagen 10 years ago
parent
commit
00ebf45be2
  1. 10
      src/driver.h
  2. 16
      src/drv_imap.c
  3. 4
      src/drv_maildir.c
  4. 4
      src/sync.c

10
src/driver.h

@ -161,16 +161,16 @@ struct driver {
void (*list)( store_t *ctx, int flags, void (*list)( store_t *ctx, int flags,
void (*cb)( int sts, void *aux ), void *aux ); void (*cb)( int sts, void *aux ), void *aux );
/* Invoked before select(), this informs the driver which operations (OP_*)
* will be performed on the mailbox. The driver may extend the set by implicitly
* needed or available operations. */
void (*prepare_opts)( store_t *ctx, int opts );
/* Open the mailbox name. Optionally create missing boxes. /* Open the mailbox name. Optionally create missing boxes.
* As a side effect, this should resolve ctx->path if applicable. */ * As a side effect, this should resolve ctx->path if applicable. */
void (*select)( store_t *ctx, const char *name, int create, void (*select)( store_t *ctx, const char *name, int create,
void (*cb)( int sts, void *aux ), void *aux ); void (*cb)( int sts, void *aux ), void *aux );
/* Invoked before load(), this informs the driver which operations (OP_*)
* will be performed on the mailbox. The driver may extend the set by implicitly
* needed or available operations. */
void (*prepare_load)( store_t *ctx, int opts );
/* Load the message attributes needed to perform the requested operations. /* Load the message attributes needed to perform the requested operations.
* Consider only messages with UIDs between minuid and maxuid (inclusive) * Consider only messages with UIDs between minuid and maxuid (inclusive)
* and those named in the excs array (smaller than minuid). * and those named in the excs array (smaller than minuid).

16
src/drv_imap.c

@ -2108,14 +2108,6 @@ imap_open_store_bail( imap_store_t *ctx )
cb( 0, aux ); cb( 0, aux );
} }
/******************* imap_prepare_opts *******************/
static void
imap_prepare_opts( store_t *gctx, int opts )
{
gctx->opts = opts;
}
/******************* imap_select *******************/ /******************* imap_select *******************/
static void static void
@ -2148,6 +2140,12 @@ imap_select( store_t *gctx, const char *name, int create,
/******************* imap_load *******************/ /******************* imap_load *******************/
static void
imap_prepare_load( store_t *gctx, int opts )
{
gctx->opts = opts;
}
static int imap_submit_load( imap_store_t *, const char *, int, struct imap_cmd_refcounted_state * ); static int imap_submit_load( imap_store_t *, const char *, int, struct imap_cmd_refcounted_state * );
static void static void
@ -2781,8 +2779,8 @@ struct driver imap_driver = {
imap_disown_store, imap_disown_store,
imap_cancel_store, imap_cancel_store,
imap_list, imap_list,
imap_prepare_opts,
imap_select, imap_select,
imap_prepare_load,
imap_load, imap_load,
imap_fetch_msg, imap_fetch_msg,
imap_store_msg, imap_store_msg,

4
src/drv_maildir.c

@ -1041,7 +1041,7 @@ maildir_select( store_t *gctx, const char *name, int create,
} }
static void static void
maildir_prepare_opts( store_t *gctx, int opts ) maildir_prepare_load( store_t *gctx, int opts )
{ {
if (opts & OPEN_SETFLAGS) if (opts & OPEN_SETFLAGS)
opts |= OPEN_OLD; opts |= OPEN_OLD;
@ -1531,8 +1531,8 @@ struct driver maildir_driver = {
maildir_disown_store, maildir_disown_store,
maildir_disown_store, /* _cancel_, but it's the same */ maildir_disown_store, /* _cancel_, but it's the same */
maildir_list, maildir_list,
maildir_prepare_opts,
maildir_select, maildir_select,
maildir_prepare_load,
maildir_load, maildir_load,
maildir_fetch_msg, maildir_fetch_msg,
maildir_store_msg, maildir_store_msg,

4
src/sync.c

@ -1007,8 +1007,8 @@ box_selected( int sts, void *aux )
assert( !"sync record with stray TUID" ); assert( !"sync record with stray TUID" );
} }
} }
svars->drv[M]->prepare_opts( ctx[M], opts[M] ); svars->drv[M]->prepare_load( ctx[M], opts[M] );
svars->drv[S]->prepare_opts( ctx[S], opts[S] ); svars->drv[S]->prepare_load( ctx[S], opts[S] );
mexcs = 0; mexcs = 0;
nmexcs = rmexcs = 0; nmexcs = rmexcs = 0;

Loading…
Cancel
Save