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