diff --git a/src/driver.h b/src/driver.h index aa4dc0e..9fd0c1b 100644 --- a/src/driver.h +++ b/src/driver.h @@ -158,26 +158,26 @@ struct driver { void (*cancel_store)( store_t *ctx ); /* List the mailboxes in this store. Flags are ORed LIST_* values. */ - void (*list)( store_t *ctx, int flags, - void (*cb)( int sts, void *aux ), void *aux ); + void (*list_store)( store_t *ctx, int flags, + void (*cb)( int sts, void *aux ), void *aux ); /* Open the mailbox name. Optionally create missing boxes. * As a side effect, this should resolve ctx->path if applicable. */ - void (*select)( store_t *ctx, const char *name, int create, - void (*cb)( int sts, void *aux ), void *aux ); + void (*select_box)( store_t *ctx, const char *name, int create, + void (*cb)( int sts, void *aux ), void *aux ); - /* Invoked before load(), this informs the driver which operations (OP_*) + /* Invoked before load_box(), 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 ); + void (*prepare_load_box)( store_t *ctx, int opts ); /* Load the message attributes needed to perform the requested operations. * Consider only messages with UIDs between minuid and maxuid (inclusive) * and those named in the excs array (smaller than minuid). * The driver takes ownership of the excs array. Messages below newuid do not need * to have the TUID populated even if OPEN_FIND is set. */ - void (*load)( store_t *ctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, - void (*cb)( int sts, void *aux ), void *aux ); + void (*load_box)( store_t *ctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, + void (*cb)( int sts, void *aux ), void *aux ); /* Fetch the contents and flags of the given message from the current mailbox. */ void (*fetch_msg)( store_t *ctx, message_t *msg, msg_data_t *data, @@ -198,8 +198,8 @@ struct driver { * a pre-fetched one (in which case the in-memory representation is updated), * or it may be identifed by UID only. The operation may be delayed until commit() * is called. */ - void (*set_flags)( store_t *ctx, message_t *msg, int uid, int add, int del, /* msg can be null, therefore uid as a fallback */ - void (*cb)( int sts, void *aux ), void *aux ); + void (*set_msg_flags)( store_t *ctx, message_t *msg, int uid, int add, int del, /* msg can be null, therefore uid as a fallback */ + void (*cb)( int sts, void *aux ), void *aux ); /* Move the given message from the current mailbox to the trash folder. * This may expunge the original message immediately, but it needn't to. */ @@ -208,18 +208,18 @@ struct driver { /* Expunge deleted messages from the current mailbox and close it. * There is no need to explicitly close a mailbox if no expunge is needed. */ - void (*close)( store_t *ctx, /* IMAP-style: expunge inclusive */ - void (*cb)( int sts, void *aux ), void *aux ); + void (*close_box)( store_t *ctx, /* IMAP-style: expunge inclusive */ + void (*cb)( int sts, void *aux ), void *aux ); /* Cancel queued commands which are not in flight yet; they will have their * callbacks invoked with DRV_CANCELED. Afterwards, wait for the completion of * the in-flight commands. If the store is canceled before this command completes, * the callback will *not* be invoked. */ - void (*cancel)( store_t *ctx, - void (*cb)( void *aux ), void *aux ); + void (*cancel_cmds)( store_t *ctx, + void (*cb)( void *aux ), void *aux ); - /* Commit any pending set_flags() commands. */ - void (*commit)( store_t *ctx ); + /* Commit any pending set_msg_flags() commands. */ + void (*commit_cmds)( store_t *ctx ); }; void free_generic_messages( message_t * ); diff --git a/src/drv_imap.c b/src/drv_imap.c index 7efd270..946a501 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -2108,11 +2108,11 @@ imap_open_store_bail( imap_store_t *ctx ) cb( 0, aux ); } -/******************* imap_select *******************/ +/******************* imap_select_box *******************/ static void -imap_select( store_t *gctx, const char *name, int create, - void (*cb)( int sts, void *aux ), void *aux ) +imap_select_box( store_t *gctx, const char *name, int create, + void (*cb)( int sts, void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; struct imap_cmd_simple *cmd; @@ -2138,10 +2138,10 @@ imap_select( store_t *gctx, const char *name, int create, free( buf ); } -/******************* imap_load *******************/ +/******************* imap_load_box *******************/ static void -imap_prepare_load( store_t *gctx, int opts ) +imap_prepare_load_box( store_t *gctx, int opts ) { gctx->opts = opts; } @@ -2149,8 +2149,8 @@ imap_prepare_load( store_t *gctx, int opts ) static int imap_submit_load( imap_store_t *, const char *, int, struct imap_cmd_refcounted_state * ); static void -imap_load( store_t *gctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, - void (*cb)( int sts, void *aux ), void *aux ) +imap_load_box( store_t *gctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, + void (*cb)( int sts, void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; int i, j, bl; @@ -2239,7 +2239,7 @@ imap_fetch_msg_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response ) imap_done_simple_msg( ctx, gcmd, response ); } -/******************* imap_set_flags *******************/ +/******************* imap_set_msg_flags *******************/ static void imap_set_flags_p2( imap_store_t *, struct imap_cmd *, int ); @@ -2273,8 +2273,8 @@ imap_flags_helper( imap_store_t *ctx, int uid, char what, int flags, } static void -imap_set_flags( store_t *gctx, message_t *msg, int uid, int add, int del, - void (*cb)( int sts, void *aux ), void *aux ) +imap_set_msg_flags( store_t *gctx, message_t *msg, int uid, int add, int del, + void (*cb)( int sts, void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; @@ -2311,11 +2311,11 @@ imap_set_flags_p2( imap_store_t *ctx ATTR_UNUSED, struct imap_cmd *cmd, int resp imap_refcounted_done( sts ); } -/******************* imap_close *******************/ +/******************* imap_close_box *******************/ static void -imap_close( store_t *gctx, - void (*cb)( int sts, void *aux ), void *aux ) +imap_close_box( store_t *gctx, + void (*cb)( int sts, void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; @@ -2472,11 +2472,11 @@ imap_find_new_msgs_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response ) "UID FETCH %d:1000000000 (UID BODY.PEEK[HEADER.FIELDS (X-TUID)])", cmdp->uid ); } -/******************* imap_list *******************/ +/******************* imap_list_store *******************/ static void -imap_list( store_t *gctx, int flags, - void (*cb)( int sts, void *aux ), void *aux ) +imap_list_store( store_t *gctx, int flags, + void (*cb)( int sts, void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; struct imap_cmd_refcounted_state *sts = imap_refcounted_new_state( cb, aux ); @@ -2491,11 +2491,11 @@ imap_list( store_t *gctx, int flags, imap_refcounted_done( sts ); } -/******************* imap_cancel *******************/ +/******************* imap_cancel_cmds *******************/ static void -imap_cancel( store_t *gctx, - void (*cb)( void *aux ), void *aux ) +imap_cancel_cmds( store_t *gctx, + void (*cb)( void *aux ), void *aux ) { imap_store_t *ctx = (imap_store_t *)gctx; @@ -2509,10 +2509,10 @@ imap_cancel( store_t *gctx, } } -/******************* imap_commit *******************/ +/******************* imap_commit_cmds *******************/ static void -imap_commit( store_t *gctx ) +imap_commit_cmds( store_t *gctx ) { (void)gctx; } @@ -2778,16 +2778,16 @@ struct driver imap_driver = { imap_open_store, imap_disown_store, imap_cancel_store, - imap_list, - imap_select, - imap_prepare_load, - imap_load, + imap_list_store, + imap_select_box, + imap_prepare_load_box, + imap_load_box, imap_fetch_msg, imap_store_msg, imap_find_new_msgs, - imap_set_flags, + imap_set_msg_flags, imap_trash_msg, - imap_close, - imap_cancel, - imap_commit, + imap_close_box, + imap_cancel_cmds, + imap_commit_cmds, }; diff --git a/src/drv_maildir.c b/src/drv_maildir.c index e745fb5..861d9e2 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -295,8 +295,8 @@ maildir_list_path( store_t *gctx, int *flags ) } static void -maildir_list( store_t *gctx, int flags, - void (*cb)( int sts, void *aux ), void *aux ) +maildir_list_store( store_t *gctx, int flags, + void (*cb)( int sts, void *aux ), void *aux ) { if (((flags & LIST_PATH) && maildir_list_path( gctx, &flags ) < 0) || ((flags & LIST_INBOX) && maildir_list_inbox( gctx, &flags ) < 0)) { @@ -927,8 +927,8 @@ maildir_app_msg( maildir_store_t *ctx, message_t ***msgapp, msg_t *entry ) } static void -maildir_select( store_t *gctx, const char *name, int create, - void (*cb)( int sts, void *aux ), void *aux ) +maildir_select_box( store_t *gctx, const char *name, int create, + void (*cb)( int sts, void *aux ), void *aux ) { maildir_store_t *ctx = (maildir_store_t *)gctx; int ret; @@ -1041,7 +1041,7 @@ maildir_select( store_t *gctx, const char *name, int create, } static void -maildir_prepare_load( store_t *gctx, int opts ) +maildir_prepare_load_box( store_t *gctx, int opts ) { if (opts & OPEN_SETFLAGS) opts |= OPEN_OLD; @@ -1051,8 +1051,8 @@ maildir_prepare_load( store_t *gctx, int opts ) } static void -maildir_load( store_t *gctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, - void (*cb)( int sts, void *aux ), void *aux ) +maildir_load_box( store_t *gctx, int minuid, int maxuid, int newuid, int *excs, int nexcs, + void (*cb)( int sts, void *aux ), void *aux ) { maildir_store_t *ctx = (maildir_store_t *)gctx; message_t **msgapp; @@ -1302,8 +1302,8 @@ maildir_find_new_msgs( store_t *gctx ATTR_UNUSED, int newuid ATTR_UNUSED, } static void -maildir_set_flags( store_t *gctx, message_t *gmsg, int uid ATTR_UNUSED, int add, int del, - void (*cb)( int sts, void *aux ), void *aux ) +maildir_set_msg_flags( store_t *gctx, message_t *gmsg, int uid ATTR_UNUSED, int add, int del, + void (*cb)( int sts, void *aux ), void *aux ) { maildir_store_conf_t *conf = (maildir_store_conf_t *)gctx->conf; maildir_store_t *ctx = (maildir_store_t *)gctx; @@ -1424,8 +1424,8 @@ maildir_trash_msg( store_t *gctx, message_t *gmsg, } static void -maildir_close( store_t *gctx, - void (*cb)( int sts, void *aux ), void *aux ) +maildir_close_box( store_t *gctx, + void (*cb)( int sts, void *aux ), void *aux ) { #ifdef USE_DB maildir_store_t *ctx = (maildir_store_t *)gctx; @@ -1468,14 +1468,14 @@ maildir_close( store_t *gctx, } static void -maildir_cancel( store_t *gctx ATTR_UNUSED, - void (*cb)( void *aux ), void *aux ) +maildir_cancel_cmds( store_t *gctx ATTR_UNUSED, + void (*cb)( void *aux ), void *aux ) { cb( aux ); } static void -maildir_commit( store_t *gctx ) +maildir_commit_cmds( store_t *gctx ) { (void) gctx; } @@ -1530,16 +1530,16 @@ struct driver maildir_driver = { maildir_open_store, maildir_disown_store, maildir_disown_store, /* _cancel_, but it's the same */ - maildir_list, - maildir_select, - maildir_prepare_load, - maildir_load, + maildir_list_store, + maildir_select_box, + maildir_prepare_load_box, + maildir_load_box, maildir_fetch_msg, maildir_store_msg, maildir_find_new_msgs, - maildir_set_flags, + maildir_set_msg_flags, maildir_trash_msg, - maildir_close, - maildir_cancel, - maildir_commit, + maildir_close_box, + maildir_cancel_cmds, + maildir_commit_cmds, }; diff --git a/src/main.c b/src/main.c index 0ff9ec8..0006f5b 100644 --- a/src/main.c +++ b/src/main.c @@ -756,7 +756,7 @@ store_opened( store_t *ctx, void *aux ) } } set_bad_callback( ctx, store_bad, AUX ); - mvars->drv[t]->list( ctx, flags, store_listed, AUX ); + mvars->drv[t]->list_store( ctx, flags, store_listed, AUX ); } else { mvars->state[t] = ST_OPEN; sync_chans( mvars, E_OPEN ); diff --git a/src/sync.c b/src/sync.c index 77fa691..96fabd4 100644 --- a/src/sync.c +++ b/src/sync.c @@ -484,7 +484,7 @@ cancel_sync( sync_vars_t *svars ) } else if (!(svars->state[t] & ST_SENT_CANCEL)) { /* ignore subsequent failures from in-flight commands */ svars->state[t] |= ST_SENT_CANCEL; - svars->drv[t]->cancel( svars->ctx[t], cancel_done, AUX ); + svars->drv[t]->cancel_cmds( svars->ctx[t], cancel_done, AUX ); } if (other_state & ST_CANCELED) break; @@ -621,7 +621,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], svars->orig_name[t] ); - svars->drv[t]->select( ctx[t], svars->box_name[t], (chan->ops[t] & OP_CREATE) != 0, box_selected, AUX ); + svars->drv[t]->select_box( ctx[t], svars->box_name[t], (chan->ops[t] & OP_CREATE) != 0, box_selected, AUX ); if (check_cancel( svars )) break; } @@ -1007,8 +1007,8 @@ box_selected( int sts, void *aux ) assert( !"sync record with stray TUID" ); } } - svars->drv[M]->prepare_load( ctx[M], opts[M] ); - svars->drv[S]->prepare_load( ctx[S], opts[S] ); + svars->drv[M]->prepare_load_box( ctx[M], opts[M] ); + svars->drv[S]->prepare_load_box( ctx[S], opts[S] ); mexcs = 0; nmexcs = rmexcs = 0; @@ -1094,7 +1094,7 @@ load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int nmexcs ) maxwuid = 0; info( "Loading %s...\n", str_ms[t] ); debug( maxwuid == INT_MAX ? "loading %s [%d,inf]\n" : "loading %s [%d,%d]\n", str_ms[t], minwuid, maxwuid ); - svars->drv[t]->load( svars->ctx[t], minwuid, maxwuid, svars->newuid[t], mexcs, nmexcs, box_loaded, AUX ); + svars->drv[t]->load_box( svars->ctx[t], minwuid, maxwuid, svars->newuid[t], mexcs, nmexcs, box_loaded, AUX ); } typedef struct { @@ -1489,7 +1489,7 @@ box_loaded( int sts, void *aux ) fv->srec = srec; fv->aflags = aflags; fv->dflags = dflags; - svars->drv[t]->set_flags( svars->ctx[t], srec->msg[t], srec->uid[t], aflags, dflags, flags_set, fv ); + svars->drv[t]->set_msg_flags( svars->ctx[t], srec->msg[t], srec->uid[t], aflags, dflags, flags_set, fv ); if (check_cancel( svars )) goto out; } else @@ -1497,7 +1497,7 @@ box_loaded( int sts, void *aux ) } } for (t = 0; t < 2; t++) { - svars->drv[t]->commit( svars->ctx[t] ); + svars->drv[t]->commit_cmds( svars->ctx[t] ); svars->state[t] |= ST_SENT_FLAGS; msgs_flags_set( svars, t ); if (check_cancel( svars )) @@ -1797,7 +1797,7 @@ sync_close( sync_vars_t *svars, int t ) if ((svars->chan->ops[t] & OP_EXPUNGE) /*&& !(svars->state[t] & ST_TRASH_BAD)*/) { debug( "expunging %s\n", str_ms[t] ); - svars->drv[t]->close( svars->ctx[t], box_closed, AUX ); + svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX ); } else { box_closed_p2( svars, t ); }