unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jesse Rosenthal <jrosenthal@jhu.edu>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 1/2] lib: Use email address instead of empty real name.
Date: Fri, 21 Nov 2014 10:57:41 -0500	[thread overview]
Message-ID: <1416585462-24558-2-git-send-email-jrosenthal@jhu.edu> (raw)
In-Reply-To: <1416585462-24558-1-git-send-email-jrosenthal@jhu.edu>

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/thread.cc b/lib/thread.cc
index 8922403..68b2b94 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);
-- 
2.1.3

  reply	other threads:[~2014-11-21 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 15:57 [PATCH v2 0/2] Use email address instead of empty real name Jesse Rosenthal
2014-11-21 15:57 ` Jesse Rosenthal [this message]
2014-11-22 11:29   ` [PATCH v2 1/2] lib: " Jani Nikula
2014-11-21 15:57 ` [PATCH v2 2/2] test: Add test for correct naming of author Jesse Rosenthal
2014-11-22 11:31   ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416585462-24558-2-git-send-email-jrosenthal@jhu.edu \
    --to=jrosenthal@jhu.edu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).