[PATCH 1/2] lib: Use email address instead of empty real name.
authorJesse Rosenthal <jrosenthal@jhu.edu>
Fri, 21 Nov 2014 15:46:43 +0000 (10:46 +1900)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:46:48 +0000 (14:46 -0700)
89/f395d80cdf09e2293b3f2228fef16ffd410ce0 [new file with mode: 0644]

diff --git a/89/f395d80cdf09e2293b3f2228fef16ffd410ce0 b/89/f395d80cdf09e2293b3f2228fef16ffd410ce0
new file mode 100644 (file)
index 0000000..603dbef
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <prvs=395835c76=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 0B84E431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 21 Nov 2014 07:47:18 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[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 vxjEbggcTaiw for <notmuch@notmuchmail.org>;\r
+       Fri, 21 Nov 2014 07:47:11 -0800 (PST)\r
+Received: from smtpauth.johnshopkins.edu (smtpauth.johnshopkins.edu\r
+       [162.129.8.200]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8E25F431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 21 Nov 2014 07:47:11 -0800 (PST)\r
+X-IronPort-AV: E=Sophos;i="5.07,432,1413259200"; d="scan'208";a="448181124"\r
+Received: from guppy.hwcampus.jhu.edu (HELO localhost) ([10.161.32.234])\r
+       by IPEB3.johnshopkins.edu with ESMTP/TLS/AES128-SHA;\r
+       21 Nov 2014 10:47:09 -0500\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] lib: Use email address instead of empty real name.\r
+Date: Fri, 21 Nov 2014 10:46:43 -0500\r
+Message-Id: <1416584803-24018-1-git-send-email-jrosenthal@jhu.edu>\r
+X-Mailer: git-send-email 2.1.3\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, 21 Nov 2014 15:47:18 -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
+ 1 file changed, 2 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/thread.cc b/lib/thread.cc\r
+index 8922403..68b2b94 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
+-- \r
+2.1.3\r
+\r
+\r
+>From 90fd4673e08fccef95dcc0050bdcac3773d336a9 Mon Sep 17 00:00:00 2001\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+Date: Fri, 21 Nov 2014 10:24:16 -0500\r
+Subject: [PATCH 2/2] test: Add test for correct naming of author.\r
+\r
+This is a new test file, since handling of unusual email addresses\r
+doesn't seem to fit well in any of our existing tests.\r
+\r
+Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+---\r
+ test/T205-author-naming.sh | 12 ++++++++++++\r
+ 1 file changed, 12 insertions(+)\r
+ create mode 100755 test/T205-author-naming.sh\r
+\r
+diff --git a/test/T205-author-naming.sh b/test/T205-author-naming.sh\r
+new file mode 100755\r
+index 0000000..cb678ae\r
+--- /dev/null\r
++++ b/test/T205-author-naming.sh\r
+@@ -0,0 +1,12 @@\r
++#!/usr/bin/env bash\r
++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
++add_message '[subject]="author-naming: Initial thread subject"' \\r
++          '[date]="Fri, 05 Jan 2001 15:43:56 -0000"' \\r
++          '[from]="\"\" <address@example.com>"'\r
++output=$(notmuch search --sort=oldest-first author-naming and tag:inbox | notmuch_search_sanitize)\r
++test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] address@example.com; author-naming: Initial thread subject (inbox unread)"\r
++\r
++test_done\r
+-- \r
+2.1.3\r
+\r