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 27359431FC2
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:54:49 -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 Rs1k6WqUyvpN for <notmuch@notmuchmail.org>;
\r
17 Fri, 31 Oct 2014 09:54:41 -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 073CB431FBC
\r
22 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:54:41 -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 1XkFSr-0003L4-64; Fri, 31 Oct 2014 16:54:37 +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 1XkFSq-0004sK-FQ; Fri, 31 Oct 2014 16:54:16 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Tomi Ollila <tomi.ollila@iki.fi>, Michal Sojka <sojkam1@fel.cvut.cz>,
\r
33 notmuch@notmuchmail.org
\r
34 Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients
\r
35 In-Reply-To: <m24mukyyoz.fsf@guru.guru-group.fi>
\r
36 References: <1414713573-21461-1-git-send-email-sojkam1@fel.cvut.cz>
\r
37 <878ujwvctt.fsf@qmul.ac.uk> <8761f0v8v7.fsf@qmul.ac.uk>
\r
38 <87vbn06yry.fsf@steelpick.2x.cz>
\r
39 <m24mukyyoz.fsf@guru.guru-group.fi>
\r
40 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Fri, 31 Oct 2014 16:54:14 +0000
\r
43 Message-ID: <87wq7gtc21.fsf@qmul.ac.uk>
\r
45 Content-Type: text/plain; charset=utf-8
\r
46 Content-Transfer-Encoding: quoted-printable
\r
47 X-Sender-Host-Address: 87.81.223.162
\r
48 X-QM-Geographic: According to ripencc,
\r
49 this message was delivered by a machine in Britain (UK) (GB).
\r
50 X-QM-SPAM-Info: Sender has good ham record. :)
\r
51 X-QM-Body-MD5: 6a686411854f60733bdb92bedc9f3a0f (of first 20000 bytes)
\r
52 X-SpamAssassin-Score: -0.1
\r
53 X-SpamAssassin-SpamBar: /
\r
54 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
56 spam. We require at least 5.0 points to mark a message as spam.
\r
57 This message scored -0.1 points.
\r
58 Summary of the scoring:
\r
59 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
60 provider * (markwalters1009[at]gmail.com)
\r
61 * -0.1 AWL AWL: From: address is in the auto white-list
\r
62 X-QM-Scan-Virus: ClamAV says the message is clean
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Fri, 31 Oct 2014 16:54:49 -0000
\r
78 On Fri, 31 Oct 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
79 > On Fri, Oct 31 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
\r
81 >> On Fri, Oct 31 2014, Mark Walters wrote:
\r
82 >>> My only query is in the text output: should the name part be printed as
\r
83 >>> a quoted string. For example currently I get a line of the form
\r
85 >>> Bloggs, Fred <fred@example.com>
\r
89 > There has been some discussion on this issue on IRC channel, and the
\r
90 > opinion of most (seen so far) is that output the parts without quoting
\r
91 > (i.e. just like done in this patch series)...
\r
93 Just to confirm I am happy either way with the quoting. I think it would
\r
94 be good not to change the text format after it goes into mainline
\r
106 > Taken the other example from Mark's earlyer email:
\r
108 > Bloggs <the king>, Fred <fred@example.com>
\r
110 > echo '^^^' | sed 's/.*</</' would leave only the address part (with <>:s)=
\r
113 > echo '^^^' | sed 's/ <[^<]*$//' would leave only the name part
\r
115 > and regexp '\(.*\) <\(.*\)>' or pcre-compatible /(.*)\s<(.*)>/
\r
116 > would capture name & address parts...
\r
118 > (all of the above untested, though;)
\r
120 > In case instead of 'name <addr>' there is only 'addr', then above
\r
121 > sed lines return the same (full) string and the regexps just don't
\r
124 > There were some suggestions how the text output could be changed on IRC;
\r
125 > if anyone wishes to bring those forward, please do so :D
\r
127 > So, IMO, this issue is not showstopper in this series (if anything is);
\r
128 > patches 1-6 looks good to me on paper, but I have not tested those yet.
\r
132 > (*) echo '^^^' | sed 's/.*<//; s/>.*//' would drop <>'s from first example
\r
136 >> On Fri, Oct 31 2014, Mark Walters wrote:
\r
139 >>> I attach a patch which does the quoting for real names but I don't know
\r
140 >>> if we want it: it changes (example taken from the test suite)
\r
142 >>> Fran=C3=A7ois Boulogne to
\r
144 >>> =3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne
\r
146 >>> (which is what was in the original email)
\r
148 >>> Plausibly the best thing is just to leave the series as is, so the
\r
149 >>> text output is readable and parseable in the common cases.
\r
151 >>> Anyway the patch is attached if anyone wants to experiment.
\r
157 >>> From 53b1ced2d6a9fbbba93448325f795e6b99faa240 Mon Sep 17 00:00:00 2001
\r
158 >>> From: Mark Walters <markwalters1009@gmail.com>
\r
159 >>> Date: Fri, 31 Oct 2014 10:11:40 +0000
\r
160 >>> Subject: [PATCH] search: quote real names for output=3Dsender/recipient=
\r
164 >>> This quotes the real name (when gmime thinks appropriate) for the text
\r
165 >>> output. For the other outputs the real name is separate from the
\r
166 >>> address so the consumer can do any quoting necessary.
\r
168 >>> notmuch-search.c | 8 ++++----
\r
169 >>> test/T090-search-output.sh | 8 ++++----
\r
170 >>> 2 files changed, 8 insertions(+), 8 deletions(-)
\r
172 >>> diff --git a/notmuch-search.c b/notmuch-search.c
\r
173 >>> index eae749a..8eac161 100644
\r
174 >>> --- a/notmuch-search.c
\r
175 >>> +++ b/notmuch-search.c
\r
176 >>> @@ -47,6 +47,7 @@ typedef struct {
\r
177 >>> typedef struct {
\r
178 >>> const char *name;
\r
179 >>> const char *addr;
\r
180 >>> + const char *string;
\r
183 >>> /* Return two stable query strings that identify exactly the matched
\r
184 >>> @@ -255,15 +256,13 @@ print_mailbox (const search_options_t *opt, const=
\r
185 mailbox_t *mailbox)
\r
187 >>> const char *name =3D mailbox->name;
\r
188 >>> const char *addr =3D mailbox->addr;
\r
189 >>> + const char *string =3D mailbox->string;
\r
190 >>> sprinter_t *format =3D opt->format;
\r
192 >>> if (format->is_text_printer) {
\r
193 >>> char *mailbox_str;
\r
195 >>> - if (name && *name)
\r
196 >>> - mailbox_str =3D talloc_asprintf (format, "%s <%s>", name, addr);
\r
198 >>> - mailbox_str =3D talloc_strdup (format, addr);
\r
199 >>> + mailbox_str =3D talloc_strdup (format, string);
\r
201 >>> if (! mailbox_str) {
\r
202 >>> fprintf (stderr, "Error: out of memory\n");
\r
203 >>> @@ -309,6 +308,7 @@ process_address_list (const search_options_t *opt, =
\r
205 >>> mailbox_t mbx =3D {
\r
206 >>> .name =3D internet_address_get_name (address),
\r
207 >>> .addr =3D internet_address_mailbox_get_addr (mailbox),
\r
208 >>> + .string =3D internet_address_to_string (address, TRUE),
\r
210 >> I'd prefer having the second parameter (encode) FALSE. This will still
\r
211 >> add quotes when necessary, but does not encode non-ascii characters so
\r
212 >> the result would be human readable.
\r
214 >> Another question is whether to add .string to mailbox_t. In this patch
\r
215 >> it doesn't matter, but if --output=3Dcount patch will be merged, this
\r
216 >> would mean that memory consumption doubles, because with --output=3Dcount
\r
217 >> the addresses are kept in memory and printed only after the search is
\r
218 >> completed. It would be therefore better to construct a new
\r
219 >> InternetAddressMailbox from name and addr in print_mailbox() and perform
\r
220 >> the conversion to string there. Thoughts?
\r
227 >>> if (is_duplicate (opt, addrs, mbx.name, mbx.addr))
\r
228 >>> diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
\r
229 >>> index 841a721..776e3f4 100755
\r
230 >>> --- a/test/T090-search-output.sh
\r
231 >>> +++ b/test/T090-search-output.sh
\r
232 >>> @@ -390,7 +390,7 @@ test_expect_equal_file OUTPUT EXPECTED
\r
233 >>> test_begin_subtest "--output=3Dsender"
\r
234 >>> notmuch search --output=3Dsender '*' >OUTPUT
\r
235 >>> cat <<EOF >EXPECTED
\r
236 >>> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
237 >>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
238 >>> Olivier Berger <olivier.berger@it-sudparis.eu>
\r
239 >>> Chris Wilson <chris@chris-wilson.co.uk>
\r
240 >>> Carl Worth <cworth@cworth.org>
\r
241 >>> @@ -437,7 +437,7 @@ test_begin_subtest "--output=3Drecipients"
\r
242 >>> notmuch search --output=3Drecipients '*' >OUTPUT
\r
243 >>> cat <<EOF >EXPECTED
\r
244 >>> Allan McRae <allan@archlinux.org>
\r
245 >>> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux=
\r
247 >>> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlin=
\r
249 >>> olivier.berger@it-sudparis.eu
\r
250 >>> notmuch@notmuchmail.org
\r
251 >>> notmuch <notmuch@notmuchmail.org>
\r
252 >>> @@ -449,9 +449,9 @@ test_expect_equal_file OUTPUT EXPECTED
\r
253 >>> test_begin_subtest "--output=3Dsender --output=3Drecipients"
\r
254 >>> notmuch search --output=3Dsender --output=3Drecipients '*' >OUTPUT
\r
255 >>> cat <<EOF >EXPECTED
\r
256 >>> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
257 >>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
258 >>> Allan McRae <allan@archlinux.org>
\r
259 >>> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux=
\r
261 >>> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlin=
\r
263 >>> Olivier Berger <olivier.berger@it-sudparis.eu>
\r
264 >>> olivier.berger@it-sudparis.eu
\r
265 >>> Chris Wilson <chris@chris-wilson.co.uk>
\r
268 >> _______________________________________________
\r
269 >> notmuch mailing list
\r
270 >> notmuch@notmuchmail.org
\r
271 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r