From d24d1ec45973c2f08f57d8852effe19f83876ed0 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 7 Nov 2017 15:11:18 +0000 Subject: [PATCH] rename public functions with a leading underscore --- attach.c | 2 +- browser.c | 2 +- commands.c | 11 ++++++----- compose.c | 4 ++-- copy.c | 22 +++++++++++----------- copy.h | 6 +++--- curs_lib.c | 16 ++++++++-------- curs_main.c | 2 +- enter.c | 21 +++++++++++---------- flags.c | 2 +- hdrline.c | 4 ++-- hook.c | 2 +- imap/imap.c | 2 +- main.c | 2 +- mbox.c | 4 ++-- mh.c | 2 +- mutt.h | 4 ++-- muttlib.c | 8 ++++---- ncrypt/crypt.c | 20 ++++++++++---------- ncrypt/pgp.c | 16 ++++++++-------- ncrypt/pgp.h | 4 ++-- ncrypt/pgpkey.c | 2 +- ncrypt/smime.c | 6 +++--- postpone.c | 3 ++- protos.h | 32 +++++++++++++++----------------- recvattach.c | 5 +++-- recvcmd.c | 18 +++++++++--------- rfc2047.c | 6 +++--- rfc2047.h | 4 ++-- score.c | 6 +++--- send.c | 6 +++--- sendlib.c | 6 +++--- thread.c | 6 +++--- thread.h | 24 ++++++++++++------------ 34 files changed, 141 insertions(+), 139 deletions(-) diff --git a/attach.c b/attach.c index 68cb7c61f..c4736a083 100644 --- a/attach.c +++ b/attach.c @@ -795,7 +795,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF) chflags = CH_FROM | CH_UPDATE_LEN; chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE); - if (_mutt_copy_message(msg->fp, fp, hn, hn->content, 0, chflags) == 0 && + if (mutt_copy_message(msg->fp, fp, hn, hn->content, 0, chflags) == 0 && mx_commit_message(msg, &ctx) == 0) r = 0; else diff --git a/browser.c b/browser.c index 9d9a0d9e2..c11d9c0b8 100644 --- a/browser.c +++ b/browser.c @@ -1066,7 +1066,7 @@ void mutt_browser_select_dir(char *f) mutt_get_parent_path(LastDir, OldLastDir, sizeof(LastDir)); } -void _mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfiles) +void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfiles) { char buf[_POSIX_PATH_MAX]; char prefix[_POSIX_PATH_MAX] = ""; diff --git a/commands.c b/commands.c index 3484f20e7..652912ca6 100644 --- a/commands.c +++ b/commands.c @@ -167,7 +167,7 @@ int mutt_display_message(struct Header *cur) if (Context->magic == MUTT_NOTMUCH) chflags |= CH_VIRTUAL; #endif - res = mutt_copy_message(fpout, Context, cur, cmflags, chflags); + res = mutt_open_copy_message(fpout, Context, cur, cmflags, chflags); if ((safe_fclose(&fpout) != 0 && errno != EPIPE) || res < 0) { @@ -384,7 +384,7 @@ static void pipe_msg(struct Header *h, FILE *fp, int decode, int print) if (decode) mutt_parse_mime_message(Context, h); - mutt_copy_message(fp, Context, h, cmflags, chflags); + mutt_open_copy_message(fp, Context, h, cmflags, chflags); } /** @@ -725,7 +725,8 @@ static void set_copy_flags(struct Header *hdr, int decode, int decrypt, } } -int _mutt_save_message(struct Header *h, struct Context *ctx, int delete, int decode, int decrypt) +int mutt_save_message_ctx(struct Header *h, int delete, int decode, int decrypt, + struct Context *ctx) { int cmflags, chflags; int rc; @@ -871,7 +872,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt) #endif if (h) { - if (_mutt_save_message(h, &ctx, delete, decode, decrypt) != 0) + if (mutt_save_message_ctx(h, delete, decode, decrypt, &ctx) != 0) { mx_close_mailbox(&ctx, NULL); return -1; @@ -901,7 +902,7 @@ int mutt_save_message(struct Header *h, int delete, int decode, int decrypt) continue; mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK); - if ((rc = _mutt_save_message(Context->hdrs[i], &ctx, delete, decode, decrypt) != 0)) + if ((rc = mutt_save_message_ctx(Context->hdrs[i], delete, decode, decrypt, &ctx) != 0)) break; #ifdef USE_COMPRESSED if (cm) diff --git a/compose.c b/compose.c index 08f13dbea..c5fbb1a86 100644 --- a/compose.c +++ b/compose.c @@ -1017,8 +1017,8 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */ numfiles = 0; files = NULL; - if (_mutt_enter_fname(prompt, fname, sizeof(fname), 0, 1, &files, - &numfiles, MUTT_SEL_MULTI) == -1 || + if (mutt_enter_fname_full(prompt, fname, sizeof(fname), 0, 1, &files, + &numfiles, MUTT_SEL_MULTI) == -1 || *fname == '\0') break; diff --git a/copy.c b/copy.c index c2bcdbb99..ee73f2151 100644 --- a/copy.c +++ b/copy.c @@ -523,7 +523,7 @@ static int count_delete_lines(FILE *fp, struct Body *b, LOFF_T *length, size_t d } /** - * _mutt_copy_message - make a copy of a message + * mutt_copy_message - make a copy of a message * @param fpout Where to write output * @param fpin Where to get input * @param hdr Header of message being copied @@ -540,8 +540,8 @@ static int count_delete_lines(FILE *fp, struct Body *b, LOFF_T *length, size_t d * * #MUTT_CM_DECODE_PGP used for decoding PGP messages * * #MUTT_CM_CHARCONV perform character set conversion */ -int _mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, - struct Body *body, int flags, int chflags) +int mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, + struct Body *body, int flags, int chflags) { char prefix[SHORT_STRING]; struct State s; @@ -553,7 +553,7 @@ int _mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, if (option(OPT_TEXT_FLOWED)) strfcpy(prefix, ">", sizeof(prefix)); else - _mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context, hdr, 0); + mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString), Context, hdr, 0); } if (hdr->xlabel_changed) @@ -743,13 +743,13 @@ int _mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, } /** - * mutt_copy_message - Copy a message + * mutt_open_copy_message - Copy a message * * should be made to return -1 on fatal errors, and 1 on non-fatal errors * like partial decode, where it is worth displaying as much as possible */ -int mutt_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, - int flags, int chflags) +int mutt_open_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, + int flags, int chflags) { struct Message *msg = NULL; int r; @@ -757,10 +757,10 @@ int mutt_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, msg = mx_open_message(src, hdr->msgno); if (!msg) return -1; - if ((r = _mutt_copy_message(fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0 && + if ((r = mutt_copy_message(fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0 && (ferror(fpout) || feof(fpout))) { - mutt_debug(1, "_mutt_copy_message failed to detect EOF!\n"); + mutt_debug(1, "mutt_copy_message failed to detect EOF!\n"); r = -1; } mx_close_message(src, &msg); @@ -774,7 +774,7 @@ int mutt_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, * @param src source mailbox * @param hdr message being copied * @param body structure of message being copied - * @param flags mutt_copy_message() flags + * @param flags mutt_open_copy_message() flags * @param chflags mutt_copy_header() flags * @retval 0 on success * @retval -1 on error @@ -797,7 +797,7 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src, if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) chflags |= CH_FROM | CH_FORCE_FROM; chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE); - r = _mutt_copy_message(msg->fp, fpin, hdr, body, flags, chflags); + r = mutt_copy_message(msg->fp, fpin, hdr, body, flags, chflags); if (mx_commit_message(msg, dest) != 0) r = -1; diff --git a/copy.h b/copy.h index a421d4d68..0eecc34d9 100644 --- a/copy.h +++ b/copy.h @@ -29,7 +29,7 @@ struct Body; struct Header; struct Context; -/**< flags to _mutt_copy_message */ +/**< flags to mutt_copy_message */ #define MUTT_CM_NOHEADER (1 << 0) /**< don't copy the message header */ #define MUTT_CM_PREFIX (1 << 1) /**< quote the message */ #define MUTT_CM_DECODE (1 << 2) /**< decode the message body into text/plain */ @@ -72,10 +72,10 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const char *prefix); -int _mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, struct Body *body, +int mutt_copy_message(FILE *fpout, FILE *fpin, struct Header *hdr, struct Body *body, int flags, int chflags); -int mutt_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, int flags, int chflags); +int mutt_open_copy_message(FILE *fpout, struct Context *src, struct Header *hdr, int flags, int chflags); int mutt_append_message(struct Context *dest, struct Context *src, struct Header *hdr, int cmflags, int chflags); diff --git a/curs_lib.c b/curs_lib.c index 08fbdecd8..1483e766c 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -176,8 +176,8 @@ struct Event mutt_getch(void) return (ch == ctrl('G') ? err : ret); } -int _mutt_get_field(const char *field, char *buf, size_t buflen, int complete, - int multiple, char ***files, int *numfiles) +int mutt_get_field_full(const char *field, char *buf, size_t buflen, + int complete, int multiple, char ***files, int *numfiles) { int ret; int x; @@ -201,7 +201,7 @@ int _mutt_get_field(const char *field, char *buf, size_t buflen, int complete, NORMAL_COLOR; mutt_refresh(); mutt_window_getyx(MuttMessageWindow, NULL, &x); - ret = _mutt_enter_string(buf, buflen, x, complete, multiple, files, numfiles, es); + ret = mutt_enter_string_full(buf, buflen, x, complete, multiple, files, numfiles, es); } while (ret == 1); mutt_window_clearline(MuttMessageWindow, 0); mutt_free_enter_state(&es); @@ -896,8 +896,8 @@ int mutt_do_pager(const char *banner, const char *tempfile, int do_color, struct return rc; } -int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int buffy, - int multiple, char ***files, int *numfiles, int flags) +int mutt_enter_fname_full(const char *prompt, char *buf, size_t blen, int buffy, + int multiple, char ***files, int *numfiles, int flags) { struct Event ch; @@ -927,7 +927,7 @@ int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int buffy, flags |= MUTT_SEL_MULTI; if (buffy) flags |= MUTT_SEL_BUFFY; - _mutt_select_file(buf, blen, flags, files, numfiles); + mutt_select_file(buf, blen, flags, files, numfiles); } else { @@ -935,8 +935,8 @@ int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int buffy, sprintf(pc, "%s: ", prompt); mutt_unget_event(ch.op ? 0 : ch.ch, ch.op ? ch.op : 0); - if (_mutt_get_field(pc, buf, blen, (buffy ? MUTT_EFILE : MUTT_FILE) | MUTT_CLEAR, - multiple, files, numfiles) != 0) + if (mutt_get_field_full(pc, buf, blen, (buffy ? MUTT_EFILE : MUTT_FILE) | MUTT_CLEAR, + multiple, files, numfiles) != 0) buf[0] = '\0'; FREE(&pc); #ifdef USE_NOTMUCH diff --git a/curs_main.c b/curs_main.c index 970a30891..03446a2be 100644 --- a/curs_main.c +++ b/curs_main.c @@ -655,7 +655,7 @@ void index_make_entry(char *s, size_t l, struct Menu *menu, int num) } } - _mutt_make_string(s, l, NONULL(IndexFormat), Context, h, flag); + mutt_make_string_flags(s, l, NONULL(IndexFormat), Context, h, flag); } int index_color(int index_no) diff --git a/enter.c b/enter.c index c23b2a5d6..1a5afd8aa 100644 --- a/enter.c +++ b/enter.c @@ -40,7 +40,7 @@ #include "protos.h" /** - * enum RedrawFlags - redraw flags for mutt_enter_string() + * enum RedrawFlags - redraw flags for mutt_enter_string_full() */ enum RedrawFlags { @@ -251,14 +251,14 @@ int mutt_enter_string(char *buf, size_t buflen, int col, int flags) clearok(stdscr, TRUE); } #endif - rv = _mutt_enter_string(buf, buflen, col, flags, 0, NULL, NULL, es); + rv = mutt_enter_string_full(buf, buflen, col, flags, 0, NULL, NULL, es); } while (rv == 1); mutt_free_enter_state(&es); return rv; } /** - * _mutt_enter_string - Ask the user for a string + * mutt_enter_string_full - Ask the user for a string * @param[in] buf Buffer to store the string * @param[in] buflen Buffer length * @param[in] col Initial cursor position @@ -271,8 +271,8 @@ int mutt_enter_string(char *buf, size_t buflen, int col, int flags) * @retval 0 if input was given * @retval -1 if abort */ -int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multiple, - char ***files, int *numfiles, struct EnterState *state) +int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int multiple, + char ***files, int *numfiles, struct EnterState *state) { int width = MuttMessageWindow->cols - col - 1; int redraw; @@ -591,7 +591,8 @@ int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multipl if (tempbuf && templen == state->lastchar - i && !memcmp(tempbuf, state->wbuf + i, (state->lastchar - i) * sizeof(wchar_t))) { - mutt_select_file(buf, buflen, (flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0); + mutt_select_file(buf, buflen, + (flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0, NULL, NULL); if (*buf) replace_part(state, i, buf); rv = 1; @@ -698,10 +699,10 @@ int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multipl (tempbuf && templen == state->lastchar && !memcmp(tempbuf, state->wbuf, state->lastchar * sizeof(wchar_t)))) { - _mutt_select_file(buf, buflen, - ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | - (multiple ? MUTT_SEL_MULTI : 0), - files, numfiles); + mutt_select_file(buf, buflen, + ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | + (multiple ? MUTT_SEL_MULTI : 0), + files, numfiles); if (*buf) { mutt_pretty_mailbox(buf, buflen); diff --git a/flags.c b/flags.c index 1419b3553..3b3c198a4 100644 --- a/flags.c +++ b/flags.c @@ -36,7 +36,7 @@ #include "sort.h" #include "thread.h" -void _mutt_set_flag(struct Context *ctx, struct Header *h, int flag, int bf, int upd_ctx) +void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, int bf, int upd_ctx) { if (!ctx || !h) return; diff --git a/hdrline.c b/hdrline.c index 2443f8231..af87f038c 100644 --- a/hdrline.c +++ b/hdrline.c @@ -1385,8 +1385,8 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co return src; } -void _mutt_make_string(char *dest, size_t destlen, const char *s, - struct Context *ctx, struct Header *hdr, enum FormatFlag flags) +void mutt_make_string_flags(char *dest, size_t destlen, const char *s, + struct Context *ctx, struct Header *hdr, enum FormatFlag flags) { struct HdrFormatInfo hfi; diff --git a/hook.c b/hook.c index be058fec5..034bd5831 100644 --- a/hook.c +++ b/hook.c @@ -121,7 +121,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, } strfcpy(path, pattern.data, sizeof(path)); - _mutt_expand_path(path, sizeof(path), 1); + mutt_expand_path_regex(path, sizeof(path), 1); /* Check for other mailbox shortcuts that expand to the empty string. * This is likely a mistake too */ diff --git a/imap/imap.c b/imap/imap.c index 9721772fb..3aadb33d2 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -2485,7 +2485,7 @@ int imap_sync_mailbox(struct Context *ctx, int expunge) mutt_debug( 1, "imap_sync_mailbox: Error opening mailbox in append mode\n"); else - _mutt_save_message(h, appendctx, 1, 0, 0); + mutt_save_message_ctx(h, 1, 0, 0, appendctx); h->xlabel_changed = false; } } diff --git a/main.c b/main.c index ebfe63b9c..7e8f3d531 100644 --- a/main.c +++ b/main.c @@ -882,7 +882,7 @@ int main(int argc, char **argv, char **env) exit(1); } folder[0] = 0; - mutt_select_file(folder, sizeof(folder), MUTT_SEL_FOLDER | MUTT_SEL_BUFFY); + mutt_select_file(folder, sizeof(folder), MUTT_SEL_FOLDER | MUTT_SEL_BUFFY, NULL, NULL); if (!folder[0]) { mutt_endwin(NULL); diff --git a/mbox.c b/mbox.c index 40245b7fc..8093c5185 100644 --- a/mbox.c +++ b/mbox.c @@ -1167,8 +1167,8 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) */ newOffset[i - first].hdr = ftello(fp) + offset; - if (mutt_copy_message(fp, ctx, ctx->hdrs[i], MUTT_CM_UPDATE, - CH_FROM | CH_UPDATE | CH_UPDATE_LEN) != 0) + if (mutt_open_copy_message(fp, ctx, ctx->hdrs[i], MUTT_CM_UPDATE, + CH_FROM | CH_UPDATE | CH_UPDATE_LEN) != 0) { mutt_perror(tempfile); mutt_sleep(5); diff --git a/mh.c b/mh.c index 6367c1bcf..845f91bfe 100644 --- a/mh.c +++ b/mh.c @@ -1767,7 +1767,7 @@ static int mh_rewrite_message(struct Context *ctx, int msgno) if (!dest) return -1; - rc = mutt_copy_message(dest->fp, ctx, h, MUTT_CM_UPDATE, CH_UPDATE | CH_UPDATE_LEN); + rc = mutt_open_copy_message(dest->fp, ctx, h, MUTT_CM_UPDATE, CH_UPDATE | CH_UPDATE_LEN); if (rc == 0) { snprintf(oldpath, _POSIX_PATH_MAX, "%s/%s", ctx->path, h->path); diff --git a/mutt.h b/mutt.h index be0850cf6..2452ab577 100644 --- a/mutt.h +++ b/mutt.h @@ -57,7 +57,7 @@ struct Mapping; #define fgetc fgetc_unlocked #endif -/* flags for mutt_enter_string() */ +/* flags for mutt_enter_string_full() */ #define MUTT_ALIAS (1 << 0) /**< do alias "completion" by calling up the alias-menu */ #define MUTT_FILE (1 << 1) /**< do file completion */ #define MUTT_EFILE (1 << 2) /**< do file completion, plus incoming folders */ @@ -293,7 +293,7 @@ enum QuadOptionVars /* flags for mutt_compose_menu() */ #define MUTT_COMPOSE_NOFREEHEADER (1 << 0) -/* flags to _mutt_select_file() */ +/* flags to mutt_select_file() */ #define MUTT_SEL_BUFFY (1 << 0) #define MUTT_SEL_MULTI (1 << 1) #define MUTT_SEL_FOLDER (1 << 2) diff --git a/muttlib.c b/muttlib.c index 9cbeee730..c1eead99b 100644 --- a/muttlib.c +++ b/muttlib.c @@ -187,10 +187,10 @@ bool mutt_matches_ignore(const char *s) char *mutt_expand_path(char *s, size_t slen) { - return _mutt_expand_path(s, slen, 0); + return mutt_expand_path_regex(s, slen, 0); } -char *_mutt_expand_path(char *s, size_t slen, int regex) +char *mutt_expand_path_regex(char *s, size_t slen, int regex) { char p[_POSIX_PATH_MAX] = ""; char q[_POSIX_PATH_MAX] = ""; @@ -528,8 +528,8 @@ uint64_t mutt_rand64(void) return ret; } -void _mutt_mktemp(char *s, size_t slen, const char *prefix, const char *suffix, - const char *src, int line) +void mutt_mktemp_full(char *s, size_t slen, const char *prefix, + const char *suffix, const char *src, int line) { size_t n = snprintf(s, slen, "%s/%s-%s-%d-%d-%" PRIu64 "%s%s", NONULL(Tmpdir), NONULL(prefix), NONULL(ShortHostname), (int) getuid(), diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 8065b7277..f7c482738 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -724,7 +724,7 @@ void crypt_extract_keys_from_messages(struct Header *h) if ((WithCrypto & APPLICATION_PGP) && (hi->security & APPLICATION_PGP)) { - mutt_copy_message(fpout, Context, hi, MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0); + mutt_open_copy_message(fpout, Context, hi, MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0); fflush(fpout); mutt_endwin(_("Trying to extract PGP keys...\n")); @@ -734,11 +734,11 @@ void crypt_extract_keys_from_messages(struct Header *h) if ((WithCrypto & APPLICATION_SMIME) && (hi->security & APPLICATION_SMIME)) { if (hi->security & ENCRYPT) - mutt_copy_message(fpout, Context, hi, - MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME, - 0); + mutt_open_copy_message(fpout, Context, hi, + MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME, + 0); else - mutt_copy_message(fpout, Context, hi, 0, 0); + mutt_open_copy_message(fpout, Context, hi, 0, 0); fflush(fpout); if (hi->env->from) @@ -764,7 +764,7 @@ void crypt_extract_keys_from_messages(struct Header *h) { if ((WithCrypto & APPLICATION_PGP) && (h->security & APPLICATION_PGP)) { - mutt_copy_message(fpout, Context, h, MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0); + mutt_open_copy_message(fpout, Context, h, MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0); fflush(fpout); mutt_endwin(_("Trying to extract PGP keys...\n")); crypt_pgp_invoke_import(tempfname); @@ -773,11 +773,11 @@ void crypt_extract_keys_from_messages(struct Header *h) if ((WithCrypto & APPLICATION_SMIME) && (h->security & APPLICATION_SMIME)) { if (h->security & ENCRYPT) - mutt_copy_message(fpout, Context, h, - MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME, - 0); + mutt_open_copy_message(fpout, Context, h, + MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME, + 0); else - mutt_copy_message(fpout, Context, h, 0, 0); + mutt_open_copy_message(fpout, Context, h, 0, 0); fflush(fpout); if (h->env->from) diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 0f65f8679..942aeb786 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -142,14 +142,7 @@ char *pgp_short_keyid(struct PgpKeyInfo *k) return k->keyid + 8; } -char *pgp_keyid(struct PgpKeyInfo *k) -{ - k = key_parent(k); - - return _pgp_keyid(k); -} - -char *_pgp_keyid(struct PgpKeyInfo *k) +char *pgp_this_keyid(struct PgpKeyInfo *k) { if (option(OPT_PGP_LONG_IDS)) return k->keyid; @@ -157,6 +150,13 @@ char *_pgp_keyid(struct PgpKeyInfo *k) return (k->keyid + 8); } +char *pgp_keyid(struct PgpKeyInfo *k) +{ + k = key_parent(k); + + return pgp_this_keyid(k); +} + static char *pgp_fingerprint(struct PgpKeyInfo *k) { k = key_parent(k); diff --git a/ncrypt/pgp.h b/ncrypt/pgp.h index e3a8e225b..7a7d2e8e9 100644 --- a/ncrypt/pgp.h +++ b/ncrypt/pgp.h @@ -42,8 +42,8 @@ bool pgp_use_gpg_agent(void); int pgp_check_traditional(FILE *fp, struct Body *b, int tagged_only); -char *_pgp_keyid(struct PgpKeyInfo *); -char *pgp_keyid(struct PgpKeyInfo *); +char *pgp_this_keyid(struct PgpKeyInfo *k); +char *pgp_keyid(struct PgpKeyInfo *k); char *pgp_short_keyid(struct PgpKeyInfo * k); char *pgp_long_keyid(struct PgpKeyInfo * k); char *pgp_fpr_or_lkeyid(struct PgpKeyInfo * k); diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index ccd7daff6..bc2c56bef 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -232,7 +232,7 @@ static const char *pgp_entry_fmt(char *dest, size_t destlen, size_t col, int col if (!optional) { snprintf(fmt, sizeof(fmt), "%%%ss", prefix); - snprintf(dest, destlen, fmt, _pgp_keyid(key)); + snprintf(dest, destlen, fmt, pgp_this_keyid(key)); } break; case 'u': diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 3195db0ec..0ce8a1192 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1250,10 +1250,10 @@ int smime_verify_sender(struct Header *h) } if (h->security & ENCRYPT) - mutt_copy_message(fpout, Context, h, MUTT_CM_DECODE_CRYPT & MUTT_CM_DECODE_SMIME, - CH_MIME | CH_WEED | CH_NONEWLINE); + mutt_open_copy_message(fpout, Context, h, MUTT_CM_DECODE_CRYPT & MUTT_CM_DECODE_SMIME, + CH_MIME | CH_WEED | CH_NONEWLINE); else - mutt_copy_message(fpout, Context, h, 0, 0); + mutt_open_copy_message(fpout, Context, h, 0, 0); fflush(fpout); safe_fclose(&fpout); diff --git a/postpone.c b/postpone.c index 8be27c2e7..f81330129 100644 --- a/postpone.c +++ b/postpone.c @@ -176,7 +176,8 @@ static void post_entry(char *s, size_t slen, struct Menu *menu, int entry) { struct Context *ctx = (struct Context *) menu->data; - _mutt_make_string(s, slen, NONULL(IndexFormat), ctx, ctx->hdrs[entry], MUTT_FORMAT_ARROWCURSOR); + mutt_make_string_flags(s, slen, NONULL(IndexFormat), ctx, ctx->hdrs[entry], + MUTT_FORMAT_ARROWCURSOR); } static struct Header *select_msg(void) diff --git a/protos.h b/protos.h index 23774505b..a4867749a 100644 --- a/protos.h +++ b/protos.h @@ -53,8 +53,8 @@ struct ListHead; struct stat; struct passwd; -#define mutt_make_string(A, B, C, D, E) _mutt_make_string(A, B, C, D, E, 0) -void _mutt_make_string(char *dest, size_t destlen, const char *s, struct Context *ctx, +#define mutt_make_string(A, B, C, D, E) mutt_make_string_flags(A, B, C, D, E, 0) +void mutt_make_string_flags(char *dest, size_t destlen, const char *s, struct Context *ctx, struct Header *hdr, enum FormatFlag flags); /** @@ -128,7 +128,7 @@ const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, char *mutt_charset_hook(const char *chs); char *mutt_iconv_hook(const char *chs); char *mutt_expand_path(char *s, size_t slen); -char *_mutt_expand_path(char *s, size_t slen, int regex); +char *mutt_expand_path_regex(char *s, size_t slen, int regex); char *mutt_find_hook(int type, const char *pat); char *mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw); char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b); @@ -203,10 +203,9 @@ void mutt_make_help(char *d, size_t dlen, const char *txt, int menu, int op); void mutt_make_misc_reply_headers(struct Envelope *env, struct Context *ctx, struct Header *cur, struct Envelope *curenv); void mutt_make_post_indent(struct Context *ctx, struct Header *cur, FILE *out); void mutt_message_to_7bit(struct Body *a, FILE *fp); +void mutt_mktemp_full(char *s, size_t slen, const char *prefix, const char *suffix, const char *src, int line); +#define mutt_mktemp_pfx_sfx(a, b, c, d) mutt_mktemp_full(a, b, c, d, __FILE__, __LINE__) #define mutt_mktemp(a, b) mutt_mktemp_pfx_sfx(a, b, "neomutt", NULL) -#define mutt_mktemp_pfx_sfx(a, b, c, d) _mutt_mktemp(a, b, c, d, __FILE__, __LINE__) -void _mutt_mktemp(char *s, size_t slen, const char *prefix, const char *suffix, - const char *src, int line); void mutt_paddstr(int n, const char *s); void mutt_parse_mime_message(struct Context *ctx, struct Header *cur); void mutt_parse_part(FILE *fp, struct Body *b); @@ -223,11 +222,10 @@ void mutt_safe_path(char *s, size_t l, struct Address *a); void mutt_save_path(char *d, size_t dsize, struct Address *a); void mutt_score_message(struct Context *ctx, struct Header *hdr, int upd_ctx); void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr); -#define mutt_select_file(A, B, C) _mutt_select_file(A, B, C, NULL, NULL) -void _mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfiles); +void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfiles); void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type); -void _mutt_set_flag(struct Context *ctx, struct Header *h, int flag, int bf, int upd_ctx); -#define mutt_set_flag(a, b, c, d) _mutt_set_flag(a, b, c, d, 1) +void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, int bf, int upd_ctx); +#define mutt_set_flag(a, b, c, d) mutt_set_flag_update(a, b, c, d, 1) void mutt_set_followup_to(struct Envelope *e); void mutt_shell_escape(void); void mutt_show_error(void); @@ -281,15 +279,15 @@ int mutt_chscmp(const char *s, const char *chs); int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr, struct Header *hdr, short resend); int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur); int mutt_compose_to_sender(struct Header *hdr); -#define mutt_enter_fname(A, B, C, D) _mutt_enter_fname(A, B, C, D, 0, NULL, NULL, 0) -#define mutt_enter_vfolder(A, B, C, D) _mutt_enter_fname(A, B, C, D, 0, NULL, NULL, MUTT_SEL_VFOLDER) -int _mutt_enter_fname(const char *prompt, char *buf, size_t blen, int buffy, +#define mutt_enter_fname(A, B, C, D) mutt_enter_fname_full(A, B, C, D, 0, NULL, NULL, 0) +#define mutt_enter_vfolder(A, B, C, D) mutt_enter_fname_full(A, B, C, D, 0, NULL, NULL, MUTT_SEL_VFOLDER) +int mutt_enter_fname_full(const char *prompt, char *buf, size_t blen, int buffy, int multiple, char ***files, int *numfiles, int flags); int mutt_enter_string(char *buf, size_t buflen, int col, int flags); -int _mutt_enter_string(char *buf, size_t buflen, int col, int flags, int multiple, +int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int multiple, char ***files, int *numfiles, struct EnterState *state); -#define mutt_get_field(A, B, C, D) _mutt_get_field(A, B, C, D, 0, NULL, NULL) -int _mutt_get_field(const char *field, char *buf, size_t buflen, int complete, +#define mutt_get_field(A, B, C, D) mutt_get_field_full(A, B, C, D, 0, NULL, NULL) +int mutt_get_field_full(const char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles); int mutt_get_hook_type(const char *name); int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags); @@ -332,7 +330,7 @@ int mutt_print_attachment(FILE *fp, struct Body *a); int mutt_query_complete(char *buf, size_t buflen); int mutt_query_variables(struct ListHead *queries); int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Header *hdr); -int _mutt_save_message(struct Header *h, struct Context *ctx, int delete, int decode, int decrypt); +int mutt_save_message_ctx(struct Header *h, int delete, int decode, int decrypt, struct Context *ctx); int mutt_save_message(struct Header *h, int delete, int decode, int decrypt); #ifdef USE_SMTP int mutt_smtp_send(const struct Address *from, const struct Address *to, const struct Address *cc, diff --git a/recvattach.c b/recvattach.c index 04311c9ea..0bcd068bb 100644 --- a/recvattach.c +++ b/recvattach.c @@ -210,8 +210,9 @@ const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, MessageFormat && aptr->content->hdr) { char s[SHORT_STRING]; - _mutt_make_string(s, sizeof(s), MessageFormat, NULL, aptr->content->hdr, - MUTT_FORMAT_FORCESUBJ | MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR); + mutt_make_string_flags( + s, sizeof(s), MessageFormat, NULL, aptr->content->hdr, + MUTT_FORMAT_FORCESUBJ | MUTT_FORMAT_MAKEPRINT | MUTT_FORMAT_ARROWCURSOR); if (*s) { mutt_format_s(dest, destlen, prefix, s); diff --git a/recvcmd.c b/recvcmd.c index 95c23ca2b..229a26191 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -341,7 +341,7 @@ static void include_header(int quote, FILE *ifp, struct Header *hdr, FILE *ofp, if (_prefix) strfcpy(prefix, _prefix, sizeof(prefix)); else if (!option(OPT_TEXT_FLOWED)) - _mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context, hdr, 0); + mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString), Context, hdr, 0); else strfcpy(prefix, ">", sizeof(prefix)); @@ -433,8 +433,8 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx if (option(OPT_FORWARD_QUOTE)) { if (!option(OPT_TEXT_FLOWED)) - _mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context, - parent_hdr, 0); + mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString), + Context, parent_hdr, 0); else strfcpy(prefix, ">", sizeof(prefix)); } @@ -617,7 +617,7 @@ static void attach_forward_msgs(FILE *fp, struct Header *hdr, if (cur) { mutt_forward_intro(Context, cur->hdr, tmpfp); - _mutt_copy_message(tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags); + mutt_copy_message(tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags); mutt_forward_trailer(Context, cur->hdr, tmpfp); } else @@ -627,8 +627,8 @@ static void attach_forward_msgs(FILE *fp, struct Header *hdr, if (actx->idx[i]->content->tagged) { mutt_forward_intro(Context, actx->idx[i]->content->hdr, tmpfp); - _mutt_copy_message(tmpfp, actx->idx[i]->fp, actx->idx[i]->content->hdr, - actx->idx[i]->content->hdr->content, cmflags, chflags); + mutt_copy_message(tmpfp, actx->idx[i]->fp, actx->idx[i]->content->hdr, + actx->idx[i]->content->hdr->content, cmflags, chflags); mutt_forward_trailer(Context, actx->idx[i]->content->hdr, tmpfp); } } @@ -785,7 +785,7 @@ static void attach_include_reply(FILE *fp, FILE *tmpfp, struct Header *cur, int cmflags |= MUTT_CM_WEED; } - _mutt_copy_message(tmpfp, fp, cur, cur->content, cmflags, chflags); + mutt_copy_message(tmpfp, fp, cur, cur->content, cmflags, chflags); mutt_make_post_indent(Context, cur, tmpfp); } @@ -882,8 +882,8 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, st.fpout = tmpfp; if (!option(OPT_TEXT_FLOWED)) - _mutt_make_string(prefix, sizeof(prefix), NONULL(IndentString), Context, - parent_hdr, 0); + mutt_make_string_flags(prefix, sizeof(prefix), NONULL(IndentString), + Context, parent_hdr, 0); else strfcpy(prefix, ">", sizeof(prefix)); diff --git a/rfc2047.c b/rfc2047.c index 10c84f8cb..c41a991bd 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -611,7 +611,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char return ret; } -void _rfc2047_encode_string(char **pd, int encode_specials, int col) +void rfc2047_encode_string(char **pd, int encode_specials, int col) { char *e = NULL; size_t elen; @@ -639,9 +639,9 @@ void rfc2047_encode_adrlist(struct Address *addr, const char *tag) while (ptr) { if (ptr->personal) - _rfc2047_encode_string(&ptr->personal, 1, col); + rfc2047_encode_string(&ptr->personal, 1, col); else if (ptr->group && ptr->mailbox) - _rfc2047_encode_string(&ptr->mailbox, 1, col); + rfc2047_encode_string(&ptr->mailbox, 1, col); ptr = ptr->next; } } diff --git a/rfc2047.h b/rfc2047.h index f08b5eabc..5b5cf076a 100644 --- a/rfc2047.h +++ b/rfc2047.h @@ -31,10 +31,10 @@ char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u, size_t ulen, char **d, size_t *dlen); int convert_nonmime_string(char **ps); -void _rfc2047_encode_string(char **pd, int encode_specials, int col); +void rfc2047_encode_string(char **pd, int encode_specials, int col); void rfc2047_encode_adrlist(struct Address *addr, const char *tag); -#define rfc2047_encode_string(a) _rfc2047_encode_string(a, 0, 32); +#define rfc2047_encode_string32(a) rfc2047_encode_string(a, 0, 32); void rfc2047_decode(char **pd); void rfc2047_decode_adrlist(struct Address *a); diff --git a/score.c b/score.c index 490cdbd3a..44f501d8c 100644 --- a/score.c +++ b/score.c @@ -162,11 +162,11 @@ void mutt_score_message(struct Context *ctx, struct Header *hdr, int upd_ctx) hdr->score = 0; if (hdr->score <= ScoreThresholdDelete) - _mutt_set_flag(ctx, hdr, MUTT_DELETE, 1, upd_ctx); + mutt_set_flag_update(ctx, hdr, MUTT_DELETE, 1, upd_ctx); if (hdr->score <= ScoreThresholdRead) - _mutt_set_flag(ctx, hdr, MUTT_READ, 1, upd_ctx); + mutt_set_flag_update(ctx, hdr, MUTT_READ, 1, upd_ctx); if (hdr->score >= ScoreThresholdFlag) - _mutt_set_flag(ctx, hdr, MUTT_FLAG, 1, upd_ctx); + mutt_set_flag_update(ctx, hdr, MUTT_FLAG, 1, upd_ctx); } int mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, unsigned long data, diff --git a/send.c b/send.c index 05b829cd4..b346cc8c9 100644 --- a/send.c +++ b/send.c @@ -468,7 +468,7 @@ static int include_forward(struct Context *ctx, struct Header *cur, FILE *out) * rather than send action */ chflags |= CH_DISPLAY; - mutt_copy_message(out, ctx, cur, cmflags, chflags); + mutt_open_copy_message(out, ctx, cur, cmflags, chflags); mutt_forward_trailer(ctx, cur, out); return 0; } @@ -522,7 +522,7 @@ static int include_reply(struct Context *ctx, struct Header *cur, FILE *out) cmflags |= MUTT_CM_WEED; } - mutt_copy_message(out, ctx, cur, cmflags, chflags); + mutt_open_copy_message(out, ctx, cur, cmflags, chflags); mutt_make_post_indent(ctx, cur, out); @@ -1157,7 +1157,7 @@ void mutt_encode_descriptions(struct Body *b, short recurse) { if (t->description) { - rfc2047_encode_string(&t->description); + rfc2047_encode_string32(&t->description); } if (recurse && t->parts) mutt_encode_descriptions(t->parts, recurse); diff --git a/sendlib.c b/sendlib.c index ce6a91e4e..e417cf7a0 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1415,7 +1415,7 @@ struct Body *mutt_make_message_attach(struct Context *ctx, struct Header *hdr, i } } - mutt_copy_message(fp, ctx, hdr, cmflags, chflags); + mutt_open_copy_message(fp, ctx, hdr, cmflags, chflags); fflush(fp); rewind(fp); @@ -2247,7 +2247,7 @@ static void encode_headers(struct ListHead *h) if (!tmp) continue; - rfc2047_encode_string(&tmp); + rfc2047_encode_string32(&tmp); safe_realloc(&np->data, mutt_strlen(np->data) + 2 + mutt_strlen(tmp) + 1); sprintf(np->data + i, ": %s", NONULL(tmp)); @@ -2724,7 +2724,7 @@ void mutt_prepare_envelope(struct Envelope *env, int final) if (!option(OPT_NEWS_SEND) || option(OPT_MIME_SUBJECT)) #endif { - rfc2047_encode_string(&env->subject); + rfc2047_encode_string32(&env->subject); } encode_headers(&env->userhdrs); } diff --git a/thread.c b/thread.c index 97e67b3b7..41bdfacee 100644 --- a/thread.c +++ b/thread.c @@ -1052,13 +1052,13 @@ static struct Header *find_virtual(struct MuttThread *cur, int reverse) } /** - * _mutt_aside_thread - Find the next/previous (sub)thread + * mutt_aside_thread - Find the next/previous (sub)thread * @param hdr Search from this message * @param dir Direction to search: 'true' forwards, 'false' backwards * @param subthreads Search subthreads: 'true' subthread, 'false' not * @retval n Index into the virtual email table */ -int _mutt_aside_thread(struct Header *hdr, short dir, short subthreads) +int mutt_aside_thread(struct Header *hdr, short dir, short subthreads) { struct MuttThread *cur = NULL; struct Header *tmp = NULL; @@ -1177,7 +1177,7 @@ void mutt_set_virtual(struct Context *ctx) } } -int _mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) +int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag) { struct MuttThread *thread = NULL, *top = NULL; struct Header *roothdr = NULL; diff --git a/thread.h b/thread.h index 29931abd6..c7b885af7 100644 --- a/thread.h +++ b/thread.h @@ -49,19 +49,19 @@ struct MuttThread struct Header *sort_key; }; -int _mutt_aside_thread(struct Header *hdr, short dir, short subthreads); -#define mutt_next_thread(x) _mutt_aside_thread(x, 1, 0) -#define mutt_previous_thread(x) _mutt_aside_thread(x, 0, 0) -#define mutt_next_subthread(x) _mutt_aside_thread(x, 1, 1) -#define mutt_previous_subthread(x) _mutt_aside_thread(x, 0, 1) +int mutt_aside_thread(struct Header *hdr, short dir, short subthreads); +#define mutt_next_thread(x) mutt_aside_thread(x, 1, 0) +#define mutt_previous_thread(x) mutt_aside_thread(x, 0, 0) +#define mutt_next_subthread(x) mutt_aside_thread(x, 1, 1) +#define mutt_previous_subthread(x) mutt_aside_thread(x, 0, 1) -int _mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag); -#define mutt_collapse_thread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE) -#define mutt_uncollapse_thread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_UNCOLLAPSE) -#define mutt_get_hidden(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_GET_HIDDEN) -#define mutt_thread_contains_unread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_UNREAD) -#define mutt_thread_contains_flagged(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_FLAGGED) -#define mutt_thread_next_unread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD) +int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag); +#define mutt_collapse_thread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE) +#define mutt_uncollapse_thread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_UNCOLLAPSE) +#define mutt_get_hidden(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_GET_HIDDEN) +#define mutt_thread_contains_unread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_UNREAD) +#define mutt_thread_contains_flagged(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_FLAGGED) +#define mutt_thread_next_unread(x, y) mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD) void mutt_break_thread(struct Header *hdr); int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx); -- 2.40.0