File aw.listreply.diff of Package mutt

ask when sending list message replies to author only - Armin Wolfermann (aw)

Index: mutt-1.5.21/PATCHES
===================================================================
--- mutt-1.5.21.orig/PATCHES	2012-06-21 11:48:06.757181997 +0200
+++ mutt-1.5.21/PATCHES	2012-06-21 11:48:50.352837436 +0200
@@ -1,3 +1,4 @@
+patch-1.5.9.aw.listreply.1
 patch-1.5.20.sidebar.20090619.txt
 patch-1.5.19.rr.compressed.1
 patch-1.5.5.1.nt.xtitles.3.ab.1
Index: mutt-1.5.21/init.h
===================================================================
--- mutt-1.5.21.orig/init.h	2012-06-21 11:48:06.754181952 +0200
+++ mutt-1.5.21/init.h	2012-06-21 11:48:22.426417566 +0200
@@ -1331,6 +1331,13 @@ struct option_t MuttVars[] = {
   ** The locale used by \fCstrftime(3)\fP to format dates. Legal values are
   ** the strings your system accepts for the locale environment variable \fC$$$LC_TIME\fP.
   */
+  { "list_reply",      DT_QUAD, R_NONE, OPT_LISTREPLY, M_NO },
+  /*
+  ** .pp
+  ** When set, address replies to the mailing list the original message came
+  ** from (instead to the author only). Setting this option to ``ask-yes'' or
+  ** ``ask-no'' will ask if you really intended to reply to the author only.
+  */
   { "mail_check",	DT_NUM,  R_NONE, UL &BuffyTimeout, 5 },
   /*
   ** .pp
Index: mutt-1.5.21/mutt.h
===================================================================
--- mutt-1.5.21.orig/mutt.h	2012-06-21 11:48:06.788182463 +0200
+++ mutt-1.5.21/mutt.h	2012-06-21 11:48:22.426417566 +0200
@@ -290,6 +290,7 @@ enum
 #endif
   OPT_SUBJECT,
   OPT_VERIFYSIG,      /* verify PGP signatures */
+  OPT_LISTREPLY,
     
   /* THIS MUST BE THE LAST VALUE. */
   OPT_MAX
Index: mutt-1.5.21/send.c
===================================================================
--- mutt-1.5.21.orig/send.c	2012-06-21 11:48:06.724181501 +0200
+++ mutt-1.5.21/send.c	2012-06-21 11:48:22.426417566 +0200
@@ -453,6 +453,7 @@ static int include_reply (CONTEXT *ctx,
 static int default_to (ADDRESS **to, ENVELOPE *env, int flags, int hmfupto)
 {
   char prompt[STRING];
+  ADDRESS *tmp;
 
   if (flags && env->mail_followup_to && hmfupto == M_YES) 
   {
@@ -466,6 +467,23 @@ static int default_to (ADDRESS **to, ENV
   if (flags & SENDLISTREPLY)
     return 0;
 
+  /* If this message came from a mailing list, ask the user if he really
+   * intended to reply to the author only.
+   */
+  if (!(flags & SENDGROUPREPLY) && mutt_is_list_cc (0, env->to, env->cc)) {
+    switch (query_quadoption (OPT_LISTREPLY,
+            _("Message came from a mailing list. Reply to author only?")))
+    {
+    case M_NO:
+      tmp = find_mailing_lists (env->to, env->cc);
+      rfc822_append (to, tmp, 0);
+      rfc822_free_address (&tmp);
+      return 0;
+    case -1:
+      return -1; /* abort */
+    }
+  }
+
   if (!option(OPTREPLYSELF) && mutt_addr_is_user (env->from))
   {
     /* mail is from the user, assume replying to recipients */