Subject says it all.
From be30e9e853af23a1fcf65b207e969e3deba0a30c Mon Sep 17 00:00:00 2001
From: Mono DHS <mono...@arcor.de>
Date: Mon, 20 Jul 2020 19:47:21 +0200
Subject: [PATCH] Add support for the reply_format variable.

---
 globals.h |  1 +
 init.h    |  6 ++++++
 send.c    | 13 +++++++------
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/globals.h b/globals.h
index 
ec31f6b729c3976e68e545742a895915a3d8e541..f3604d48fef6c783d07cb7db14f0378412e19ff2
 100644
--- a/globals.h
+++ b/globals.h
@@ -131,6 +131,7 @@ WHERE char *NewMailCmd;
 WHERE char *QueryCmd;
 WHERE char *QueryFormat;
 WHERE char *Realname;
+WHERE char *ReplyFmt;
 WHERE short SearchContext;
 WHERE char *SendCharset;
 WHERE char *SendMultipartAltFilter;
diff --git a/init.h b/init.h
index 
6cbc30a3ca4423a053b69427cb6e906e33618d60..d2f509220c4dc3601c0c1be6627694a2bbbcec5d
 100644
--- a/init.h
+++ b/init.h
@@ -2991,6 +2991,12 @@ struct option_t MuttVars[] = {
   ** .pp
   ** Also see $$wrap.
   */
+  { "reply_format",    DT_STR,  R_NONE, {.p=&ReplyFmt}, {.p="Re: %s"} },
+  /*
+  ** .pp
+  ** This variable controls the default subject when replying to a message.
+  ** It uses the same format sequences as the $$index_format variable.
+  */
   { "reply_regexp",    DT_RX,   R_INDEX|R_RESORT, {.p=&ReplyRegexp}, 
{.p="^(re([\\[0-9\\]+])*|aw):[ \t]*"} },
   /*
   ** .pp
diff --git a/send.c b/send.c
index 
44e34feaaa3adc0a4e8bdbef9fe3bffc85cbf474..7706e7ecdc57538d338b0febf03fc8f1c98ad85a
 100644
--- a/send.c
+++ b/send.c
@@ -746,17 +746,18 @@ void mutt_make_forward_subject (ENVELOPE *env, CONTEXT 
*ctx, HEADER *cur)
 void mutt_make_misc_reply_headers (ENVELOPE *env, CONTEXT *ctx,
                                    HEADER *cur, ENVELOPE *curenv)
 {
+  char buffer[STRING];
+
   /* This takes precedence over a subject that might have
    * been taken from a List-Post header.  Is that correct?
    */
   if (curenv->real_subj)
-  {
-    FREE (&env->subject);
-    env->subject = safe_malloc (mutt_strlen (curenv->real_subj) + 5);
-    sprintf (env->subject, "Re: %s", curenv->real_subj);       /* 
__SPRINTF_CHECKED__ */
-  }
+    mutt_str_replace (&env->subject, curenv->real_subj);
   else if (!env->subject)
-    env->subject = safe_strdup ("Re: your mail");
+    env->subject = safe_strdup ("your mail");
+
+  mutt_make_string (buffer, sizeof (buffer), NONULL(ReplyFmt), ctx, cur);
+  mutt_str_replace (&env->subject, buffer);
 }
 
 void mutt_add_to_reference_headers (ENVELOPE *env, ENVELOPE *curenv, LIST 
***pp, LIST ***qq)
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

Reply via email to