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 F29A6431FC2
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 08:32:18 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\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 SovfvLYH09Jo for <notmuch@notmuchmail.org>;
\r
16 Fri, 31 Oct 2014 08:32:13 -0700 (PDT)
\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 B6DA6431FC9
\r
19 for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 08:32:12 -0700 (PDT)
\r
20 Received: from localhost (unknown [192.168.200.7])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id CB1DA5CD0AC;
\r
22 Fri, 31 Oct 2014 16:32:10 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP STYX AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new,
\r
27 with ESMTP id FKIiKX-YlJut; Fri, 31 Oct 2014 16:32:07 +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 145385CCF5E;
\r
30 Fri, 31 Oct 2014 16:32:07 +0100 (CET)
\r
31 Received: from wsh by steelpick.2x.cz with local (Exim 4.84)
\r
32 (envelope-from <sojkam1@fel.cvut.cz>)
\r
33 id 1XkEBF-000245-AA; Fri, 31 Oct 2014 16:32:01 +0100
\r
34 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
35 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
36 Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients
\r
37 In-Reply-To: <8761f0v8v7.fsf@qmul.ac.uk>
\r
38 References: <1414713573-21461-1-git-send-email-sojkam1@fel.cvut.cz>
\r
39 <878ujwvctt.fsf@qmul.ac.uk> <8761f0v8v7.fsf@qmul.ac.uk>
\r
40 User-Agent: Notmuch/0.18.2+157~ga00d359 (http://notmuchmail.org) Emacs/24.3.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Fri, 31 Oct 2014 16:32:01 +0100
\r
43 Message-ID: <87vbn06yry.fsf@steelpick.2x.cz>
\r
45 Content-Type: text/plain; charset=utf-8
\r
46 Content-Transfer-Encoding: quoted-printable
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Fri, 31 Oct 2014 15:32:19 -0000
\r
61 On Fri, Oct 31 2014, Mark Walters wrote:
\r
62 > My only query is in the text output: should the name part be printed as
\r
63 > a quoted string. For example currently I get a line of the form
\r
65 > Bloggs, Fred <fred@example.com>
\r
69 On Fri, Oct 31 2014, Mark Walters wrote:
\r
72 > I attach a patch which does the quoting for real names but I don't know
\r
73 > if we want it: it changes (example taken from the test suite)
\r
75 > Fran=C3=A7ois Boulogne to
\r
77 > =3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne
\r
79 > (which is what was in the original email)
\r
81 > Plausibly the best thing is just to leave the series as is, so the
\r
82 > text output is readable and parseable in the common cases.
\r
84 > Anyway the patch is attached if anyone wants to experiment.
\r
90 > From 53b1ced2d6a9fbbba93448325f795e6b99faa240 Mon Sep 17 00:00:00 2001
\r
91 > From: Mark Walters <markwalters1009@gmail.com>
\r
92 > Date: Fri, 31 Oct 2014 10:11:40 +0000
\r
93 > Subject: [PATCH] search: quote real names for output=3Dsender/recipient i=
\r
97 > This quotes the real name (when gmime thinks appropriate) for the text
\r
98 > output. For the other outputs the real name is separate from the
\r
99 > address so the consumer can do any quoting necessary.
\r
101 > notmuch-search.c | 8 ++++----
\r
102 > test/T090-search-output.sh | 8 ++++----
\r
103 > 2 files changed, 8 insertions(+), 8 deletions(-)
\r
105 > diff --git a/notmuch-search.c b/notmuch-search.c
\r
106 > index eae749a..8eac161 100644
\r
107 > --- a/notmuch-search.c
\r
108 > +++ b/notmuch-search.c
\r
109 > @@ -47,6 +47,7 @@ typedef struct {
\r
111 > const char *name;
\r
112 > const char *addr;
\r
113 > + const char *string;
\r
116 > /* Return two stable query strings that identify exactly the matched
\r
117 > @@ -255,15 +256,13 @@ print_mailbox (const search_options_t *opt, const m=
\r
120 > const char *name =3D mailbox->name;
\r
121 > const char *addr =3D mailbox->addr;
\r
122 > + const char *string =3D mailbox->string;
\r
123 > sprinter_t *format =3D opt->format;
\r
125 > if (format->is_text_printer) {
\r
126 > char *mailbox_str;
\r
128 > - if (name && *name)
\r
129 > - mailbox_str =3D talloc_asprintf (format, "%s <%s>", name, addr);
\r
131 > - mailbox_str =3D talloc_strdup (format, addr);
\r
132 > + mailbox_str =3D talloc_strdup (format, string);
\r
134 > if (! mailbox_str) {
\r
135 > fprintf (stderr, "Error: out of memory\n");
\r
136 > @@ -309,6 +308,7 @@ process_address_list (const search_options_t *opt, GH=
\r
138 > mailbox_t mbx =3D {
\r
139 > .name =3D internet_address_get_name (address),
\r
140 > .addr =3D internet_address_mailbox_get_addr (mailbox),
\r
141 > + .string =3D internet_address_to_string (address, TRUE),
\r
143 I'd prefer having the second parameter (encode) FALSE. This will still
\r
144 add quotes when necessary, but does not encode non-ascii characters so
\r
145 the result would be human readable.
\r
147 Another question is whether to add .string to mailbox_t. In this patch
\r
148 it doesn't matter, but if --output=3Dcount patch will be merged, this
\r
149 would mean that memory consumption doubles, because with --output=3Dcount
\r
150 the addresses are kept in memory and printed only after the search is
\r
151 completed. It would be therefore better to construct a new
\r
152 InternetAddressMailbox from name and addr in print_mailbox() and perform
\r
153 the conversion to string there. Thoughts?
\r
160 > if (is_duplicate (opt, addrs, mbx.name, mbx.addr))
\r
161 > diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
\r
162 > index 841a721..776e3f4 100755
\r
163 > --- a/test/T090-search-output.sh
\r
164 > +++ b/test/T090-search-output.sh
\r
165 > @@ -390,7 +390,7 @@ test_expect_equal_file OUTPUT EXPECTED
\r
166 > test_begin_subtest "--output=3Dsender"
\r
167 > notmuch search --output=3Dsender '*' >OUTPUT
\r
168 > cat <<EOF >EXPECTED
\r
169 > -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
170 > +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
171 > Olivier Berger <olivier.berger@it-sudparis.eu>
\r
172 > Chris Wilson <chris@chris-wilson.co.uk>
\r
173 > Carl Worth <cworth@cworth.org>
\r
174 > @@ -437,7 +437,7 @@ test_begin_subtest "--output=3Drecipients"
\r
175 > notmuch search --output=3Drecipients '*' >OUTPUT
\r
176 > cat <<EOF >EXPECTED
\r
177 > Allan McRae <allan@archlinux.org>
\r
178 > -Discussion about the Arch User Repository (AUR) <aur-general@archlinux.o=
\r
180 > +"Discussion about the Arch User Repository (AUR)" <aur-general@archlinux=
\r
182 > olivier.berger@it-sudparis.eu
\r
183 > notmuch@notmuchmail.org
\r
184 > notmuch <notmuch@notmuchmail.org>
\r
185 > @@ -449,9 +449,9 @@ test_expect_equal_file OUTPUT EXPECTED
\r
186 > test_begin_subtest "--output=3Dsender --output=3Drecipients"
\r
187 > notmuch search --output=3Dsender --output=3Drecipients '*' >OUTPUT
\r
188 > cat <<EOF >EXPECTED
\r
189 > -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>
\r
190 > +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>
\r
191 > Allan McRae <allan@archlinux.org>
\r
192 > -Discussion about the Arch User Repository (AUR) <aur-general@archlinux.o=
\r
194 > +"Discussion about the Arch User Repository (AUR)" <aur-general@archlinux=
\r
196 > Olivier Berger <olivier.berger@it-sudparis.eu>
\r
197 > olivier.berger@it-sudparis.eu
\r
198 > Chris Wilson <chris@chris-wilson.co.uk>
\r