lib: Use email address instead of empty real name.
authorJesse Rosenthal <jrosenthal@jhu.edu>
Sat, 22 Nov 2014 13:17:16 +0000 (08:17 -0500)
committerDavid Bremner <david@tethera.net>
Sun, 7 Dec 2014 12:36:08 +0000 (13:36 +0100)
Currently, if a From-header is of the form:

    "" <address@example.com>

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 <jrosenthal@jhu.edu>
lib/thread.cc
test/T205-author-naming.sh

index 8922403ea4b10c09d0982778245c69c583de7bf1..79c3e9bb5d463e84b3466c76ab307dddf013c19e 100644 (file)
@@ -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);
index 18819ddbc0df0da13b2905d8dc1e826401be0dfc..cb678ae83856bacab1c447350952332574a250cb 100755 (executable)
@@ -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]="\"\" <address@example.com>"'