1 Return-Path: <jani@nikula.org>
\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 arlo.cworth.org (Postfix) with ESMTP id D72186DE3A57
\r
6 for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:43 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
10 X-Spam-Score: -0.574
\r
12 X-Spam-Status: No, score=-0.574 tagged_above=-999 required=5 tests=[AWL=0.146,
\r
13 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,
\r
14 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 4MD4dv6l_A22 for <notmuch@notmuchmail.org>;
\r
18 Sat, 13 Aug 2016 04:39:36 -0700 (PDT)
\r
19 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com
\r
20 [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id 5575F6DE38DA for
\r
21 <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:14 -0700 (PDT)
\r
22 Received: by mail-wm0-f66.google.com with SMTP id q128so2021111wma.1
\r
23 for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:14 -0700 (PDT)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=nikula-org.20150623.gappssmtp.com; s=20150623;
\r
26 h=from:to:cc:subject:date:message-id:in-reply-to:references
\r
27 :in-reply-to:references;
\r
28 bh=b7QIri2DRzrN84f47fMDjjHS9mXCicuyiHHSgXz6VoA=;
\r
29 b=IJZLuaO+Amv1DR5W5YJoLF9Rdn4SvuxlXUHR4ejxeVn/s8FRstUG5m4Q/Agwjfgv0U
\r
30 ooCWDHb0Ebmsw6UxHRIQGhLlLNa7sj/M88MR85egAFtA7CxEA0ep6RnQ4cxQNeN044nV
\r
31 s+RBKMpqj74ZdyfyRPimvCpnnN6jfI4KofRgTZZdDAQsDGkBoFCi6VS2K2i9ze5LtUXQ
\r
32 KJt310W+WPZqEufwx/MfMV/lOyO3noFgwQUsA4dCjAATcC9ecdidSWZr/dexkiaCZuSG
\r
33 e7yVT4bfDcE7DbsYlzQLg1ql4yXSxyTYzn+Jm5FQN4H5y2/2Z/93hLBt4T1+1naDMEPL
\r
35 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
36 d=1e100.net; s=20130820;
\r
37 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
38 :references:in-reply-to:references;
\r
39 bh=b7QIri2DRzrN84f47fMDjjHS9mXCicuyiHHSgXz6VoA=;
\r
40 b=CnuDcdrol9wx/hRAomK7rdnwhno6Fub5O2x4SDCRV9zaKuNesTfCCfbvU+8QCy4fhd
\r
41 uLWOfvDmwir34Vjmg9mrT68WGjUvlMQ7GLa7FdaAuU5GKHzpjYIH8t2xp+yfmzgrPszA
\r
42 t3LUwQ8fTgw148YlT7lwWCQhktcEhU97hxjAijxJ2NxuljgCiCouWkfNNUkTIRMB1YQq
\r
43 02DCUvTFLy0DxaDfdApfhCzE1ml3JIZacnZxQ+xwuJ3jzmuDXyfmnte6LKJ6F6MN7PO6
\r
44 qI7r7wSvh7psdn+rtxTMoqKxAcqIoyuoeThZ081x7VjEz0dz8qpu0zpeLWDECcHyaq6X
\r
47 AEkooutix+7JQA8qIkopAJpJ1H69K7ClZYo1TBMMxwkaeVMPuoRaXi0amXydR4KMumgiwg==
\r
48 X-Received: by 10.194.35.42 with SMTP id e10mr20014626wjj.107.1471088352970;
\r
49 Sat, 13 Aug 2016 04:39:12 -0700 (PDT)
\r
50 Received: from localhost (mobile-access-bcee63-250.dhcp.inet.fi.
\r
52 by smtp.gmail.com with ESMTPSA id bw9sm11773689wjc.33.2016.08.13.04.39.12
\r
53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
54 Sat, 13 Aug 2016 04:39:12 -0700 (PDT)
\r
55 From: Jani Nikula <jani@nikula.org>
\r
56 To: notmuch@notmuchmail.org
\r
57 Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
\r
59 Subject: [PATCH v2 07/14] cli/reply: reuse create_reply_message() also for
\r
61 Date: Sat, 13 Aug 2016 14:37:31 +0300
\r
63 <f64a12b6237f86f4ab26d84a40408846ce9ff04c.1471088022.git.jani@nikula.org>
\r
64 X-Mailer: git-send-email 2.1.4
\r
65 In-Reply-To: <cover.1471088022.git.jani@nikula.org>
\r
66 References: <cover.1471088022.git.jani@nikula.org>
\r
67 In-Reply-To: <cover.1471088022.git.jani@nikula.org>
\r
68 References: <cover.1471088022.git.jani@nikula.org>
\r
69 X-BeenThere: notmuch@notmuchmail.org
\r
70 X-Mailman-Version: 2.1.20
\r
72 List-Id: "Use and development of the notmuch mail system."
\r
73 <notmuch.notmuchmail.org>
\r
74 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
77 List-Post: <mailto:notmuch@notmuchmail.org>
\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
79 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
80 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
81 X-List-Received-Date: Sat, 13 Aug 2016 11:39:43 -0000
\r
83 Add an option for "limited" headers for the (slightly misleadingly
\r
84 named) headers-only format. There should be no functional changes.
\r
86 notmuch-reply.c | 46 +++++++++++++++-------------------------------
\r
87 1 file changed, 15 insertions(+), 31 deletions(-)
\r
89 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
90 index c2d7402d40ae..daad453efb09 100644
\r
91 --- a/notmuch-reply.c
\r
92 +++ b/notmuch-reply.c
\r
93 @@ -520,13 +520,17 @@ static GMimeMessage *
\r
94 create_reply_message(void *ctx,
\r
95 notmuch_config_t *config,
\r
96 notmuch_message_t *message,
\r
97 - notmuch_bool_t reply_all)
\r
98 + notmuch_bool_t reply_all,
\r
99 + notmuch_bool_t limited)
\r
101 const char *subject, *from_addr = NULL;
\r
102 const char *in_reply_to, *orig_references, *references;
\r
104 - /* The 1 means we want headers in a "pretty" order. */
\r
105 - GMimeMessage *reply = g_mime_message_new (1);
\r
107 + * Use the below header order for limited headers, "pretty" order
\r
110 + GMimeMessage *reply = g_mime_message_new (limited ? 0 : 1);
\r
111 if (reply == NULL) {
\r
112 fprintf (stderr, "Out of memory\n");
\r
114 @@ -549,6 +553,10 @@ create_reply_message(void *ctx,
\r
115 from_addr = add_recipients_from_message (reply, config,
\r
116 message, reply_all);
\r
118 + /* The above is all that is needed for limited headers. */
\r
123 * Sadly, there is no standard way to find out to which email
\r
124 * address a mail was delivered - what is in the headers depends
\r
125 @@ -605,7 +613,7 @@ notmuch_reply_format_default(void *ctx,
\r
126 if (mime_node_open (ctx, message, ¶ms->crypto, &node))
\r
129 - reply = create_reply_message (ctx, config, message, reply_all);
\r
130 + reply = create_reply_message (ctx, config, message, reply_all, FALSE);
\r
134 @@ -632,7 +640,7 @@ notmuch_reply_format_sprinter(void *ctx,
\r
135 if (mime_node_open (ctx, message, ¶ms->crypto, &node))
\r
138 - reply = create_reply_message (ctx, config, message, reply_all);
\r
139 + reply = create_reply_message (ctx, config, message, reply_all, FALSE);
\r
143 @@ -665,34 +673,10 @@ notmuch_reply_format_headers_only(void *ctx,
\r
144 unused (sprinter_t *sp))
\r
146 GMimeMessage *reply;
\r
147 - const char *in_reply_to, *orig_references, *references;
\r
149 - /* The 0 means we do not want headers in a "pretty" order. */
\r
150 - reply = g_mime_message_new (0);
\r
151 - if (reply == NULL) {
\r
152 - fprintf (stderr, "Out of memory\n");
\r
153 + reply = create_reply_message (ctx, config, message, reply_all, TRUE);
\r
158 - in_reply_to = talloc_asprintf (ctx, "<%s>",
\r
159 - notmuch_message_get_message_id (message));
\r
161 - g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
\r
163 - orig_references = notmuch_message_get_header (message, "references");
\r
166 - * We print In-Reply-To followed by References because git
\r
167 - * format-patch treats them specially. Git does not interpret the
\r
168 - * other headers specially.
\r
170 - references = talloc_asprintf (ctx, "%s%s%s",
\r
171 - orig_references ? orig_references : "",
\r
172 - orig_references ? " " : "",
\r
174 - g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
\r
176 - (void)add_recipients_from_message (reply, config, message, reply_all);
\r
178 show_reply_headers (reply);
\r