1 Return-Path: <m.walters@qmul.ac.uk>
\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 23E5F431FC2
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:48:15 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id Jbs4ekQYlR9U for <notmuch@notmuchmail.org>;
\r
17 Fri, 31 Oct 2014 09:48:07 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id ED957431FBC
\r
22 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:48:06 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1XkFMV-000166-Qw; Fri, 31 Oct 2014 16:48:03 +0000
\r
27 Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1XkFMV-0003j6-8u; Fri, 31 Oct 2014 16:47:43 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Michal Sojka <sojkam1@fel.cvut.cz>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients
\r
34 In-Reply-To: <87vbn06yry.fsf@steelpick.2x.cz>
\r
35 References: <1414713573-21461-1-git-send-email-sojkam1@fel.cvut.cz>
\r
36 <878ujwvctt.fsf@qmul.ac.uk> <8761f0v8v7.fsf@qmul.ac.uk>
\r
37 <87vbn06yry.fsf@steelpick.2x.cz>
\r
38 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1
\r
39 (x86_64-pc-linux-gnu)
\r
40 Date: Fri, 31 Oct 2014 16:47:41 +0000
\r
41 Message-ID: <87zjcctccy.fsf@qmul.ac.uk>
\r
43 Content-Type: text/plain; charset=utf-8
\r
44 Content-Transfer-Encoding: quoted-printable
\r
45 X-Sender-Host-Address: 87.81.223.162
\r
46 X-QM-Geographic: According to ripencc,
\r
47 this message was delivered by a machine in Britain (UK) (GB).
\r
48 X-QM-SPAM-Info: Sender has good ham record. :)
\r
49 X-QM-Body-MD5: 186a34cae54bb154157f14d7fb1ba354 (of first 20000 bytes)
\r
50 X-SpamAssassin-Score: -0.1
\r
51 X-SpamAssassin-SpamBar: /
\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
54 spam. We require at least 5.0 points to mark a message as spam.
\r
55 This message scored -0.1 points.
\r
56 Summary of the scoring:
\r
57 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
58 provider * (markwalters1009[at]gmail.com)
\r
59 * -0.1 AWL AWL: From: address is in the auto white-list
\r
60 X-QM-Scan-Virus: ClamAV says the message is clean
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Fri, 31 Oct 2014 16:48:15 -0000
\r
78 On Fri, 31 Oct 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
\r
79 > On Fri, Oct 31 2014, Mark Walters wrote:
\r
80 >> My only query is in the text output: should the name part be printed as
\r
81 >> a quoted string. For example currently I get a line of the form
\r
83 >> Bloggs, Fred <fred@example.com>
\r
87 > On Fri, Oct 31 2014, Mark Walters wrote:
\r
90 >> I attach a patch which does the quoting for real names but I don't know
\r
91 >> if we want it: it changes (example taken from the test suite)
\r
93 >> Fran=C3=A7ois Boulogne to
\r
95 >> =3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne
\r
97 >> (which is what was in the original email)
\r
99 >> Plausibly the best thing is just to leave the series as is, so the
\r
100 >> text output is readable and parseable in the common cases.
\r
102 >> Anyway the patch is attached if anyone wants to experiment.
\r
108 >> From 53b1ced2d6a9fbbba93448325f795e6b99faa240 Mon Sep 17 00:00:00 2001
\r
109 >> From: Mark Walters <markwalters1009@gmail.com>
\r
110 >> Date: Fri, 31 Oct 2014 10:11:40 +0000
\r
111 >> Subject: [PATCH] search: quote real names for output=3Dsender/recipient =
\r
115 >> This quotes the real name (when gmime thinks appropriate) for the text
\r
116 >> output. For the other outputs the real name is separate from the
\r
117 >> address so the consumer can do any quoting necessary.
\r
119 >> notmuch-search.c | 8 ++++----
\r
120 >> test/T090-search-output.sh | 8 ++++----
\r
121 >> 2 files changed, 8 insertions(+), 8 deletions(-)
\r
123 >> diff --git a/notmuch-search.c b/notmuch-search.c
\r
124 >> index eae749a..8eac161 100644
\r
125 >> --- a/notmuch-search.c
\r
126 >> +++ b/notmuch-search.c
\r
127 >> @@ -47,6 +47,7 @@ typedef struct {
\r
128 >> typedef struct {
\r
129 >> const char *name;
\r
130 >> const char *addr;
\r
131 >> + const char *string;
\r
134 >> /* Return two stable query strings that identify exactly the matched
\r
135 >> @@ -255,15 +256,13 @@ print_mailbox (const search_options_t *opt, const =
\r
136 mailbox_t *mailbox)
\r
138 >> const char *name =3D mailbox->name;
\r
139 >> const char *addr =3D mailbox->addr;
\r
140 >> + const char *string =3D mailbox->string;
\r
141 >> sprinter_t *format =3D opt->format;
\r
143 >> if (format->is_text_printer) {
\r
144 >> char *mailbox_str;
\r
146 >> - if (name && *name)
\r
147 >> - mailbox_str =3D talloc_asprintf (format, "%s <%s>", name, addr);
\r
149 >> - mailbox_str =3D talloc_strdup (format, addr);
\r
150 >> + mailbox_str =3D talloc_strdup (format, string);
\r
152 >> if (! mailbox_str) {
\r
153 >> fprintf (stderr, "Error: out of memory\n");
\r
154 >> @@ -309,6 +308,7 @@ process_address_list (const search_options_t *opt, G=
\r
156 >> mailbox_t mbx =3D {
\r
157 >> .name =3D internet_address_get_name (address),
\r
158 >> .addr =3D internet_address_mailbox_get_addr (mailbox),
\r
159 >> + .string =3D internet_address_to_string (address, TRUE),
\r
161 > I'd prefer having the second parameter (encode) FALSE. This will still
\r
162 > add quotes when necessary, but does not encode non-ascii characters so
\r
163 > the result would be human readable.
\r
165 Yes that is clearly better.
\r
167 > Another question is whether to add .string to mailbox_t. In this patch
\r
168 > it doesn't matter, but if --output=3Dcount patch will be merged, this
\r
169 > would mean that memory consumption doubles, because with --output=3Dcount
\r
170 > the addresses are kept in memory and printed only after the search is
\r
171 > completed. It would be therefore better to construct a new
\r
172 > InternetAddressMailbox from name and addr in print_mailbox() and perform
\r
173 > the conversion to string there. Thoughts?
\r
175 Yes I agree here too. Are you happy doing a replacement patch or should
\r
188 >> if (is_duplicate (opt, addrs, mbx.name, mbx.addr))
\r
189 >> diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
\r
190 >> index 841a721..776e3f4 100755
\r
191 >> --- a/test/T090-search-output.sh
\r
192 >> +++ b/test/T090-search-output.sh
\r
193 >> @@ -390,7 +390,7 @@ test_expect_equal_file OUTPUT EXPECTED
\r
194 >> test_begin_subtest "--output=3Dsender"
\r
195 >> notmuch search --output=3Dsender '*' >OUTPUT
\r
196 >> cat <<EOF >EXPECTED
\r
197 >> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
198 >> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
199 >> Olivier Berger <olivier.berger@it-sudparis.eu>
\r
200 >> Chris Wilson <chris@chris-wilson.co.uk>
\r
201 >> Carl Worth <cworth@cworth.org>
\r
202 >> @@ -437,7 +437,7 @@ test_begin_subtest "--output=3Drecipients"
\r
203 >> notmuch search --output=3Drecipients '*' >OUTPUT
\r
204 >> cat <<EOF >EXPECTED
\r
205 >> Allan McRae <allan@archlinux.org>
\r
206 >> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux.=
\r
208 >> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlinu=
\r
210 >> olivier.berger@it-sudparis.eu
\r
211 >> notmuch@notmuchmail.org
\r
212 >> notmuch <notmuch@notmuchmail.org>
\r
213 >> @@ -449,9 +449,9 @@ test_expect_equal_file OUTPUT EXPECTED
\r
214 >> test_begin_subtest "--output=3Dsender --output=3Drecipients"
\r
215 >> notmuch search --output=3Dsender --output=3Drecipients '*' >OUTPUT
\r
216 >> cat <<EOF >EXPECTED
\r
217 >> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
218 >> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
219 >> Allan McRae <allan@archlinux.org>
\r
220 >> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux.=
\r
222 >> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlinu=
\r
224 >> Olivier Berger <olivier.berger@it-sudparis.eu>
\r
225 >> olivier.berger@it-sudparis.eu
\r
226 >> Chris Wilson <chris@chris-wilson.co.uk>
\r