File aw.listreply.diff of Package mutt

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

---
 PATCHES |    1 +
 init.h  |    7 +++++++
 mutt.h  |    1 +
 send.c  |   18 ++++++++++++++++++
 4 files changed, 27 insertions(+)

--- PATCHES
+++ PATCHES	2017-04-28 13:20:07.709043569 +0000
@@ -1,3 +1,4 @@
+patch-1.5.9.aw.listreply.1
 patch-attach-headers-color-neomutt
 patch-compose-to-sender-neomutt
 patch-compress-neomutt
--- init.h
+++ init.h	2017-04-28 13:20:58.292077398 +0000
@@ -1581,6 +1581,13 @@ struct option_t MuttVars[] = {
   ** ``$$keywords_standard'' are \fCfalse\fP, mutt will save keywords
   ** to legacy headers to ensure that it does not lose your labels.
   */
+  { "list_reply",      DT_QUAD, R_NONE, OPT_LISTREPLY, MUTT_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
--- mutt.h
+++ mutt.h	2017-04-28 13:21:29.103488852 +0000
@@ -299,6 +299,7 @@ enum
 #endif
   OPT_SUBJECT,
   OPT_VERIFYSIG, /* verify PGP signatures */
+  OPT_LISTREPLY,
 #ifdef USE_NNTP
   OPT_TOMODERATED,
   OPT_CATCHUP,
--- send.c
+++ send.c	2017-04-28 13:22:41.410113734 +0000
@@ -498,6 +498,7 @@ static int include_reply(CONTEXT *ctx, H
 static int default_to(ADDRESS **to, ENVELOPE *env, int flags, int hmfupto)
 {
   char prompt[STRING];
+  ADDRESS *tmp;
 
   if (flags && env->mail_followup_to && hmfupto == MUTT_YES)
   {
@@ -511,6 +512,23 @@ static int default_to(ADDRESS **to, ENVE
   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 MUTT_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 */
openSUSE Build Service is sponsored by