<<< Date Index >>>     <<< Thread Index >>>

suggestion/patch: new config variable "askreply"



Hi,

more often than i like, i forget setting the Reply-To: header
in my mails.  For that reason, i just patched my mutt-1.5.16
to ask me, just like it is asking me for Cc: and Bcc:.

This is a very simple patch, but i thought i might share it, anyway.
In case you like it, say so, and i shall write patches to doc/manual*
to go with it.  Feel free to include it into official mutt, if you want.

Tested on OpenBSD-current/i386.

The following patch is also available from
  http://www.studis.de/Software/mutt-1.5.16-noport-u0.patch

In case you want to test it on OpenBSD, better use
  http://www.studis.de/Software/mutt-1.5.16p0u0.patch

Thanks for maintaining mutt,   :-)
  Ingo

--- mutt.h.orig Wed Apr 11 05:14:01 2007
+++ mutt.h      Tue Sep 25 02:04:23 2007
@@ -332,6 +332,7 @@ enum
   OPTASCIICHARS,
   OPTASKBCC,
   OPTASKCC,
+  OPTASKREPLY,
   OPTATTACHSPLIT,
   OPTAUTOEDIT,
   OPTAUTOTAG,
--- init.h.orig Sun Jun 10 04:29:21 2007
+++ init.h      Tue Sep 25 02:02:39 2007
@@ -169,6 +169,12 @@ struct option_t MuttVars[] = {
   ** If set, Mutt will prompt you for carbon-copy (Cc) recipients before
   ** editing the body of an outgoing message.
   */  
+  { "askreply",                DT_BOOL, R_NONE, OPTASKREPLY, 0 },
+  /*
+  ** .pp
+  ** If set, Mutt will prompt you for a reply-to address before editing
+  ** the body of an outgoing message.
+  */
   { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0},
   /*
   ** .pp
--- edit.c.orig Sun Apr  1 23:58:55 2007
+++ edit.c      Tue Sep 25 02:13:26 2007
@@ -311,6 +311,27 @@ static void be_edit_header (ENVELOPE *e, int force)
       mutt_addrlist_to_idna (e->bcc, NULL);
     addch ('\n');
   }
+
+  if (option (OPTASKREPLY) || force)
+  {
+    addstr ("Reply-To: ");
+    tmp[0] = 0;
+    mutt_addrlist_to_local (e->reply_to);
+    rfc822_write_address (tmp, sizeof (tmp), e->reply_to, 0);
+    if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 10, 0) == 0)
+    {
+      rfc822_free_address (&e->reply_to);
+      e->reply_to = mutt_parse_adrlist (e->reply_to, tmp);
+      e->reply_to = mutt_expand_aliases (e->reply_to);
+      mutt_addrlist_to_idna (e->reply_to, NULL);
+      tmp[0] = 0;
+      rfc822_write_address (tmp, sizeof (tmp), e->reply_to, 1);
+      mvaddstr (LINES - 1, 10, tmp);
+    }
+    else
+      mutt_addrlist_to_idna (e->reply_to, NULL);
+    addch ('\n');
+  }
 }
 
 int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
--- send.c.orig Tue Apr 10 06:34:53 2007
+++ send.c      Tue Sep 25 02:15:34 2007
@@ -225,6 +225,8 @@ static int edit_envelope (ENVELOPE *en)
     return (-1);
   if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
     return (-1);
+  if (option (OPTASKREPLY) && edit_address (&en->reply_to, "Reply-To: ") == -1)
+    return (-1);
 
   if (en->subject)
   {