diff options
author | David Bremner <david@tethera.net> | 2014-06-22 06:53:21 -0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-06-22 06:53:21 -0300 |
commit | cc2722ba9e1b2854c5500eb7bb41910478aa8fce (patch) | |
tree | 7130e8abf64aae7e133c262c0079ab2afafda9a1 /lib/index.cc | |
parent | 9e7bc02530caf94f2eff633129b089d4be26f58a (diff) | |
parent | 0c698ef0374b671d3b6a8def2d9c113797ceaec3 (diff) |
Merge branch 'release'
Austin's termpos patches and Felipe's zlib.pc workaround
Diffstat (limited to 'lib/index.cc')
-rw-r--r-- | lib/index.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/index.cc b/lib/index.cc index e1e2a382..1a2e63df 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -231,26 +231,22 @@ _index_address_mailbox (notmuch_message_t *message, InternetAddress *address) { InternetAddressMailbox *mailbox = INTERNET_ADDRESS_MAILBOX (address); - const char *name, *addr; + const char *name, *addr, *combined; void *local = talloc_new (message); name = internet_address_get_name (address); addr = internet_address_mailbox_get_addr (mailbox); - /* In the absence of a name, we'll strip the part before the @ - * from the address. */ - if (! name) { - const char *at; + /* Combine the name and address and index them as a phrase. */ + if (name && addr) + combined = talloc_asprintf (local, "%s %s", name, addr); + else if (name) + combined = name; + else + combined = addr; - at = strchr (addr, '@'); - if (at) - name = talloc_strndup (local, addr, at - addr); - } - - if (name) - _notmuch_message_gen_terms (message, prefix_name, name); - if (addr) - _notmuch_message_gen_terms (message, prefix_name, addr); + if (combined) + _notmuch_message_gen_terms (message, prefix_name, combined); talloc_free (local); } |