* [PATCH v3 0/2] Use email address instead of empty real name.
@ 2014-11-22 13:17 Jesse Rosenthal
2014-11-22 13:17 ` [PATCH v3 1/2] test: Add known-broken test for empty author name Jesse Rosenthal
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jesse Rosenthal @ 2014-11-22 13:17 UTC (permalink / raw)
To: notmuch
This version obsoletes [1].
The changes in this version are:
* Commit test first with known-broken annotation, and then remove
that annotation in the second commit (when the test passes)
* Style fixes in the thread.cc to conform with notmuch style.
[1] id:1416585462-24558-1-git-send-email-jrosenthal@jhu.edu
Jesse Rosenthal (2):
test: Add known-broken test for empty author name
lib: Use email address instead of empty real name.
lib/thread.cc | 3 ++-
test/T205-author-naming.sh | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
create mode 100755 test/T205-author-naming.sh
--
2.1.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] test: Add known-broken test for empty author name
2014-11-22 13:17 [PATCH v3 0/2] Use email address instead of empty real name Jesse Rosenthal
@ 2014-11-22 13:17 ` Jesse Rosenthal
2014-12-07 12:41 ` David Bremner
2014-11-22 13:17 ` [PATCH v3 2/2] lib: Use email address instead of empty real name Jesse Rosenthal
2014-12-06 9:47 ` [PATCH v3 0/2] " Jani Nikula
2 siblings, 1 reply; 5+ messages in thread
From: Jesse Rosenthal @ 2014-11-22 13:17 UTC (permalink / raw)
To: notmuch
We test for whether a quoted empty email address
"" <address@example.com>
will show up as the address, instead of the empty string. This is
marked as known-broken, since the current behavior is to use the empty
string.
This is a new test file, since handling of unusual email addresses
doesn't seem to fit well in any of our existing tests.
Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
---
test/T205-author-naming.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100755 test/T205-author-naming.sh
diff --git a/test/T205-author-naming.sh b/test/T205-author-naming.sh
new file mode 100755
index 0000000..18819dd
--- /dev/null
+++ b/test/T205-author-naming.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+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>"'
+output=$(notmuch search --sort=oldest-first author-naming and tag:inbox | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] address@example.com; author-naming: Initial thread subject (inbox unread)"
+
+test_done
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] lib: Use email address instead of empty real name.
2014-11-22 13:17 [PATCH v3 0/2] Use email address instead of empty real name Jesse Rosenthal
2014-11-22 13:17 ` [PATCH v3 1/2] test: Add known-broken test for empty author name Jesse Rosenthal
@ 2014-11-22 13:17 ` Jesse Rosenthal
2014-12-06 9:47 ` [PATCH v3 0/2] " Jani Nikula
2 siblings, 0 replies; 5+ messages in thread
From: Jesse Rosenthal @ 2014-11-22 13:17 UTC (permalink / raw)
To: notmuch
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 ++-
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]="\"\" <address@example.com>"'
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] Use email address instead of empty real name.
2014-11-22 13:17 [PATCH v3 0/2] Use email address instead of empty real name Jesse Rosenthal
2014-11-22 13:17 ` [PATCH v3 1/2] test: Add known-broken test for empty author name Jesse Rosenthal
2014-11-22 13:17 ` [PATCH v3 2/2] lib: Use email address instead of empty real name Jesse Rosenthal
@ 2014-12-06 9:47 ` Jani Nikula
2 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2014-12-06 9:47 UTC (permalink / raw)
To: Jesse Rosenthal, notmuch
On Sat, 22 Nov 2014, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:
> This version obsoletes [1].
>
> The changes in this version are:
>
> * Commit test first with known-broken annotation, and then remove
> that annotation in the second commit (when the test passes)
>
> * Style fixes in the thread.cc to conform with notmuch style.
LGTM.
>
> [1] id:1416585462-24558-1-git-send-email-jrosenthal@jhu.edu
>
> Jesse Rosenthal (2):
> test: Add known-broken test for empty author name
> lib: Use email address instead of empty real name.
>
> lib/thread.cc | 3 ++-
> test/T205-author-naming.sh | 12 ++++++++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
> create mode 100755 test/T205-author-naming.sh
>
> --
> 2.1.3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-07 12:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-22 13:17 [PATCH v3 0/2] Use email address instead of empty real name Jesse Rosenthal
2014-11-22 13:17 ` [PATCH v3 1/2] test: Add known-broken test for empty author name Jesse Rosenthal
2014-12-07 12:41 ` David Bremner
2014-11-22 13:17 ` [PATCH v3 2/2] lib: Use email address instead of empty real name Jesse Rosenthal
2014-12-06 9:47 ` [PATCH v3 0/2] " Jani Nikula
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).