[PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 9b / fba36595ae82df0bac0b3fb78f193183c45033
1 Return-Path: <sojkam1@fel.cvut.cz>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1CA1B431FCF\r
6         for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 09:30:17 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.211\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.211 tagged_above=-999 required=5 tests=[AWL=0.388,\r
12         BAYES_00=-2.599] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 1RBsKZm8EIwG for <notmuch@notmuchmail.org>;\r
16         Mon,  1 Mar 2010 09:30:15 -0800 (PST)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 887F8431FC3\r
19         for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 09:30:15 -0800 (PST)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id 64A7819F33C8;\r
22         Mon,  1 Mar 2010 18:30:07 +0100 (CET)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id bNGhxSiZAReL; Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id D7D5519F3376;\r
30         Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
31 Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])\r
32         (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id C50EBFA003;\r
34         Mon,  1 Mar 2010 18:30:04 +0100 (CET)\r
35 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
36 To: notmuch@notmuchmail.org\r
37 Date: Mon,  1 Mar 2010 18:29:47 +0100\r
38 Message-Id: <1267464588-21050-1-git-send-email-sojkam1@fel.cvut.cz>\r
39 X-Mailer: git-send-email 1.7.0\r
40 Subject: [notmuch] [PATCH 1/2] Allow replying only to sender\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Mon, 01 Mar 2010 17:30:17 -0000\r
54 \r
55 This adds --sender-only option to reply command, which makes the reply\r
56 go only to the original sender.\r
57 \r
58 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
59 ---\r
60  notmuch-reply.c |    9 +++++++--\r
61  notmuch.1       |    6 ++++++\r
62  notmuch.c       |    3 +++\r
63  3 files changed, 16 insertions(+), 2 deletions(-)\r
64 \r
65 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
66 index 98f6442..5814313 100644\r
67 --- a/notmuch-reply.c\r
68 +++ b/notmuch-reply.c\r
69 @@ -23,6 +23,8 @@\r
70  #include "notmuch-client.h"\r
71  #include "gmime-filter-reply.h"\r
72  \r
73 +static notmuch_bool_t sender_only = FALSE;\r
74 +\r
75  static void\r
76  reply_part_content (GMimeObject *part)\r
77  {\r
78 @@ -246,6 +248,7 @@ add_recipients_from_message (GMimeMessage *reply,\r
79      };\r
80      const char *from_addr = NULL;\r
81      unsigned int i;\r
82 +    unsigned int max;\r
83  \r
84      /* Some mailing lists munge the Reply-To header despite it being A Bad\r
85       * Thing, see http://www.unicom.com/pw/reply-to-harmful.html\r
86 @@ -262,8 +265,8 @@ add_recipients_from_message (GMimeMessage *reply,\r
87         reply_to_map[0].header = "from";\r
88         reply_to_map[0].fallback = NULL;\r
89      }\r
90 -\r
91 -    for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {\r
92 +    max = sender_only ? 1 : ARRAY_SIZE (reply_to_map);\r
93 +    for (i = 0; i < max; i++) {\r
94         const char *addr, *recipients;\r
95  \r
96         recipients = notmuch_message_get_header (message,\r
97 @@ -443,6 +446,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
98                 fprintf (stderr, "Invalid value for --format: %s\n", opt);\r
99                 return 1;\r
100             }\r
101 +       } else if (STRNCMP_LITERAL (argv[i], "--sender-only") == 0) {\r
102 +           sender_only = TRUE;\r
103         } else {\r
104             fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
105             return 1;\r
106 diff --git a/notmuch.1 b/notmuch.1\r
107 index 282ad98..7220145 100644\r
108 --- a/notmuch.1\r
109 +++ b/notmuch.1\r
110 @@ -258,6 +258,12 @@ Includes subject and quoted message body.\r
111  .BR headers-only\r
112  Only produces In-Reply-To, References, To, Cc, and Bcc headers.\r
113  .RE\r
114 +.TP 4\r
115 +.B \-\-sender\-only\r
116 +\r
117 +Only setup the To: header as described above, not the additional Cc\r
118 +headers.\r
119 +.RE\r
120  \r
121  See the\r
122  .B "SEARCH SYNTAX"\r
123 diff --git a/notmuch.c b/notmuch.c\r
124 index 87479f8..13df953 100644\r
125 --- a/notmuch.c\r
126 +++ b/notmuch.c\r
127 @@ -233,6 +233,9 @@ command_t commands[] = {\r
128        "\t\t\t\tOnly produces In-Reply-To, References, To\n"\r
129        "\t\t\t\tCc, and Bcc headers.\n"\r
130        "\n"\r
131 +      "\t\t--sender-only\n"\r
132 +      "\t\t\tReply only to sender.\n"\r
133 +      "\n"\r
134        "\t\tSee \"notmuch help search-terms\" for details of the search\n"\r
135        "\t\tterms syntax." },\r
136      { "tag", notmuch_tag_command,\r
137 -- \r
138 1.7.0\r
139 \r