--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 27359431FC2\r
+ for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:54:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Rs1k6WqUyvpN for <notmuch@notmuchmail.org>;\r
+ Fri, 31 Oct 2014 09:54:41 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 073CB431FBC\r
+ for <notmuch@notmuchmail.org>; Fri, 31 Oct 2014 09:54:41 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1XkFSr-0003L4-64; Fri, 31 Oct 2014 16:54:37 +0000\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1XkFSq-0004sK-FQ; Fri, 31 Oct 2014 16:54:16 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, Michal Sojka <sojkam1@fel.cvut.cz>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients\r
+In-Reply-To: <m24mukyyoz.fsf@guru.guru-group.fi>\r
+References: <1414713573-21461-1-git-send-email-sojkam1@fel.cvut.cz>\r
+ <878ujwvctt.fsf@qmul.ac.uk> <8761f0v8v7.fsf@qmul.ac.uk>\r
+ <87vbn06yry.fsf@steelpick.2x.cz>\r
+ <m24mukyyoz.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 31 Oct 2014 16:54:14 +0000\r
+Message-ID: <87wq7gtc21.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 6a686411854f60733bdb92bedc9f3a0f (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 31 Oct 2014 16:54:49 -0000\r
+\r
+\r
+On Fri, 31 Oct 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Fri, Oct 31 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
+>\r
+>> On Fri, Oct 31 2014, Mark Walters wrote:\r
+>>> My only query is in the text output: should the name part be printed as\r
+>>> a quoted string. For example currently I get a line of the form\r
+>>>\r
+>>> Bloggs, Fred <fred@example.com>\r
+>>\r
+>> Good point.\r
+>\r
+> There has been some discussion on this issue on IRC channel, and the\r
+> opinion of most (seen so far) is that output the parts without quoting\r
+> (i.e. just like done in this patch series)...\r
+\r
+Just to confirm I am happy either way with the quoting. I think it would\r
+be good not to change the text format after it goes into mainline\r
+though.=20\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+\r
+>\r
+> Taken the other example from Mark's earlyer email:\r
+>\r
+> Bloggs <the king>, Fred <fred@example.com>\r
+>\r
+> echo '^^^' | sed 's/.*</</' would leave only the address part (with <>:s)=\r
+ (*)\r
+>\r
+> echo '^^^' | sed 's/ <[^<]*$//' would leave only the name part\r
+>\r
+> and regexp '\(.*\) <\(.*\)>' or pcre-compatible /(.*)\s<(.*)>/\r
+> would capture name & address parts...\r
+>\r
+> (all of the above untested, though;)\r
+>\r
+> In case instead of 'name <addr>' there is only 'addr', then above\r
+> sed lines return the same (full) string and the regexps just don't\r
+> match.\r
+>\r
+> There were some suggestions how the text output could be changed on IRC;\r
+> if anyone wishes to bring those forward, please do so :D\r
+>\r
+> So, IMO, this issue is not showstopper in this series (if anything is);\r
+> patches 1-6 looks good to me on paper, but I have not tested those yet.\r
+>\r
+> Tomi\r
+>\r
+> (*) echo '^^^' | sed 's/.*<//; s/>.*//' would drop <>'s from first example\r
+>\r
+>\r
+>>\r
+>> On Fri, Oct 31 2014, Mark Walters wrote:\r
+>>> Hi\r
+>>>\r
+>>> I attach a patch which does the quoting for real names but I don't know\r
+>>> if we want it: it changes (example taken from the test suite)\r
+>>>\r
+>>> Fran=C3=A7ois Boulogne to\r
+>>>\r
+>>> =3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne\r
+>>>\r
+>>> (which is what was in the original email)\r
+>>>\r
+>>> Plausibly the best thing is just to leave the series as is, so the\r
+>>> text output is readable and parseable in the common cases.\r
+>>>\r
+>>> Anyway the patch is attached if anyone wants to experiment.\r
+>>>\r
+>>> Best wishes\r
+>>>\r
+>>> Mark\r
+>>>\r
+>>> From 53b1ced2d6a9fbbba93448325f795e6b99faa240 Mon Sep 17 00:00:00 2001\r
+>>> From: Mark Walters <markwalters1009@gmail.com>\r
+>>> Date: Fri, 31 Oct 2014 10:11:40 +0000\r
+>>> Subject: [PATCH] search: quote real names for output=3Dsender/recipient=\r
+ in text\r
+>>> format\r
+>>>\r
+>>> This quotes the real name (when gmime thinks appropriate) for the text\r
+>>> output. For the other outputs the real name is separate from the\r
+>>> address so the consumer can do any quoting necessary.\r
+>>> ---\r
+>>> notmuch-search.c | 8 ++++----\r
+>>> test/T090-search-output.sh | 8 ++++----\r
+>>> 2 files changed, 8 insertions(+), 8 deletions(-)\r
+>>>\r
+>>> diff --git a/notmuch-search.c b/notmuch-search.c\r
+>>> index eae749a..8eac161 100644\r
+>>> --- a/notmuch-search.c\r
+>>> +++ b/notmuch-search.c\r
+>>> @@ -47,6 +47,7 @@ typedef struct {\r
+>>> typedef struct {\r
+>>> const char *name;\r
+>>> const char *addr;\r
+>>> + const char *string;\r
+>>> } mailbox_t;\r
+>>>=20=20\r
+>>> /* Return two stable query strings that identify exactly the matched\r
+>>> @@ -255,15 +256,13 @@ print_mailbox (const search_options_t *opt, const=\r
+ mailbox_t *mailbox)\r
+>>> {\r
+>>> const char *name =3D mailbox->name;\r
+>>> const char *addr =3D mailbox->addr;\r
+>>> + const char *string =3D mailbox->string;\r
+>>> sprinter_t *format =3D opt->format;\r
+>>>=20=20\r
+>>> if (format->is_text_printer) {\r
+>>> char *mailbox_str;\r
+>>>=20=20\r
+>>> - if (name && *name)\r
+>>> - mailbox_str =3D talloc_asprintf (format, "%s <%s>", name, addr);\r
+>>> - else\r
+>>> - mailbox_str =3D talloc_strdup (format, addr);\r
+>>> + mailbox_str =3D talloc_strdup (format, string);\r
+>>>=20=20\r
+>>> if (! mailbox_str) {\r
+>>> fprintf (stderr, "Error: out of memory\n");\r
+>>> @@ -309,6 +308,7 @@ process_address_list (const search_options_t *opt, =\r
+GHashTable *addrs,\r
+>>> mailbox_t mbx =3D {\r
+>>> .name =3D internet_address_get_name (address),\r
+>>> .addr =3D internet_address_mailbox_get_addr (mailbox),\r
+>>> + .string =3D internet_address_to_string (address, TRUE),\r
+>>\r
+>> I'd prefer having the second parameter (encode) FALSE. This will still\r
+>> add quotes when necessary, but does not encode non-ascii characters so\r
+>> the result would be human readable.\r
+>>\r
+>> Another question is whether to add .string to mailbox_t. In this patch\r
+>> it doesn't matter, but if --output=3Dcount patch will be merged, this\r
+>> would mean that memory consumption doubles, because with --output=3Dcount\r
+>> the addresses are kept in memory and printed only after the search is\r
+>> completed. It would be therefore better to construct a new\r
+>> InternetAddressMailbox from name and addr in print_mailbox() and perform\r
+>> the conversion to string there. Thoughts?\r
+>>\r
+>> Thanks,\r
+>> -Michal\r
+>>\r
+>>> };\r
+>>>=20=20\r
+>>> if (is_duplicate (opt, addrs, mbx.name, mbx.addr))\r
+>>> diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh\r
+>>> index 841a721..776e3f4 100755\r
+>>> --- a/test/T090-search-output.sh\r
+>>> +++ b/test/T090-search-output.sh\r
+>>> @@ -390,7 +390,7 @@ test_expect_equal_file OUTPUT EXPECTED\r
+>>> test_begin_subtest "--output=3Dsender"\r
+>>> notmuch search --output=3Dsender '*' >OUTPUT\r
+>>> cat <<EOF >EXPECTED\r
+>>> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>\r
+>>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>\r
+>>> Olivier Berger <olivier.berger@it-sudparis.eu>\r
+>>> Chris Wilson <chris@chris-wilson.co.uk>\r
+>>> Carl Worth <cworth@cworth.org>\r
+>>> @@ -437,7 +437,7 @@ test_begin_subtest "--output=3Drecipients"\r
+>>> notmuch search --output=3Drecipients '*' >OUTPUT\r
+>>> cat <<EOF >EXPECTED\r
+>>> Allan McRae <allan@archlinux.org>\r
+>>> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux=\r
+.org>\r
+>>> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlin=\r
+ux.org>\r
+>>> olivier.berger@it-sudparis.eu\r
+>>> notmuch@notmuchmail.org\r
+>>> notmuch <notmuch@notmuchmail.org>\r
+>>> @@ -449,9 +449,9 @@ test_expect_equal_file OUTPUT EXPECTED\r
+>>> test_begin_subtest "--output=3Dsender --output=3Drecipients"\r
+>>> notmuch search --output=3Dsender --output=3Drecipients '*' >OUTPUT\r
+>>> cat <<EOF >EXPECTED\r
+>>> -Fran=C3=A7ois Boulogne <boulogne.f@gmail.com>\r
+>>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne <boulogne.f@gmail.com>\r
+>>> Allan McRae <allan@archlinux.org>\r
+>>> -Discussion about the Arch User Repository (AUR) <aur-general@archlinux=\r
+.org>\r
+>>> +"Discussion about the Arch User Repository (AUR)" <aur-general@archlin=\r
+ux.org>\r
+>>> Olivier Berger <olivier.berger@it-sudparis.eu>\r
+>>> olivier.berger@it-sudparis.eu\r
+>>> Chris Wilson <chris@chris-wilson.co.uk>\r
+>>> --=20\r
+>>> 1.7.10.4\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r