From: Richard Russon Date: Tue, 5 Jun 2018 19:55:34 +0000 (+0100) Subject: mx api: rename implementation functions X-Git-Tag: neomutt-20180622~28^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76951d9dc4082061e5939a2bc5b82f7a4a08af1d;p=neomutt mx api: rename implementation functions --- diff --git a/compress.c b/compress.c index c3a8b6a69..0e0f58346 100644 --- a/compress.c +++ b/compress.c @@ -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 @@ -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; @@ -508,7 +508,7 @@ or_fail: } /** - * 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 @@ -517,7 +517,7 @@ or_fail: * 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; @@ -589,7 +589,7 @@ oa_fail1: } /** - * 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 @@ -597,7 +597,7 @@ oa_fail1: * 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; @@ -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 @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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, }; diff --git a/imap/imap.c b/imap/imap.c index 4342375a1..763620f10 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1969,12 +1969,12 @@ out: } /** - * 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; @@ -2195,13 +2195,13 @@ fail_noidata: } /** - * 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]; @@ -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. * @@ -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]; @@ -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; @@ -2556,7 +2556,7 @@ out: } /** - * 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 @@ -2565,7 +2565,7 @@ out: * @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; @@ -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 @@ -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]; @@ -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 diff --git a/imap/imap_private.h b/imap/imap_private.h index 554f4e194..6ae9f05ad 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -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 diff --git a/imap/message.c b/imap/message.c index 088895e2d..9411cd2af 100644 --- a/imap/message.c +++ b/imap/message.c @@ -971,14 +971,14 @@ error_out_0: } /** - * imap_fetch_message - Fetch an email from an IMAP server + * imap_msg_open - Fetch an email from an IMAP server * @param ctx Context * @param msg Message to fetch * @param msgno Index into ctr->hdrs * @retval 0 Success * @retval -1 Failure */ -int imap_fetch_message(struct Context *ctx, struct Message *msg, int msgno) +int imap_msg_open(struct Context *ctx, struct Message *msg, int msgno) { struct Envelope *newenv = NULL; char buf[LONG_STRING]; @@ -1090,7 +1090,7 @@ int imap_fetch_message(struct Context *ctx, struct Message *msg, int msgno) pc = imap_next_word(pc); if (imap_get_literal_count(pc, &bytes) < 0) { - imap_error("imap_fetch_message()", buf); + imap_error("imap_msg_open()", buf); goto bail; } if (output_progress) @@ -1202,26 +1202,26 @@ bail: } /** - * imap_close_message - Close an email + * imap_msg_close - Close an email * @param ctx Context * @param msg Email info * @retval 0 Success * @retval EOF Failure, see errno */ -int imap_close_message(struct Context *ctx, struct Message *msg) +int imap_msg_close(struct Context *ctx, struct Message *msg) { return mutt_file_fclose(&msg->fp); } /** - * imap_commit_message - Save changes to an email + * imap_msg_commit - Save changes to an email * @param ctx Context * @param msg Email info * @retval 0 Success * @retval EOF fclose() failed, see errno * @retval -1 Failure */ -int imap_commit_message(struct Context *ctx, struct Message *msg) +int imap_msg_commit(struct Context *ctx, struct Message *msg) { int r = mutt_file_fclose(&msg->fp); diff --git a/mbox.c b/mbox.c index 277fac8f4..8a3163efd 100644 --- a/mbox.c +++ b/mbox.c @@ -439,9 +439,9 @@ static int mbox_parse_mailbox(struct Context *ctx) } /** - * mbox_open_mailbox - open a mbox or mmdf style mailbox + * mbox_mbox_open - open a mbox or mmdf style mailbox */ -static int mbox_open_mailbox(struct Context *ctx) +static int mbox_mbox_open(struct Context *ctx) { int rc; @@ -471,7 +471,7 @@ static int mbox_open_mailbox(struct Context *ctx) return rc; } -static int mbox_open_mailbox_append(struct Context *ctx, int flags) +static int mbox_mbox_open_append(struct Context *ctx, int flags) { ctx->fp = mutt_file_fopen(ctx->path, (flags & MUTT_NEWFOLDER) ? "w" : "a"); if (!ctx->fp) @@ -492,7 +492,7 @@ static int mbox_open_mailbox_append(struct Context *ctx, int flags) return 0; } -static int mbox_close_mailbox(struct Context *ctx) +static int mbox_mbox_close(struct Context *ctx) { if (!ctx->fp) { @@ -510,21 +510,21 @@ static int mbox_close_mailbox(struct Context *ctx) return 0; } -static int mbox_open_message(struct Context *ctx, struct Message *msg, int msgno) +static int mbox_msg_open(struct Context *ctx, struct Message *msg, int msgno) { msg->fp = ctx->fp; return 0; } -static int mbox_close_message(struct Context *ctx, struct Message *msg) +static int mbox_msg_close(struct Context *ctx, struct Message *msg) { msg->fp = NULL; return 0; } -static int mbox_commit_message(struct Context *ctx, struct Message *msg) +static int mbox_msg_commit(struct Context *ctx, struct Message *msg) { if (fputc('\n', msg->fp) == EOF) return -1; @@ -538,7 +538,7 @@ static int mbox_commit_message(struct Context *ctx, struct Message *msg) return 0; } -static int mmdf_commit_message(struct Context *ctx, struct Message *msg) +static int mmdf_msg_commit(struct Context *ctx, struct Message *msg) { if (fputs(MMDF_SEP, msg->fp) == EOF) return -1; @@ -552,7 +552,7 @@ static int mmdf_commit_message(struct Context *ctx, struct Message *msg) return 0; } -static int mbox_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) { msg->fp = ctx->fp; return 0; @@ -774,7 +774,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) } /** - * mbox_check_mailbox - Has mailbox changed on disk + * mbox_mbox_check - Has mailbox changed on disk * @param[in] ctx Context * @param[out] index_hint Keep track of current index selection * @retval #MUTT_REOPENED Mailbox has been reopened @@ -783,7 +783,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint) * @retval 0 No change * @retval -1 Error */ -static int mbox_check_mailbox(struct Context *ctx, int *index_hint) +static int mbox_mbox_check(struct Context *ctx, int *index_hint) { struct stat st; bool unlock = false; @@ -936,11 +936,11 @@ void mbox_reset_atime(struct Context *ctx, struct stat *st) } /** - * mbox_sync_mailbox - Sync a mailbox to disk + * mbox_mbox_sync - Sync a mailbox to disk * @retval 0 Success * @retval -1 Failure */ -static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) +static int mbox_mbox_sync(struct Context *ctx, int *index_hint) { char tempfile[_POSIX_PATH_MAX]; char buf[32]; @@ -988,7 +988,7 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) } /* Check to make sure that the file hasn't changed on disk */ - i = mbox_check_mailbox(ctx, index_hint); + i = mbox_mbox_check(ctx, index_hint); if ((i == MUTT_NEW_MAIL) || (i == MUTT_REOPENED)) { /* new mail arrived, or mailbox reopened */ @@ -1307,29 +1307,29 @@ bail: /* Come here in case of disaster */ // clang-format off struct MxOps mx_mbox_ops = { - .mbox_open = mbox_open_mailbox, - .mbox_open_append = mbox_open_mailbox_append, - .mbox_check = mbox_check_mailbox, - .mbox_sync = mbox_sync_mailbox, - .mbox_close = mbox_close_mailbox, - .msg_open = mbox_open_message, - .msg_open_new = mbox_open_new_message, - .msg_commit = mbox_commit_message, - .msg_close = mbox_close_message, + .mbox_open = mbox_mbox_open, + .mbox_open_append = mbox_mbox_open_append, + .mbox_check = mbox_mbox_check, + .mbox_sync = mbox_mbox_sync, + .mbox_close = mbox_mbox_close, + .msg_open = mbox_msg_open, + .msg_open_new = mbox_msg_open_new, + .msg_commit = mbox_msg_commit, + .msg_close = mbox_msg_close, .tags_edit = NULL, .tags_commit = NULL, }; struct MxOps mx_mmdf_ops = { - .mbox_open = mbox_open_mailbox, - .mbox_open_append = mbox_open_mailbox_append, - .mbox_check = mbox_check_mailbox, - .mbox_sync = mbox_sync_mailbox, - .mbox_close = mbox_close_mailbox, - .msg_open = mbox_open_message, - .msg_open_new = mbox_open_new_message, - .msg_commit = mmdf_commit_message, - .msg_close = mbox_close_message, + .mbox_open = mbox_mbox_open, + .mbox_open_append = mbox_mbox_open_append, + .mbox_check = mbox_mbox_check, + .mbox_sync = mbox_mbox_sync, + .mbox_close = mbox_mbox_close, + .msg_open = mbox_msg_open, + .msg_open_new = mbox_msg_open_new, + .msg_commit = mmdf_msg_commit, + .msg_close = mbox_msg_close, .tags_edit = NULL, .tags_commit = NULL, }; diff --git a/mh.c b/mh.c index ffc7b5307..4c5e52721 100644 --- a/mh.c +++ b/mh.c @@ -1231,7 +1231,7 @@ static void maildir_delayed_parsing(struct Context *ctx, struct Maildir **md, mh_sort_natural(ctx, md); } -static int mh_close_mailbox(struct Context *ctx) +static int mh_mbox_close(struct Context *ctx) { FREE(&ctx->data); @@ -1317,12 +1317,12 @@ static int maildir_read_dir(struct Context *ctx) return 0; } -static int maildir_open_mailbox(struct Context *ctx) +static int maildir_mbox_open(struct Context *ctx) { return maildir_read_dir(ctx); } -static int maildir_open_mailbox_append(struct Context *ctx, int flags) +static int maildir_mbox_open_append(struct Context *ctx, int flags) { if (!(flags & MUTT_APPENDNEW)) { @@ -1369,12 +1369,12 @@ static int maildir_open_mailbox_append(struct Context *ctx, int flags) return 0; } -static int mh_open_mailbox(struct Context *ctx) +static int mh_mbox_open(struct Context *ctx) { return mh_read_dir(ctx, NULL); } -static int mh_open_mailbox_append(struct Context *ctx, int flags) +static int mh_mbox_open_append(struct Context *ctx, int flags) { if (!(flags & MUTT_APPENDNEW)) { @@ -1405,7 +1405,7 @@ static int mh_open_mailbox_append(struct Context *ctx, int flags) * Open a new (temporary) message in an MH folder. */ -static int mh_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr) +static int mh_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) { return mh_mkstemp(ctx, &msg->fp, &msg->path); } @@ -1462,30 +1462,30 @@ static int maildir_mh_open_message(struct Context *ctx, struct Message *msg, return 0; } -static int maildir_open_message(struct Context *ctx, struct Message *msg, int msgno) +static int maildir_msg_open(struct Context *ctx, struct Message *msg, int msgno) { return maildir_mh_open_message(ctx, msg, msgno, 1); } -static int mh_open_message(struct Context *ctx, struct Message *msg, int msgno) +static int mh_msg_open(struct Context *ctx, struct Message *msg, int msgno) { return maildir_mh_open_message(ctx, msg, msgno, 0); } -static int mh_close_message(struct Context *ctx, struct Message *msg) +static int mh_msg_close(struct Context *ctx, struct Message *msg) { return mutt_file_fclose(&msg->fp); } /** - * maildir_open_new_message - Open a new message in a maildir folder + * maildir_msg_open_new - Open a new message in a maildir folder * * Open a new (temporary) message in a maildir folder. * * Note that this uses _almost_ the maildir file name format, * but with a {cur,new} prefix. */ -static int maildir_open_new_message(struct Context *ctx, struct Message *msg, +static int maildir_msg_open_new(struct Context *ctx, struct Message *msg, struct Header *hdr) { int fd; @@ -1567,7 +1567,7 @@ static int maildir_open_new_message(struct Context *ctx, struct Message *msg, * * tmp/{cur,new}.neomutt-HOSTNAME-PID-COUNTER:flags * - * See also maildir_open_new_message(). + * See also maildir_msg_open_new(). */ static int md_commit_message(struct Context *ctx, struct Message *msg, struct Header *hdr) { @@ -1646,7 +1646,7 @@ static int md_commit_message(struct Context *ctx, struct Message *msg, struct He } } -static int maildir_commit_message(struct Context *ctx, struct Message *msg) +static int maildir_msg_commit(struct Context *ctx, struct Message *msg) { return md_commit_message(ctx, msg, NULL); } @@ -1732,7 +1732,7 @@ static int mh_commit_msg(struct Context *ctx, struct Message *msg, return 0; } -static int mh_commit_message(struct Context *ctx, struct Message *msg) +static int mh_msg_commit(struct Context *ctx, struct Message *msg) { return mh_commit_msg(ctx, msg, NULL, 1); } @@ -2012,7 +2012,7 @@ static void maildir_update_tables(struct Context *ctx, int *index_hint) } /** - * maildir_check_mailbox - Check for new mail + * maildir_mbox_check - Check for new mail * * This function handles arrival of new mail and reopening of maildir folders. * The basic idea here is we check to see if either the new or cur @@ -2021,7 +2021,7 @@ static void maildir_update_tables(struct Context *ctx, int *index_hint) * already knew about. We don't treat either subdirectory differently, as mail * could be copied directly into the cur directory from another agent. */ -static int maildir_check_mailbox(struct Context *ctx, int *index_hint) +static int maildir_mbox_check(struct Context *ctx, int *index_hint) { struct stat st_new; /* status of the "new" subdirectory */ struct stat st_cur; /* status of the "cur" subdirectory */ @@ -2171,7 +2171,7 @@ static int maildir_check_mailbox(struct Context *ctx, int *index_hint) } /** - * mh_check_mailbox - Check for new mail + * mh_mbox_check - Check for new mail * * This function handles arrival of new mail and reopening of mh/maildir * folders. Things are getting rather complex because we don't have a @@ -2180,7 +2180,7 @@ static int maildir_check_mailbox(struct Context *ctx, int *index_hint) * * Don't change this code unless you _really_ understand what happens. */ -static int mh_check_mailbox(struct Context *ctx, int *index_hint) +static int mh_mbox_check(struct Context *ctx, int *index_hint) { char buf[_POSIX_PATH_MAX]; struct stat st, st_cur; @@ -2291,7 +2291,7 @@ static int mh_check_mailbox(struct Context *ctx, int *index_hint) return 0; } -static int mh_sync_mailbox(struct Context *ctx, int *index_hint) +static int mh_mbox_sync(struct Context *ctx, int *index_hint) { int i, j; #ifdef USE_HCACHE @@ -2301,9 +2301,9 @@ static int mh_sync_mailbox(struct Context *ctx, int *index_hint) struct Progress progress; if (ctx->magic == MUTT_MH) - i = mh_check_mailbox(ctx, index_hint); + i = mh_mbox_check(ctx, index_hint); else - i = maildir_check_mailbox(ctx, index_hint); + i = maildir_mbox_check(ctx, index_hint); if (i != 0) return i; @@ -2608,29 +2608,29 @@ bool mx_is_mh(const char *path) // clang-format off struct MxOps mx_maildir_ops = { - .mbox_open = maildir_open_mailbox, - .mbox_open_append = maildir_open_mailbox_append, - .mbox_check = maildir_check_mailbox, - .mbox_sync = mh_sync_mailbox, - .mbox_close = mh_close_mailbox, - .msg_open = maildir_open_message, - .msg_open_new = maildir_open_new_message, - .msg_commit = maildir_commit_message, - .msg_close = mh_close_message, + .mbox_open = maildir_mbox_open, + .mbox_open_append = maildir_mbox_open_append, + .mbox_check = maildir_mbox_check, + .mbox_sync = mh_mbox_sync, + .mbox_close = mh_mbox_close, + .msg_open = maildir_msg_open, + .msg_open_new = maildir_msg_open_new, + .msg_commit = maildir_msg_commit, + .msg_close = mh_msg_close, .tags_edit = NULL, .tags_commit = NULL, }; struct MxOps mx_mh_ops = { - .mbox_open = mh_open_mailbox, - .mbox_open_append = mh_open_mailbox_append, - .mbox_check = mh_check_mailbox, - .mbox_sync = mh_sync_mailbox, - .mbox_close = mh_close_mailbox, - .msg_open = mh_open_message, - .msg_open_new = mh_open_new_message, - .msg_commit = mh_commit_message, - .msg_close = mh_close_message, + .mbox_open = mh_mbox_open, + .mbox_open_append = mh_mbox_open_append, + .mbox_check = mh_mbox_check, + .mbox_sync = mh_mbox_sync, + .mbox_close = mh_mbox_close, + .msg_open = mh_msg_open, + .msg_open_new = mh_msg_open_new, + .msg_commit = mh_msg_commit, + .msg_close = mh_msg_close, .tags_edit = NULL, .tags_commit = NULL, }; diff --git a/mutt_notmuch.c b/mutt_notmuch.c index beb51545b..6598a3ae7 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -1171,7 +1171,7 @@ static void append_message(struct Context *ctx, notmuch_query_t *q, if (newpath) { - /* remember that file has been moved -- nm_sync_mailbox() will update the DB */ + /* remember that file has been moved -- nm_mbox_sync() will update the DB */ struct NmHdrData *hd = (struct NmHdrData *) h->data; if (hd) @@ -2005,7 +2005,7 @@ void nm_query_window_backward(void) } /** - * nm_edit_message_tags - Prompt new messages tags + * nm_tags_edit - Prompt new messages tags * @param ctx Mailbox * @param tags Existing tags (UNUSED) * @param buf Buffer for message tags @@ -2014,7 +2014,7 @@ void nm_query_window_backward(void) * @retval 0 No valid user input * @retval 1 Buffer set */ -static int nm_edit_message_tags(struct Context *ctx, const char *tags, char *buf, size_t buflen) +static int nm_tags_edit(struct Context *ctx, const char *tags, char *buf, size_t buflen) { *buf = '\0'; if (mutt_get_field("Add/remove labels: ", buf, buflen, MUTT_NM_TAG) != 0) @@ -2023,14 +2023,14 @@ static int nm_edit_message_tags(struct Context *ctx, const char *tags, char *buf } /** - * nm_commit_message_tags - Save the tags to a message + * nm_tags_commit - Save the tags to a message * @param ctx Mailbox * @param hdr Email Header * @param buf Buffer containing tags * @retval 0 Success * @retval -1 Failure */ -static int nm_commit_message_tags(struct Context *ctx, struct Header *hdr, char *buf) +static int nm_tags_commit(struct Context *ctx, struct Header *hdr, char *buf) { struct NmCtxData *data = get_ctxdata(ctx); notmuch_database_t *db = NULL; @@ -2410,13 +2410,13 @@ done: } /** - * nm_open_mailbox - Open a notmuch virtual mailbox + * nm_mbox_open - Open a notmuch virtual mailbox * @param ctx Mailbox * @retval 0 Success * @retval -1 Error */ -static int nm_open_mailbox(struct Context *ctx) +static int nm_mbox_open(struct Context *ctx) { notmuch_query_t *q = NULL; struct NmCtxData *data = NULL; @@ -2464,12 +2464,12 @@ static int nm_open_mailbox(struct Context *ctx) } /** - * nm_close_mailbox - Close a notmuch virtual mailbox + * nm_mbox_close - Close a notmuch virtual mailbox * @param ctx Mailbox * @retval 0 Success * @retval -1 Error */ -static int nm_close_mailbox(struct Context *ctx) +static int nm_mbox_close(struct Context *ctx) { if (!ctx || (ctx->magic != MUTT_NOTMUCH)) return -1; @@ -2491,7 +2491,7 @@ static int nm_close_mailbox(struct Context *ctx) } /** - * nm_check_mailbox - Check a notmuch mailbox for new mail + * nm_mbox_check - Check a notmuch mailbox for new mail * @param ctx Mailbox * @param index_hint Remember our place in the index * @retval -1 Error @@ -2500,7 +2500,7 @@ static int nm_close_mailbox(struct Context *ctx) * @retval #MUTT_REOPENED Mailbox closed and reopened * @retval #MUTT_FLAGS Flags have changed */ -static int nm_check_mailbox(struct Context *ctx, int *index_hint) +static int nm_mbox_check(struct Context *ctx, int *index_hint) { struct NmCtxData *data = get_ctxdata(ctx); time_t mtime = 0; @@ -2619,13 +2619,13 @@ done: } /** - * nm_sync_mailbox - Sync a notmuch mailbox + * nm_mbox_sync - Sync a notmuch mailbox * @param ctx Mailbox * @param index_hint Remember our place in the index * @retval 0 Success * @retval -1 Failure */ -static int nm_sync_mailbox(struct Context *ctx, int *index_hint) +static int nm_mbox_sync(struct Context *ctx, int *index_hint) { struct NmCtxData *data = get_ctxdata(ctx); int rc = 0; @@ -2706,14 +2706,14 @@ static int nm_sync_mailbox(struct Context *ctx, int *index_hint) } /** - * nm_open_message - Open a message from a notmuch mailbox + * nm_msg_open - Open a message from a notmuch mailbox * @param ctx Mailbox * @param msg Message to open * @param msgno Index of message to open * @retval 0 Success * @retval 1 Error */ -static int nm_open_message(struct Context *ctx, struct Message *msg, int msgno) +static int nm_msg_open(struct Context *ctx, struct Message *msg, int msgno) { if (!ctx || !msg) return 1; @@ -2735,13 +2735,13 @@ static int nm_open_message(struct Context *ctx, struct Message *msg, int msgno) } /** - * nm_close_message - Close a message + * nm_msg_close - Close a message * @param ctx Mailbox * @param msg Message to close * @retval 0 Success * @retval 1 Error */ -static int nm_close_message(struct Context *ctx, struct Message *msg) +static int nm_msg_close(struct Context *ctx, struct Message *msg) { if (!msg) return 1; @@ -2750,12 +2750,12 @@ static int nm_close_message(struct Context *ctx, struct Message *msg) } /** - * nm_commit_message - Save the changes to a message + * nm_msg_commit - Save the changes to a message * @param ctx Mailbox * @param msg Message to commit * @retval -1 Always */ -static int nm_commit_message(struct Context *ctx, struct Message *msg) +static int nm_msg_commit(struct Context *ctx, struct Message *msg) { mutt_error(_("Can't write to virtual folder.")); return -1; @@ -2768,16 +2768,16 @@ static int nm_commit_message(struct Context *ctx, struct Message *msg) * These functions are common to all mailbox types. */ struct MxOps mx_notmuch_ops = { - .mbox_open = nm_open_mailbox, /* calls init_context() */ + .mbox_open = nm_mbox_open, /* calls init_context() */ .mbox_open_append = NULL, - .mbox_check = nm_check_mailbox, - .mbox_sync = nm_sync_mailbox, - .mbox_close = nm_close_mailbox, - .msg_open = nm_open_message, + .mbox_check = nm_mbox_check, + .mbox_sync = nm_mbox_sync, + .mbox_close = nm_mbox_close, + .msg_open = nm_msg_open, .msg_open_new = NULL, - .msg_commit = nm_commit_message, - .msg_close = nm_close_message, - .tags_edit = nm_edit_message_tags, - .tags_commit = nm_commit_message_tags, + .msg_commit = nm_msg_commit, + .msg_close = nm_msg_close, + .tags_edit = nm_tags_edit, + .tags_commit = nm_tags_commit, }; // clang-format on diff --git a/nntp.c b/nntp.c index 5cf213aef..7e1020a1a 100644 --- a/nntp.c +++ b/nntp.c @@ -1478,12 +1478,12 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first, } /** - * nntp_open_mailbox - Open newsgroup + * nntp_mbox_open - Open newsgroup * @param ctx Mailbox * @retval 0 Success * @retval -1 Failure */ -static int nntp_open_mailbox(struct Context *ctx) +static int nntp_mbox_open(struct Context *ctx) { struct NntpServer *nserv = NULL; struct NntpData *nntp_data = NULL; @@ -1615,14 +1615,14 @@ static int nntp_open_mailbox(struct Context *ctx) } /** - * nntp_open_message - Fetch message + * nntp_msg_open - Fetch message * @param ctx Mailbox * @param msg Message to fetch * @param msgno Message number * @retval 0 Success * @retval -1 Failure */ -static int nntp_open_message(struct Context *ctx, struct Message *msg, int msgno) +static int nntp_msg_open(struct Context *ctx, struct Message *msg, int msgno) { struct NntpData *nntp_data = ctx->data; struct Header *hdr = ctx->hdrs[msgno]; @@ -1743,13 +1743,13 @@ static int nntp_open_message(struct Context *ctx, struct Message *msg, int msgno } /** - * nntp_close_message - Close message + * nntp_msg_close - Close message * @param ctx Mailbox * @param msg Message to close * @retval 0 Success * @retval EOF Error, see errno */ -static int nntp_close_message(struct Context *ctx, struct Message *msg) +static int nntp_msg_close(struct Context *ctx, struct Message *msg) { return mutt_file_fclose(&msg->fp); } @@ -2098,7 +2098,7 @@ static int check_mailbox(struct Context *ctx) } /** - * nntp_check_mailbox - Check current newsgroup for new articles + * nntp_mbox_check - Check current newsgroup for new articles * @param ctx Mailbox * @param index_hint Current message (UNUSED) * @retval #MUTT_REOPENED Articles have been renumbered or removed from server @@ -2106,7 +2106,7 @@ static int check_mailbox(struct Context *ctx) * @retval 0 No change * @retval -1 Lost connection */ -static int nntp_check_mailbox(struct Context *ctx, int *index_hint) +static int nntp_mbox_check(struct Context *ctx, int *index_hint) { int ret = check_mailbox(ctx); if (ret == 0) @@ -2119,7 +2119,7 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) } /** - * nntp_sync_mailbox - Save changes to .newsrc and cache + * nntp_mbox_sync - Save changes to .newsrc and cache * @param ctx Mailbox * @param index_hint Current message (UNUSED) * @retval 0 Success @@ -2127,7 +2127,7 @@ static int nntp_check_mailbox(struct Context *ctx, int *index_hint) * * @note May also return values from check_mailbox() */ -static int nntp_sync_mailbox(struct Context *ctx, int *index_hint) +static int nntp_mbox_sync(struct Context *ctx, int *index_hint) { struct NntpData *nntp_data = ctx->data; int rc; @@ -2185,11 +2185,11 @@ static int nntp_sync_mailbox(struct Context *ctx, int *index_hint) } /** - * nntp_close_mailbox - Free up memory associated with the newsgroup context + * nntp_mbox_close - Free up memory associated with the newsgroup context * @param ctx Mailbox * @retval 0 Always */ -static int nntp_close_mailbox(struct Context *ctx) +static int nntp_mbox_close(struct Context *ctx) { struct NntpData *nntp_data = ctx->data, *nntp_tmp = NULL; @@ -2593,15 +2593,15 @@ int nntp_check_children(struct Context *ctx, const char *msgid) // clang-format off struct MxOps mx_nntp_ops = { - .mbox_open = nntp_open_mailbox, + .mbox_open = nntp_mbox_open, .mbox_open_append = NULL, - .mbox_check = nntp_check_mailbox, - .mbox_sync = nntp_sync_mailbox, - .mbox_close = nntp_close_mailbox, - .msg_open = nntp_open_message, + .mbox_check = nntp_mbox_check, + .mbox_sync = nntp_mbox_sync, + .mbox_close = nntp_mbox_close, + .msg_open = nntp_msg_open, .msg_open_new = NULL, .msg_commit = NULL, - .msg_close = nntp_close_message, + .msg_close = nntp_msg_close, .tags_edit = NULL, .tags_commit = NULL, };