show: Use consistent header ordering in the text format

Previously, top-level message headers were printed as Subject, From,
To, Date, while embedded message headers were printed From, To,
Subject, Date.  This makes both cases use the former order and updates
the tests accordingly.

Strangely, the raw format also uses this function, so this also fixes
the two raw format tests affected by this change.
This commit is contained in:
Austin Clements 2012-01-22 21:31:12 -05:00 committed by David Bremner
parent 80771e3c76
commit 0bd09f8446
2 changed files with 7 additions and 7 deletions

View file

@ -364,6 +364,7 @@ format_headers_message_part_text (GMimeMessage *message)
InternetAddressList *recipients; InternetAddressList *recipients;
const char *recipients_string; const char *recipients_string;
printf ("Subject: %s\n", g_mime_message_get_subject (message));
printf ("From: %s\n", g_mime_message_get_sender (message)); printf ("From: %s\n", g_mime_message_get_sender (message));
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO); recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
recipients_string = internet_address_list_to_string (recipients, 0); recipients_string = internet_address_list_to_string (recipients, 0);
@ -375,7 +376,6 @@ format_headers_message_part_text (GMimeMessage *message)
if (recipients_string) if (recipients_string)
printf ("Cc: %s\n", printf ("Cc: %s\n",
recipients_string); recipients_string);
printf ("Subject: %s\n", g_mime_message_get_subject (message));
printf ("Date: %s\n", g_mime_message_get_date_as_string (message)); printf ("Date: %s\n", g_mime_message_get_date_as_string (message));
} }

View file

@ -121,9 +121,9 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
part{ ID: 2, Content-type: multipart/mixed part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822 part{ ID: 3, Content-type: message/rfc822
header{ header{
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
header} header}
body{ body{
@ -162,9 +162,9 @@ cat <<EOF >EXPECTED
part{ ID: 2, Content-type: multipart/mixed part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822 part{ ID: 3, Content-type: message/rfc822
header{ header{
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
header} header}
body{ body{
@ -200,9 +200,9 @@ cat <<EOF >EXPECTED
part{ ID: 2, Content-type: multipart/mixed part{ ID: 2, Content-type: multipart/mixed
part{ ID: 3, Content-type: message/rfc822 part{ ID: 3, Content-type: message/rfc822
header{ header{
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
header} header}
body{ body{
@ -233,9 +233,9 @@ notmuch show --format=text --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OU
cat <<EOF >EXPECTED cat <<EOF >EXPECTED
part{ ID: 3, Content-type: message/rfc822 part{ ID: 3, Content-type: message/rfc822
header{ header{
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
header} header}
body{ body{
@ -452,9 +452,9 @@ notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
# output should *not* include newline # output should *not* include newline
echo >>OUTPUT echo >>OUTPUT
cat <<EOF >EXPECTED cat <<EOF >EXPECTED
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
<p>This is an embedded message, with a multipart/alternative part.</p> <p>This is an embedded message, with a multipart/alternative part.</p>
@ -476,9 +476,9 @@ test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest "--format=raw --part=2, multipart/mixed" test_begin_subtest "--format=raw --part=2, multipart/mixed"
notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT notmuch show --format=raw --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
cat <<EOF >EXPECTED cat <<EOF >EXPECTED
Subject: html message
From: Carl Worth <cworth@cworth.org> From: Carl Worth <cworth@cworth.org>
To: cworth@cworth.org To: cworth@cworth.org
Subject: html message
Date: Fri, 05 Jan 2001 15:42:57 +0000 Date: Fri, 05 Jan 2001 15:42:57 +0000
<p>This is an embedded message, with a multipart/alternative part.</p> <p>This is an embedded message, with a multipart/alternative part.</p>