[PATCH v3 2/2] lib: Use email address instead of empty real name.
authorJesse Rosenthal <jrosenthal@jhu.edu>
Sat, 22 Nov 2014 13:17:16 +0000 (08:17 +1900)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:46:49 +0000 (14:46 -0700)
76/faa8d38ecbee928e5df459e971a865e62b4b94 [new file with mode: 0644]

diff --git a/76/faa8d38ecbee928e5df459e971a865e62b4b94 b/76/faa8d38ecbee928e5df459e971a865e62b4b94
new file mode 100644 (file)
index 0000000..ece53a1
--- /dev/null
@@ -0,0 +1,94 @@
+Return-Path: <prvs=396941042=jrosenthal@jhu.edu>\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 16C0A431FC7\r
+       for <notmuch@notmuchmail.org>; Sat, 22 Nov 2014 06:17:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       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 EgnpXUwT1KZS for <notmuch@notmuchmail.org>;\r
+       Sat, 22 Nov 2014 06:16:59 -0800 (PST)\r
+Received: from smtpauth.johnshopkins.edu (smtpauth.johnshopkins.edu\r
+       [128.220.229.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E1089431FBF\r
+       for <notmuch@notmuchmail.org>; Sat, 22 Nov 2014 06:16:58 -0800 (PST)\r
+X-IronPort-AV: E=Sophos;i="5.07,437,1413259200"; d="scan'208";a="140499136"\r
+Received: from c-69-137-43-192.hsd1.md.comcast.net (HELO localhost)\r
+       ([69.137.43.192])\r
+       by IPMTW4.johnshopkins.edu with ESMTP/TLS/AES128-SHA;\r
+       22 Nov 2014 08:16:57 -0500\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 2/2] lib: Use email address instead of empty real name.\r
+Date: Sat, 22 Nov 2014 08:17:16 -0500\r
+Message-Id: <1416662236-26556-3-git-send-email-jrosenthal@jhu.edu>\r
+X-Mailer: git-send-email 2.1.3\r
+In-Reply-To: <1416662236-26556-1-git-send-email-jrosenthal@jhu.edu>\r
+References: <1416662236-26556-1-git-send-email-jrosenthal@jhu.edu>\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: Sat, 22 Nov 2014 14:17:05 -0000\r
+\r
+Currently, if a From-header is of the form:\r
+\r
+    "" <address@example.com>\r
+\r
+the empty string will be treated as a valid real-name, and the entry\r
+in the search results will be empty.\r
+\r
+The new behavior here is that we treat an empty real-name field as if\r
+it were null, so that the email address will be used in the search\r
+results instead.\r
+\r
+Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+---\r
+ lib/thread.cc              | 3 ++-\r
+ test/T205-author-naming.sh | 1 -\r
+ 2 files changed, 2 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/lib/thread.cc b/lib/thread.cc\r
+index 8922403..79c3e9b 100644\r
+--- a/lib/thread.cc\r
++++ b/lib/thread.cc\r
+@@ -277,7 +277,8 @@ _thread_add_message (notmuch_thread_t *thread,\r
+       address = internet_address_list_get_address (list, 0);\r
+       if (address) {\r
+           author = internet_address_get_name (address);\r
+-          if (author == NULL) {\r
++          /* We treat quoted empty names as if they were empty. */\r
++          if (author == NULL || author[0] == '\0') {\r
+               InternetAddressMailbox *mailbox;\r
+               mailbox = INTERNET_ADDRESS_MAILBOX (address);\r
+               author = internet_address_mailbox_get_addr (mailbox);\r
+diff --git a/test/T205-author-naming.sh b/test/T205-author-naming.sh\r
+index 18819dd..cb678ae 100755\r
+--- a/test/T205-author-naming.sh\r
++++ b/test/T205-author-naming.sh\r
+@@ -3,7 +3,6 @@ test_description="naming of authors with unusual addresses"\r
+ . ./test-lib.sh\r
\r
+ test_begin_subtest "Add author with empty quoted real name"\r
+-test_subtest_known_broken\r
+ add_message '[subject]="author-naming: Initial thread subject"' \\r
+           '[date]="Fri, 05 Jan 2001 15:43:56 -0000"' \\r
+           '[from]="\"\" <address@example.com>"'\r
+-- \r
+2.1.3\r
+\r