]> granicus.if.org Git - neomutt/commitdiff
factor out Context from mutt_prepare_template()
authorRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 12:49:34 +0000 (12:49 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 13:45:24 +0000 (13:45 +0000)
postpone.c
protos.h
send.c

index 264e7b89197ccbb908bf98c141d760a6eb8f0e73..2994a06d52c4ee73e38d4eebe5d0226c44613451 100644 (file)
@@ -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)
   {
index ce1389ee6fa7a85fb8586935fd0efb91abfc9fd8..515557067d8da9662cc592d94eb3138772606381 100644 (file)
--- 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 6d302f7bb50ce3863842f7f94167740f6ee85bed..3838d8a6f8dcd2aa94ac7f841b6e5675e3a77348 100644 (file)
--- 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;