Skip to content

Commit

Permalink
mx api: rename implementation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Jun 6, 2018
1 parent 885b0b0 commit 76951d9
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 181 deletions.
58 changes: 29 additions & 29 deletions compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static int execute_command(struct Context *ctx, const char *command, const char
}

/**
* comp_open_mailbox - Open a compressed mailbox
* comp_mbox_open - Open a compressed mailbox
* @param ctx Mailbox to open
* @retval 0 Success
* @retval -1 Error
Expand All @@ -455,7 +455,7 @@ static int execute_command(struct Context *ctx, const char *command, const char
* Then determine the type of the mailbox so we can delegate the handling of
* messages.
*/
static int comp_open_mailbox(struct Context *ctx)
static int comp_mbox_open(struct Context *ctx)
{
if (!ctx || (ctx->magic != MUTT_COMPRESSED))
return -1;
Expand Down Expand Up @@ -508,7 +508,7 @@ static int comp_open_mailbox(struct Context *ctx)
}

/**
* comp_open_append_mailbox - Open a compressed mailbox for appending
* comp_mbox_open_append - Open a compressed mailbox for appending
* @param ctx Mailbox to open
* @param flags e.g. Does the file already exist?
* @retval 0 Success
Expand All @@ -517,7 +517,7 @@ static int comp_open_mailbox(struct Context *ctx)
* To append to a compressed mailbox we need an append-hook (or both open- and
* close-hooks).
*/
static int comp_open_append_mailbox(struct Context *ctx, int flags)
static int comp_mbox_open_append(struct Context *ctx, int flags)
{
if (!ctx)
return -1;
Expand Down Expand Up @@ -589,15 +589,15 @@ static int comp_open_append_mailbox(struct Context *ctx, int flags)
}

/**
* comp_close_mailbox - Close a compressed mailbox
* comp_mbox_close - Close a compressed mailbox
* @param ctx Mailbox to close
* @retval 0 Success
* @retval -1 Failure
*
* If the mailbox has been changed then re-compress the tmp file.
* Then delete the tmp file.
*/
static int comp_close_mailbox(struct Context *ctx)
static int comp_mbox_close(struct Context *ctx)
{
if (!ctx)
return -1;
Expand Down Expand Up @@ -663,7 +663,7 @@ static int comp_close_mailbox(struct Context *ctx)
}

/**
* comp_check_mailbox - Check for changes in the compressed file
* comp_mbox_check - Check for changes in the compressed file
* @param ctx Mailbox
* @param index_hint Currently selected mailbox
* @retval 0 Mailbox OK
Expand All @@ -677,7 +677,7 @@ static int comp_close_mailbox(struct Context *ctx)
*
* The return codes are picked to match mx_check_mailbox().
*/
static int comp_check_mailbox(struct Context *ctx, int *index_hint)
static int comp_mbox_check(struct Context *ctx, int *index_hint)
{
if (!ctx)
return -1;
Expand Down Expand Up @@ -710,14 +710,14 @@ static int comp_check_mailbox(struct Context *ctx, int *index_hint)
}

/**
* comp_open_message - Delegated to mbox handler
* comp_msg_open - Delegated to mbox handler
* @param ctx Mailbox
* @param msg Message to open
* @param msgno Message number
* @retval 0 Success
* @retval -1 Failure
*/
static int comp_open_message(struct Context *ctx, struct Message *msg, int msgno)
static int comp_msg_open(struct Context *ctx, struct Message *msg, int msgno)
{
if (!ctx)
return -1;
Expand All @@ -735,13 +735,13 @@ static int comp_open_message(struct Context *ctx, struct Message *msg, int msgno
}

/**
* comp_close_message - Delegated to mbox handler
* comp_msg_close - Delegated to mbox handler
* @param ctx Mailbox
* @param msg Message to close
* @retval 0 Success
* @retval -1 Failure
*/
static int comp_close_message(struct Context *ctx, struct Message *msg)
static int comp_msg_close(struct Context *ctx, struct Message *msg)
{
if (!ctx)
return -1;
Expand All @@ -759,13 +759,13 @@ static int comp_close_message(struct Context *ctx, struct Message *msg)
}

/**
* comp_commit_message - Delegated to mbox handler
* comp_msg_commit - Delegated to mbox handler
* @param ctx Mailbox
* @param msg Message to commit
* @retval 0 Success
* @retval -1 Failure
*/
static int comp_commit_message(struct Context *ctx, struct Message *msg)
static int comp_msg_commit(struct Context *ctx, struct Message *msg)
{
if (!ctx)
return -1;
Expand All @@ -783,14 +783,14 @@ static int comp_commit_message(struct Context *ctx, struct Message *msg)
}

/**
* comp_open_new_message - Delegated to mbox handler
* comp_msg_open_new - Delegated to mbox handler
* @param ctx Mailbox
* @param msg Message to commit
* @param hdr Email header
* @retval 0 Success
* @retval -1 Failure
*/
static int comp_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
static int comp_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
if (!ctx)
return -1;
Expand Down Expand Up @@ -859,16 +859,16 @@ bool mutt_comp_can_read(const char *path)
}

/**
* comp_sync_mailbox - Save changes to the compressed mailbox file
* comp_mbox_sync - Save changes to the compressed mailbox file
* @param ctx Mailbox to sync
* @param index_hint Currently selected mailbox
* @retval 0 Success
* @retval -1 Failure
*
* Changes in NeoMutt only affect the tmp file. Calling comp_sync_mailbox()
* Changes in NeoMutt only affect the tmp file. Calling comp_mbox_sync()
* will commit them to the compressed file.
*/
static int comp_sync_mailbox(struct Context *ctx, int *index_hint)
static int comp_mbox_sync(struct Context *ctx, int *index_hint)
{
if (!ctx)
return -1;
Expand All @@ -893,7 +893,7 @@ static int comp_sync_mailbox(struct Context *ctx, int *index_hint)
return -1;
}

int rc = comp_check_mailbox(ctx, index_hint);
int rc = comp_mbox_check(ctx, index_hint);
if (rc != 0)
goto sync_cleanup;

Expand Down Expand Up @@ -941,15 +941,15 @@ int mutt_comp_valid_command(const char *cmd)
* The message functions are delegated to mbox.
*/
struct MxOps mx_comp_ops = {
.mbox_open = comp_open_mailbox,
.mbox_open_append = comp_open_append_mailbox,
.mbox_check = comp_check_mailbox,
.mbox_sync = comp_sync_mailbox,
.mbox_close = comp_close_mailbox,
.msg_open = comp_open_message,
.msg_open_new = comp_open_new_message,
.msg_commit = comp_commit_message,
.msg_close = comp_close_message,
.mbox_open = comp_mbox_open,
.mbox_open_append = comp_mbox_open_append,
.mbox_check = comp_mbox_check,
.mbox_sync = comp_mbox_sync,
.mbox_close = comp_mbox_close,
.msg_open = comp_msg_open,
.msg_open_new = comp_msg_open_new,
.msg_commit = comp_msg_commit,
.msg_close = comp_msg_close,
.tags_edit = NULL,
.tags_commit = NULL,
};
Expand Down
50 changes: 25 additions & 25 deletions imap/imap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1969,12 +1969,12 @@ int imap_fast_trash(struct Context *ctx, char *dest)
}

/**
* imap_open_mailbox - Open an IMAP mailbox
* imap_mbox_open - Open an IMAP mailbox
* @param ctx Context
* @retval 0 Success
* @retval -1 Failure
*/
static int imap_open_mailbox(struct Context *ctx)
static int imap_mbox_open(struct Context *ctx)
{
struct ImapData *idata = NULL;
struct ImapStatus *status = NULL;
Expand Down Expand Up @@ -2195,13 +2195,13 @@ static int imap_open_mailbox(struct Context *ctx)
}

/**
* imap_open_mailbox_append - Open an IMAP mailbox to append
* imap_mbox_open_append - Open an IMAP mailbox to append
* @param ctx Context
* @param flags Mailbox flags (UNUSED)
* @retval 0 Success
* @retval -1 Failure
*/
static int imap_open_mailbox_append(struct Context *ctx, int flags)
static int imap_mbox_open_append(struct Context *ctx, int flags)
{
struct ImapData *idata = NULL;
char buf[LONG_STRING];
Expand Down Expand Up @@ -2247,18 +2247,18 @@ static int imap_open_mailbox_append(struct Context *ctx, int flags)
}

/**
* imap_close_mailbox - Clean up IMAP data in Context
* imap_mbox_close - Clean up IMAP data in Context
* @param ctx Context
* @retval 0 Always
*/
static int imap_close_mailbox(struct Context *ctx)
static int imap_mbox_close(struct Context *ctx)
{
struct ImapData *idata = ctx->data;
/* Check to see if the mailbox is actually open */
if (!idata)
return 0;

/* imap_open_mailbox_append() borrows the struct ImapData temporarily,
/* imap_mbox_open_append() borrows the struct ImapData temporarily,
* just for the connection, but does not set idata->ctx to the
* open-append ctx.
*
Expand Down Expand Up @@ -2311,14 +2311,14 @@ static int imap_close_mailbox(struct Context *ctx)
}

/**
* imap_open_new_message - Open an IMAP message
* imap_msg_open_new - Open an IMAP message
* @param ctx Context (UNUSED)
* @param msg Message to open
* @param hdr Header (UNUSED)
* @retval 0 Success
* @retval -1 Failure
*/
static int imap_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
static int imap_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
char tmp[_POSIX_PATH_MAX];

Expand All @@ -2334,13 +2334,13 @@ static int imap_open_new_message(struct Context *ctx, struct Message *msg, struc
}

/**
* imap_check_mailbox_reopen - Check for new mail (reopen mailbox if necessary)
* imap_mbox_check - Check for new mail (reopen mailbox if necessary)
* @param ctx Context
* @param index_hint Remember our place in the index
* @retval >0 Success, e.g. #MUTT_REOPENED
* @retval -1 Failure
*/
static int imap_check_mailbox_reopen(struct Context *ctx, int *index_hint)
static int imap_mbox_check(struct Context *ctx, int *index_hint)
{
int rc;
(void) index_hint;
Expand Down Expand Up @@ -2556,7 +2556,7 @@ int imap_sync_mailbox(struct Context *ctx, int expunge)
}

/**
* imap_edit_message_tags - Prompt and validate new messages tags
* imap_tags_edit - Prompt and validate new messages tags
* @param ctx Context
* @param tags Existing tags
* @param buf Buffer to store the tags
Expand All @@ -2565,7 +2565,7 @@ int imap_sync_mailbox(struct Context *ctx, int expunge)
* @retval 0 No valid user input
* @retval 1 Buf set
*/
static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *buf, size_t buflen)
static int imap_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t buflen)
{
char *new = NULL;
char *checker = NULL;
Expand Down Expand Up @@ -2639,7 +2639,7 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b
}

/**
* imap_commit_message_tags - Add/Change/Remove flags from headers
* imap_tags_commit - Add/Change/Remove flags from headers
* @param ctx Context
* @param hdr Header
* @param buf List of tags
Expand All @@ -2656,7 +2656,7 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b
* Also this method check that each flags is support by the server
* first and remove unsupported one.
*/
static int imap_commit_message_tags(struct Context *ctx, struct Header *hdr, char *buf)
static int imap_tags_commit(struct Context *ctx, struct Header *hdr, char *buf)
{
struct Buffer *cmd = NULL;
char uid[11];
Expand Down Expand Up @@ -2738,16 +2738,16 @@ static int imap_commit_message_tags(struct Context *ctx, struct Header *hdr, cha
* mx_imap_ops - Mailbox callback functions
*/
struct MxOps mx_imap_ops = {
.mbox_open = imap_open_mailbox,
.mbox_open_append = imap_open_mailbox_append,
.mbox_check = imap_check_mailbox_reopen,
.mbox_open = imap_mbox_open,
.mbox_open_append = imap_mbox_open_append,
.mbox_check = imap_mbox_check,
.mbox_sync = NULL, /* imap syncing is handled by imap_sync_mailbox */
.mbox_close = imap_close_mailbox,
.msg_open = imap_fetch_message,
.msg_open_new = imap_open_new_message,
.msg_commit = imap_commit_message,
.msg_close = imap_close_message,
.tags_edit = imap_edit_message_tags,
.tags_commit = imap_commit_message_tags,
.mbox_close = imap_mbox_close,
.msg_open = imap_msg_open,
.msg_open_new = imap_msg_open_new,
.msg_commit = imap_msg_commit,
.msg_close = imap_msg_close,
.tags_edit = imap_tags_edit,
.tags_commit = imap_tags_commit,
};
// clang-format on
6 changes: 3 additions & 3 deletions imap/imap_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ int imap_cache_del(struct ImapData *idata, struct Header *h);
int imap_cache_clean(struct ImapData *idata);
int imap_append_message(struct Context *ctx, struct Message *msg);

int imap_fetch_message(struct Context *ctx, struct Message *msg, int msgno);
int imap_close_message(struct Context *ctx, struct Message *msg);
int imap_commit_message(struct Context *ctx, struct Message *msg);
int imap_msg_open(struct Context *ctx, struct Message *msg, int msgno);
int imap_msg_close(struct Context *ctx, struct Message *msg);
int imap_msg_commit(struct Context *ctx, struct Message *msg);

/* util.c */
#ifdef USE_HCACHE
Expand Down
Loading

0 comments on commit 76951d9

Please sign in to comment.