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 4B8216DE3B39
\r
6 for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:41:35 -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.575
\r
12 X-Spam-Status: No, score=-0.575 tagged_above=-999 required=5 tests=[AWL=0.145,
\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 BzeVEKQ5tz-Z for <notmuch@notmuchmail.org>;
\r
18 Sat, 13 Aug 2016 04:41:27 -0700 (PDT)
\r
19 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com
\r
20 [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 1A3BD6DE38C5 for
\r
21 <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:23 -0700 (PDT)
\r
22 Received: by mail-wm0-f67.google.com with SMTP id q128so2021557wma.1
\r
23 for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:23 -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=EBSFEIre9w10UPwn/U5SUVD/q7bQedUt80//bcDsm5Y=;
\r
29 b=qO9ETH3LVndM85clLdz9rmvEOeLDG7LqSCxrX/ToSsdNZn3MCG8GHqG9Xj62TSVCHC
\r
30 vfW6025FlYEN5WrSvBDg96csBlKGR/MgBNWL6bStx9AIzPq4w4qI1fRk/k8FPq533fon
\r
31 J/vkJ0quNIItXBtwUGw7IhZRPf0N/WADm1GL2jhAfNpuCPjQbRstHof7hq7n+Avxf1VV
\r
32 Vt2ax3unPk4OI6bYVS6vcyFR46gsmgXfRUqlhPTxazlbf796DbGzEa5/x4s8U/KH6m75
\r
33 qDGCe68h46chvU6rdu6j3J6Zj1ZpjuuhRdEITzWeoO51n2fKthYyYWGJmHC3GXcq0ZHe
\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=EBSFEIre9w10UPwn/U5SUVD/q7bQedUt80//bcDsm5Y=;
\r
40 b=JFYhBydoVvaK16EdznIacVDwfMZ6CC0I4QZ3yUgaYULQfx9u2QTM9x+3mvLwkaGaRs
\r
41 IFU4H+u76P9Dh1S1c+6TW5NJ9m4sAVUgC1W2xGdTNjdx0h98xCe6tCgfrtkl6unyCp6H
\r
42 0/D9y1czUaRsuBqRgjS8UO0khgI65S6erTbrn8Ilgl5pAryi3R6aRN1wg5vHYDMTczw3
\r
43 OoPjUdhIn2PRab3H2YRZlMmzxnePlSTaADJk/WFWvBA+nUjVpZK3b/7D1CXiUfmZ9FUX
\r
44 HSnkAvDdjnoDj4YQ5A+Igjbu8uU4iNoYdJk0vK02aLG+5mYwMWLsdJNFundBA7A0rDpf
\r
47 AEkoouuUXtva8gF6hr3DqvWzq+UGv1jb1fSY3L9WRAavQSdbSpdZFAlTvIKPAArmTEEaqw==
\r
48 X-Received: by 10.28.148.21 with SMTP id w21mr3739056wmd.50.1471088361726;
\r
49 Sat, 13 Aug 2016 04:39:21 -0700 (PDT)
\r
50 Received: from localhost (mobile-access-bcee63-250.dhcp.inet.fi.
\r
52 by smtp.gmail.com with ESMTPSA id e10sm11794272wjc.21.2016.08.13.04.39.20
\r
53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
54 Sat, 13 Aug 2016 04:39:21 -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 13/14] cli/reply: pass gmime message to munge detection
\r
60 Date: Sat, 13 Aug 2016 14:37:37 +0300
\r
62 <771c4118ad840f9b9af1a3744d53e7ede3bd837d.1471088022.git.jani@nikula.org>
\r
63 X-Mailer: git-send-email 2.1.4
\r
64 In-Reply-To: <cover.1471088022.git.jani@nikula.org>
\r
65 References: <cover.1471088022.git.jani@nikula.org>
\r
66 In-Reply-To: <cover.1471088022.git.jani@nikula.org>
\r
67 References: <cover.1471088022.git.jani@nikula.org>
\r
68 X-BeenThere: notmuch@notmuchmail.org
\r
69 X-Mailman-Version: 2.1.20
\r
71 List-Id: "Use and development of the notmuch mail system."
\r
72 <notmuch.notmuchmail.org>
\r
73 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
75 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
76 List-Post: <mailto:notmuch@notmuchmail.org>
\r
77 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
78 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
79 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
80 X-List-Received-Date: Sat, 13 Aug 2016 11:41:35 -0000
\r
82 Improves the accuracy in many ways.
\r
84 notmuch-reply.c | 35 +++++++++++++++++++++++------------
\r
85 1 file changed, 23 insertions(+), 12 deletions(-)
\r
87 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
88 index cf4248bd6794..abf3a6c1824c 100644
\r
89 --- a/notmuch-reply.c
\r
90 +++ b/notmuch-reply.c
\r
91 @@ -230,13 +230,16 @@ scan_address_list (InternetAddressList *list,
\r
92 /* Does the address in the Reply-To header of 'message' already appear
\r
93 * in either the 'To' or 'Cc' header of the message?
\r
96 -reply_to_header_is_redundant (notmuch_message_t *message,
\r
97 +static notmuch_bool_t
\r
98 +reply_to_header_is_redundant (GMimeMessage *message,
\r
99 InternetAddressList *reply_to_list)
\r
101 - const char *to, *cc, *addr;
\r
102 + const char *addr, *reply_to;
\r
103 InternetAddress *address;
\r
104 InternetAddressMailbox *mailbox;
\r
105 + InternetAddressList *recipients;
\r
106 + notmuch_bool_t ret = FALSE;
\r
109 if (reply_to_list == NULL ||
\r
110 internet_address_list_length (reply_to_list) != 1)
\r
111 @@ -247,18 +250,26 @@ reply_to_header_is_redundant (notmuch_message_t *message,
\r
114 mailbox = INTERNET_ADDRESS_MAILBOX (address);
\r
115 - addr = internet_address_mailbox_get_addr (mailbox);
\r
116 + reply_to = internet_address_mailbox_get_addr (mailbox);
\r
118 - to = notmuch_message_get_header (message, "to");
\r
119 - cc = notmuch_message_get_header (message, "cc");
\r
120 + recipients = g_mime_message_get_all_recipients (message);
\r
122 - if ((to && strstr (to, addr) != 0) ||
\r
123 - (cc && strstr (cc, addr) != 0))
\r
126 + for (i = 0; i < internet_address_list_length (recipients); i++) {
\r
127 + address = internet_address_list_get_address (recipients, i);
\r
128 + if (INTERNET_ADDRESS_IS_GROUP (address))
\r
131 + mailbox = INTERNET_ADDRESS_MAILBOX (address);
\r
132 + addr = internet_address_mailbox_get_addr (mailbox);
\r
133 + if (strcmp (addr, reply_to) == 0) {
\r
140 + g_object_unref (G_OBJECT (recipients));
\r
145 static InternetAddressList *get_sender(notmuch_message_t *message,
\r
146 @@ -284,7 +295,7 @@ static InternetAddressList *get_sender(notmuch_message_t *message,
\r
147 * will always appear in the reply if reply_all is true.
\r
149 reply_to_list = internet_address_list_parse_string (reply_to);
\r
150 - if (! reply_to_header_is_redundant (message, reply_to_list))
\r
151 + if (! reply_to_header_is_redundant (mime_message, reply_to_list))
\r
152 return reply_to_list;
\r
154 g_object_unref (G_OBJECT (reply_to_list));
\r