From: Richard Russon Date: Thu, 22 Nov 2018 12:49:34 +0000 (+0000) Subject: factor out Context from mutt_prepare_template() X-Git-Tag: 2019-10-25~500^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4471f54d20a7360871e46c3056afda8f8e6f843;p=neomutt factor out Context from mutt_prepare_template() --- diff --git a/postpone.c b/postpone.c index 264e7b891..2994a06d5 100644 --- a/postpone.c +++ b/postpone.c @@ -314,7 +314,7 @@ int mutt_get_postponed(struct Context *ctx, struct Email *hdr, return -1; } - if (mutt_prepare_template(NULL, PostContext, hdr, e, false) < 0) + if (mutt_prepare_template(NULL, PostContext->mailbox, hdr, e, false) < 0) { mx_fastclose_mailbox(PostContext); FREE(&PostContext); @@ -543,7 +543,7 @@ int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app) /** * mutt_prepare_template - Prepare a message template * @param fp If not NULL, file containing the template - * @param ctx If fp is NULL, the context containing the header with the template + * @param m If fp is NULL, the Mailbox containing the header with the template * @param newhdr The template is read into this Header * @param e Email to recall/resend * @param resend Set if resending (as opposed to recalling a postponed msg) @@ -552,7 +552,7 @@ int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app) * @retval 0 Success * @retval -1 Error */ -int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Email *newhdr, +int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, struct Email *e, bool resend) { struct Message *msg = NULL; @@ -563,7 +563,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Email *newhdr, struct State s = { 0 }; int sec_type; - if (!fp && !(msg = mx_msg_open(ctx->mailbox, e->msgno))) + if (!fp && !(msg = mx_msg_open(m, e->msgno))) return -1; if (!fp) @@ -773,7 +773,7 @@ bail: if (bfp != fp) mutt_file_fclose(&bfp); if (msg) - mx_msg_close(ctx->mailbox, &msg); + mx_msg_close(m, &msg); if (rc == -1) { diff --git a/protos.h b/protos.h index ce1389ee6..515557067 100644 --- a/protos.h +++ b/protos.h @@ -59,7 +59,7 @@ int mutt_change_flag(struct Email *e, int bf); int mutt_complete(char *buf, size_t buflen); int mutt_edit_message(struct Context *ctx, struct Email *e); int mutt_view_message(struct Context *ctx, struct Email *e); -int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Email *newhdr, struct Email *e, bool resend); +int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *newhdr, struct Email *e, bool resend); int mutt_enter_string(char *buf, size_t buflen, int col, int flags); int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, bool multiple, char ***files, int *numfiles, struct EnterState *state); diff --git a/send.c b/send.c index 6d302f7bb..3838d8a6f 100644 --- a/send.c +++ b/send.c @@ -1425,7 +1425,7 @@ int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *cur) { struct Email *msg = mutt_email_new(); - if (mutt_prepare_template(fp, ctx, msg, cur, true) < 0) + if (mutt_prepare_template(fp, ctx->mailbox, msg, cur, true) < 0) { mutt_email_free(&msg); return -1;