[PATCH 6/8] CLI: refactor dumping of tags.
[notmuch-archives.git] / 89 / f395d80cdf09e2293b3f2228fef16ffd410ce0
1 Return-Path: <prvs=395835c76=jrosenthal@jhu.edu>\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 0B84E431FB6\r
6         for <notmuch@notmuchmail.org>; Fri, 21 Nov 2014 07:47:18 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \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 vxjEbggcTaiw for <notmuch@notmuchmail.org>;\r
16         Fri, 21 Nov 2014 07:47:11 -0800 (PST)\r
17 Received: from smtpauth.johnshopkins.edu (smtpauth.johnshopkins.edu\r
18         [162.129.8.200]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 8E25F431FAE\r
21         for <notmuch@notmuchmail.org>; Fri, 21 Nov 2014 07:47:11 -0800 (PST)\r
22 X-IronPort-AV: E=Sophos;i="5.07,432,1413259200"; d="scan'208";a="448181124"\r
23 Received: from guppy.hwcampus.jhu.edu (HELO localhost) ([10.161.32.234])\r
24         by IPEB3.johnshopkins.edu with ESMTP/TLS/AES128-SHA;\r
25         21 Nov 2014 10:47:09 -0500\r
26 From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: [PATCH 1/2] lib: Use email address instead of empty real name.\r
29 Date: Fri, 21 Nov 2014 10:46:43 -0500\r
30 Message-Id: <1416584803-24018-1-git-send-email-jrosenthal@jhu.edu>\r
31 X-Mailer: git-send-email 2.1.3\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Fri, 21 Nov 2014 15:47:18 -0000\r
45 \r
46 Currently, if a From-header is of the form:\r
47 \r
48     "" <address@example.com>\r
49 \r
50 the empty string will be treated as a valid real-name, and the entry\r
51 in the search results will be empty.\r
52 \r
53 The new behavior here is that we treat an empty real-name field as if\r
54 it were null, so that the email address will be used in the search\r
55 results instead.\r
56 \r
57 Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
58 ---\r
59  lib/thread.cc | 3 ++-\r
60  1 file changed, 2 insertions(+), 1 deletion(-)\r
61 \r
62 diff --git a/lib/thread.cc b/lib/thread.cc\r
63 index 8922403..68b2b94 100644\r
64 --- a/lib/thread.cc\r
65 +++ b/lib/thread.cc\r
66 @@ -277,7 +277,8 @@ _thread_add_message (notmuch_thread_t *thread,\r
67         address = internet_address_list_get_address (list, 0);\r
68         if (address) {\r
69             author = internet_address_get_name (address);\r
70 -           if (author == NULL) {\r
71 +           // We treat quoted empty names as if they were empty.\r
72 +           if (author == NULL || author[0]=='\0' ) {\r
73                 InternetAddressMailbox *mailbox;\r
74                 mailbox = INTERNET_ADDRESS_MAILBOX (address);\r
75                 author = internet_address_mailbox_get_addr (mailbox);\r
76 -- \r
77 2.1.3\r
78 \r
79 \r
80 >From 90fd4673e08fccef95dcc0050bdcac3773d336a9 Mon Sep 17 00:00:00 2001\r
81 From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
82 Date: Fri, 21 Nov 2014 10:24:16 -0500\r
83 Subject: [PATCH 2/2] test: Add test for correct naming of author.\r
84 \r
85 This is a new test file, since handling of unusual email addresses\r
86 doesn't seem to fit well in any of our existing tests.\r
87 \r
88 Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
89 ---\r
90  test/T205-author-naming.sh | 12 ++++++++++++\r
91  1 file changed, 12 insertions(+)\r
92  create mode 100755 test/T205-author-naming.sh\r
93 \r
94 diff --git a/test/T205-author-naming.sh b/test/T205-author-naming.sh\r
95 new file mode 100755\r
96 index 0000000..cb678ae\r
97 --- /dev/null\r
98 +++ b/test/T205-author-naming.sh\r
99 @@ -0,0 +1,12 @@\r
100 +#!/usr/bin/env bash\r
101 +test_description="naming of authors with unusual addresses"\r
102 +. ./test-lib.sh\r
103 +\r
104 +test_begin_subtest "Add author with empty quoted real name"\r
105 +add_message '[subject]="author-naming: Initial thread subject"' \\r
106 +           '[date]="Fri, 05 Jan 2001 15:43:56 -0000"' \\r
107 +           '[from]="\"\" <address@example.com>"'\r
108 +output=$(notmuch search --sort=oldest-first author-naming and tag:inbox | notmuch_search_sanitize)\r
109 +test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] address@example.com; author-naming: Initial thread subject (inbox unread)"\r
110 +\r
111 +test_done\r
112 -- \r
113 2.1.3\r
114 \r