[notmuch] [PATCH 1/2] Allow replying only to sender
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 1 Mar 2010 17:29:47 +0000 (18:29 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:19 +0000 (09:36 -0800)
9b/fba36595ae82df0bac0b3fb78f193183c45033 [new file with mode: 0644]

diff --git a/9b/fba36595ae82df0bac0b3fb78f193183c45033 b/9b/fba36595ae82df0bac0b3fb78f193183c45033
new file mode 100644 (file)
index 0000000..34e1072
--- /dev/null
@@ -0,0 +1,139 @@
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1CA1B431FCF\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 09:30:17 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.211\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.211 tagged_above=-999 required=5 tests=[AWL=0.388,\r
+       BAYES_00=-2.599] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 1RBsKZm8EIwG for <notmuch@notmuchmail.org>;\r
+       Mon,  1 Mar 2010 09:30:15 -0800 (PST)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 887F8431FC3\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 09:30:15 -0800 (PST)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 64A7819F33C8;\r
+       Mon,  1 Mar 2010 18:30:07 +0100 (CET)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044)\r
+       with ESMTP id bNGhxSiZAReL; Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id D7D5519F3376;\r
+       Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
+Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id C50EBFA003;\r
+       Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Date: Mon,  1 Mar 2010 18:29:47 +0100\r
+Message-Id: <1267464588-21050-1-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.7.0\r
+Subject: [notmuch] [PATCH 1/2] Allow replying only to sender\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 01 Mar 2010 17:30:17 -0000\r
+\r
+This adds --sender-only option to reply command, which makes the reply\r
+go only to the original sender.\r
+\r
+Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
+---\r
+ notmuch-reply.c |    9 +++++++--\r
+ notmuch.1       |    6 ++++++\r
+ notmuch.c       |    3 +++\r
+ 3 files changed, 16 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 98f6442..5814313 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -23,6 +23,8 @@\r
+ #include "notmuch-client.h"\r
+ #include "gmime-filter-reply.h"\r
\r
++static notmuch_bool_t sender_only = FALSE;\r
++\r
+ static void\r
+ reply_part_content (GMimeObject *part)\r
+ {\r
+@@ -246,6 +248,7 @@ add_recipients_from_message (GMimeMessage *reply,\r
+     };\r
+     const char *from_addr = NULL;\r
+     unsigned int i;\r
++    unsigned int max;\r
\r
+     /* Some mailing lists munge the Reply-To header despite it being A Bad\r
+      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html\r
+@@ -262,8 +265,8 @@ add_recipients_from_message (GMimeMessage *reply,\r
+       reply_to_map[0].header = "from";\r
+       reply_to_map[0].fallback = NULL;\r
+     }\r
+-\r
+-    for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {\r
++    max = sender_only ? 1 : ARRAY_SIZE (reply_to_map);\r
++    for (i = 0; i < max; i++) {\r
+       const char *addr, *recipients;\r
\r
+       recipients = notmuch_message_get_header (message,\r
+@@ -443,6 +446,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+               fprintf (stderr, "Invalid value for --format: %s\n", opt);\r
+               return 1;\r
+           }\r
++      } else if (STRNCMP_LITERAL (argv[i], "--sender-only") == 0) {\r
++          sender_only = TRUE;\r
+       } else {\r
+           fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
+           return 1;\r
+diff --git a/notmuch.1 b/notmuch.1\r
+index 282ad98..7220145 100644\r
+--- a/notmuch.1\r
++++ b/notmuch.1\r
+@@ -258,6 +258,12 @@ Includes subject and quoted message body.\r
+ .BR headers-only\r
+ Only produces In-Reply-To, References, To, Cc, and Bcc headers.\r
+ .RE\r
++.TP 4\r
++.B \-\-sender\-only\r
++\r
++Only setup the To: header as described above, not the additional Cc\r
++headers.\r
++.RE\r
\r
+ See the\r
+ .B "SEARCH SYNTAX"\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 87479f8..13df953 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -233,6 +233,9 @@ command_t commands[] = {\r
+       "\t\t\t\tOnly produces In-Reply-To, References, To\n"\r
+       "\t\t\t\tCc, and Bcc headers.\n"\r
+       "\n"\r
++      "\t\t--sender-only\n"\r
++      "\t\t\tReply only to sender.\n"\r
++      "\n"\r
+       "\t\tSee \"notmuch help search-terms\" for details of the search\n"\r
+       "\t\tterms syntax." },\r
+     { "tag", notmuch_tag_command,\r
+-- \r
+1.7.0\r
+\r