]> granicus.if.org Git - mutt/commitdiff
Create <group-chat-reply> function.
authorKevin McCarthy <kevin@8t8.us>
Wed, 6 Feb 2019 22:29:42 +0000 (14:29 -0800)
committerKevin McCarthy <kevin@8t8.us>
Wed, 6 Feb 2019 22:29:42 +0000 (14:29 -0800)
This function differs from <group-reply> only in that it preserves To
recipients in the original email as To recipients in the reply.

The merits of this function aren't without controversy; therefore it
is left unbound by default.  Those who care about such things are free
to bind it.

Combine reply operation handlers in the pager and curs_main, since the
code was the same with the exception of the flags used.

OPS
curs_main.c
doc/manual.xml.head
functions.h
mutt.h
pager.c
recvattach.c
send.c

diff --git a/OPS b/OPS
index 87f643e49f217c32d45d508aad88573c1fb666e0..2fad8f12d8a5d3a86fe6dc429751029633661d6d 100644 (file)
--- a/OPS
+++ b/OPS
@@ -92,6 +92,7 @@ OP_FIRST_ENTRY "move to the first entry"
 OP_FLAG_MESSAGE "toggle a message's 'important' flag"
 OP_FORWARD_MESSAGE "forward a message with comments"
 OP_GENERIC_SELECT_ENTRY "select the current entry"
+OP_GROUP_CHAT_REPLY "reply to all recipients preserving To/Cc"
 OP_GROUP_REPLY "reply to all recipients"
 OP_HALF_DOWN "scroll down 1/2 page"
 OP_HALF_UP "scroll up 1/2 page"
index d3176f3d0f713fdc90533cd61527885623d89a6e..00e01d064ee119e1578e38787f6a9b332d73f9d6 100644 (file)
@@ -2197,17 +2197,6 @@ int mutt_index_menu (void)
        crypt_forget_passphrase ();
        break;
 
-      case OP_GROUP_REPLY:
-
-       CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
-       CHECK_ATTACH;
-       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)))
-         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
-       ci_send_message (SENDREPLY|SENDGROUPREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
-       menu->redraw = REDRAW_FULL;
-       break;
-
       case OP_EDIT_LABEL:
 
        CHECK_MSGCOUNT;
@@ -2230,17 +2219,6 @@ int mutt_index_menu (void)
        }
        break;
 
-      case OP_LIST_REPLY:
-
-       CHECK_ATTACH;
-       CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
-       if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)))
-         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
-       ci_send_message (SENDREPLY|SENDLISTREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
-       menu->redraw = REDRAW_FULL;
-       break;
-
       case OP_MAIL:
 
        CHECK_ATTACH;
@@ -2413,15 +2391,27 @@ int mutt_index_menu (void)
         break;
 
       case OP_REPLY:
+      case OP_GROUP_REPLY:
+      case OP_GROUP_CHAT_REPLY:
+      case OP_LIST_REPLY:
+      {
+        int replyflags;
 
        CHECK_ATTACH;
        CHECK_MSGCOUNT;
         CHECK_VISIBLE;
+
+        replyflags = SENDREPLY |
+         (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) |
+         (op == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) |
+         (op == OP_LIST_REPLY ? SENDLISTREPLY : 0);
+
        if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)))
          mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
-       ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR);
+       ci_send_message (replyflags, NULL, NULL, Context, tag ? NULL : CURHDR);
        menu->redraw = REDRAW_FULL;
        break;
+      }
 
       case OP_SHELL_ESCAPE:
 
index e3da882a51f68339ac193150536d884a92e62e8d..105eb585a0fdfb25987b8efdf3e422fde082bfdd 100644 (file)
@@ -1233,6 +1233,7 @@ new message.
 <row><entry>m</entry><entry><literal>&lt;compose&gt;</literal></entry><entry>compose a new message</entry></row>
 <row><entry>r</entry><entry><literal>&lt;reply&gt;</literal></entry><entry>reply to sender</entry></row>
 <row><entry>g</entry><entry><literal>&lt;group-reply&gt;</literal></entry><entry>reply to all recipients</entry></row>
+<row><entry></entry><entry><literal>&lt;group-chat-reply&gt;</literal></entry><entry>reply to all recipients preserving To/Cc</entry></row>
 <row><entry>L</entry><entry><literal>&lt;list-reply&gt;</literal></entry><entry>reply to mailing list address</entry></row>
 <row><entry>f</entry><entry><literal>&lt;forward&gt;</literal></entry><entry>forward message</entry></row>
 <row><entry>b</entry><entry><literal>&lt;bounce&gt;</literal></entry><entry>bounce (remail) message</entry></row>
@@ -1283,8 +1284,20 @@ Reply to the author directly.
 <term>Group reply</term>
 <listitem>
 <para>
-Reply to the author as well to all recipients except you; this consults
-<link linkend="alternates"><command>alternates</command></link>.
+Reply to the author; cc all other recipients; consults
+<link linkend="alternates"><command>alternates</command></link>
+and excludes you.
+</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>Group Chat reply</term>
+<listitem>
+<para>
+Reply to the author and other recipients in the To list;
+cc other recipients in the Cc list; consults
+<link linkend="alternates"><command>alternates</command></link>
+and excludes you.
 </para>
 </listitem>
 </varlistentry>
index d3ac06b7538eb4d9c1a59244499846faa839de81..081f14877044025a384ca14555d8abda9d806c98 100644 (file)
@@ -106,6 +106,7 @@ const struct binding_t OpMain[] = { /* map: index */
   { "edit-type",               OP_EDIT_TYPE,                   "\005" },
   { "forward-message",         OP_FORWARD_MESSAGE,             "f" },
   { "flag-message",            OP_FLAG_MESSAGE,                "F" },
+  { "group-chat-reply",                OP_GROUP_CHAT_REPLY,            NULL },
   { "group-reply",             OP_GROUP_REPLY,                 "g" },
 #ifdef USE_POP
   { "fetch-mail",              OP_MAIN_FETCH_MAIL,             "G" },
@@ -209,6 +210,7 @@ const struct binding_t OpPager[] = { /* map: pager */
   { "edit-type",       OP_EDIT_TYPE,                   "\005" },
   { "forward-message", OP_FORWARD_MESSAGE,             "f" },
   { "flag-message",    OP_FLAG_MESSAGE,                "F" },
+  { "group-chat-reply",        OP_GROUP_CHAT_REPLY,            NULL },
   { "group-reply",     OP_GROUP_REPLY,                 "g" },
 #ifdef USE_IMAP
   { "imap-fetch-mail",  OP_MAIN_IMAP_FETCH,            NULL },
@@ -320,6 +322,7 @@ const struct binding_t OpAttach[] = { /* map: attachment */
   { "view-mailcap",    OP_ATTACH_VIEW_MAILCAP,         "m" },
   { "reply",           OP_REPLY,                       "r" },
   { "resend-message",  OP_RESEND,                      "\033e" },
+  { "group-chat-reply",        OP_GROUP_CHAT_REPLY,            NULL },
   { "group-reply",     OP_GROUP_REPLY,                 "g" },
   { "list-reply",      OP_LIST_REPLY,                  "L" },
   { "forward-message", OP_FORWARD_MESSAGE,             "f" },
diff --git a/mutt.h b/mutt.h
index 004f4b485edd2939fe6ee30837443c470853fb75..08933c0556de61b0424026467a5ae999da283758 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -346,7 +346,8 @@ enum
 #define SENDPOSTPONEDFCC       (1<<9) /* used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present */
 #define SENDNOFREEHEADER       (1<<10)   /* Used by the -E flag */
 #define SENDDRAFTFILE          (1<<11)   /* Used by the -H flag */
-#define SENDTOSENDER    (1<<12)
+#define SENDTOSENDER            (1<<12)
+#define SENDGROUPCHATREPLY      (1<<13)
 
 /* flags for mutt_compose_menu() */
 #define MUTT_COMPOSE_NOFREEHEADER (1<<0)
diff --git a/pager.c b/pager.c
index fb821305d8c1a204ee05acce2a34b8e17614e8f1..4d8f3161529d9dd98b4dcd9bbb0c83082658facf 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2652,15 +2652,28 @@ search_next:
        break;
 
       case OP_REPLY:
+      case OP_GROUP_REPLY:
+      case OP_GROUP_CHAT_REPLY:
+      case OP_LIST_REPLY:
+      {
+        int replyflags;
+
        CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
         CHECK_ATTACH;
+
+        replyflags = SENDREPLY |
+         (ch == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) |
+         (ch == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) |
+         (ch == OP_LIST_REPLY ? SENDLISTREPLY : 0);
+
         if (IsMsgAttach (extra))
          mutt_attach_reply (extra->fp, extra->hdr, extra->actx,
-                            extra->bdy, SENDREPLY);
+                            extra->bdy, replyflags);
        else
-         ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr);
+         ci_send_message (replyflags, NULL, NULL, extra->ctx, extra->hdr);
        pager_menu->redraw = REDRAW_FULL;
        break;
+      }
 
       case OP_RECALL_MESSAGE:
        CHECK_MODE(IsHeader (extra) && !IsAttach(extra));
@@ -2669,28 +2682,6 @@ search_next:
        pager_menu->redraw = REDRAW_FULL;
        break;
 
-      case OP_GROUP_REPLY:
-       CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
-        CHECK_ATTACH;
-        if (IsMsgAttach (extra))
-         mutt_attach_reply (extra->fp, extra->hdr, extra->actx,
-                            extra->bdy, SENDREPLY|SENDGROUPREPLY);
-        else
-         ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr);
-       pager_menu->redraw = REDRAW_FULL;
-       break;
-
-      case OP_LIST_REPLY:
-       CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
-        CHECK_ATTACH;
-        if (IsMsgAttach (extra))
-         mutt_attach_reply (extra->fp, extra->hdr, extra->actx,
-                            extra->bdy, SENDREPLY|SENDLISTREPLY);
-        else
-         ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr);
-       pager_menu->redraw = REDRAW_FULL;
-       break;
-
       case OP_FORWARD_MESSAGE:
        CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
         CHECK_ATTACH;
index efc832cefc45119730d67faca1355211c9c677ff..cc083ce1df3ae2124c50a7804a648720e2290627 100644 (file)
@@ -1333,12 +1333,14 @@ void mutt_view_attachments (HEADER *hdr)
 
       case OP_REPLY:
       case OP_GROUP_REPLY:
+      case OP_GROUP_CHAT_REPLY:
       case OP_LIST_REPLY:
 
         CHECK_ATTACH;
 
         flags = SENDREPLY |
          (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) |
+         (op == OP_GROUP_CHAT_REPLY ? SENDGROUPCHATREPLY : 0) |
          (op == OP_LIST_REPLY ? SENDLISTREPLY : 0);
         mutt_attach_reply (CURATTACH->fp, hdr, actx,
                           menu->tagprefix ? NULL : CURATTACH->content, flags);
diff --git a/send.c b/send.c
index e855cf9aab27dc0fcc4efaf07313767eb8ee4300..137d0153d57cf000e1d0bc5cfc221101dc8f1d04 100644 (file)
--- a/send.c
+++ b/send.c
@@ -530,7 +530,8 @@ int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags)
   ADDRESS *tmp;
   int hmfupto = -1;
 
-  if ((flags & (SENDLISTREPLY|SENDGROUPREPLY)) && in->mail_followup_to)
+  if ((flags & (SENDLISTREPLY|SENDGROUPREPLY|SENDGROUPCHATREPLY)) &&
+      in->mail_followup_to)
   {
     snprintf (prompt, sizeof (prompt), _("Follow-up to %s%s?"),
              in->mail_followup_to->mailbox,
@@ -554,13 +555,18 @@ int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags)
     rfc822_append (&out->to, in->from, 0);
   else
   {
-    if (default_to (&out->to, in, flags & SENDGROUPREPLY, hmfupto) == -1)
+    if (default_to (&out->to, in, flags & (SENDGROUPREPLY|SENDGROUPCHATREPLY),
+                    hmfupto) == -1)
       return (-1); /* abort */
 
-    if ((flags & SENDGROUPREPLY) && (!in->mail_followup_to || hmfupto != MUTT_YES))
+    if ((flags & (SENDGROUPREPLY|SENDGROUPCHATREPLY)) &&
+        (!in->mail_followup_to || hmfupto != MUTT_YES))
     {
       /* if (!mutt_addr_is_user(in->to)) */
-      rfc822_append (&out->cc, in->to, 1);
+      if (flags & SENDGROUPREPLY)
+        rfc822_append (&out->cc, in->to, 1);
+      else
+        rfc822_append (&out->to, in->to, 1);
       rfc822_append (&out->cc, in->cc, 1);
     }
   }