Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1F327429E3A for ; Tue, 14 Feb 2012 09:34:05 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ymoLpM+Pn7D for ; Tue, 14 Feb 2012 09:34:02 -0800 (PST) Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU [18.9.25.12]) by olra.theworths.org (Postfix) with ESMTP id 30712429E30 for ; Tue, 14 Feb 2012 09:33:59 -0800 (PST) X-AuditID: 1209190c-b7fad6d000000920-71-4f3a9b06e139 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id E8.36.02336.60B9A3F4; Tue, 14 Feb 2012 12:33:58 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q1EHXvBg023237; Tue, 14 Feb 2012 12:33:57 -0500 Received: from drake.mit.edu (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1EHXuph016501 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 14 Feb 2012 12:33:57 -0500 (EST) Received: from amthrax by drake.mit.edu with local (Exim 4.77) (envelope-from ) id 1RxMGK-00027B-5m; Tue, 14 Feb 2012 12:33:56 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 3/8] show: Use consistent header ordering in the JSON format Date: Tue, 14 Feb 2012 12:33:38 -0500 Message-Id: <1329240823-7856-4-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1329240823-7856-1-git-send-email-amdragon@mit.edu> References: <1329240823-7856-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixCmqrcs228rf4NRLdYsje2axW1zd2s9u cf3mTGYHZo+ds+6yezxbdYvZo+nHYtYA5igum5TUnMyy1CJ9uwSujA+HfAqeaVYsX76ItYHx g3IXIyeHhICJxMkLc5ggbDGJC/fWs3UxcnEICexjlJj88AI7hLOBUWLW1dWsEM59Jok7y18z QjjzGSW2NV9hA+lnE9CQ2LZ/OSOILSIgLbHz7mxWEJtZIF7iSNt6sLiwgI/Ekocv2EFsFgFV iYt988DivAL2EruPXGGHuENB4tzqc2A2p4CDxP59/8HmCAHVXLq7lWUCI/8CRoZVjLIpuVW6 uYmZOcWpybrFyYl5ealFuoZ6uZkleqkppZsYweElybOD8c1BpUOMAhyMSjy8BhaW/kKsiWXF lbmHGCU5mJREeYVnWPkL8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuHdNB0ox5uSWFmVWpQPk5Lm YFES51XReucnJJCeWJKanZpakFoEk5Xh4FCS4E2aBdQoWJSanlqRlplTgpBm4uAEGc4DNDwZ pIa3uCAxtzgzHSJ/ilFRSpzXAyQhAJLIKM2D64XF/ytGcaBXhHmDQKp4gKkDrvsV0GAmoMHb T1uADC5JREhJNTCa8/e/bxcOdH5XxrS0+lH9lL0/Z2TMa9d+bbSuzDT6j+nj3ztE/x4+5H9y X3uKwom1JRo7F+iqPVjrPKdZ0XDqh+VPVzPfypM757x1/hrfDf8XLD1YWlfHUH7RM/uZ4eSL +meYlxld+Hjt2VEGux7m7FxFB4uX5dwTxF7rOD46yf+SoebiymfWSizFGYmGWsxFxYkA8Jhu U9oCAAA= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 17:34:05 -0000 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. --- notmuch-show.c | 6 +++--- test/multipart | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 868b2cd..9ca9882 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -328,6 +328,9 @@ format_headers_message_part_json (GMimeMessage *message) const char *recipients_string; printf ("%s: %s", + json_quote_str (ctx_quote, "Subject"), + json_quote_str (ctx_quote, g_mime_message_get_subject (message))); + printf (", %s: %s", json_quote_str (ctx_quote, "From"), json_quote_str (ctx_quote, g_mime_message_get_sender (message))); recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO); @@ -343,9 +346,6 @@ format_headers_message_part_json (GMimeMessage *message) json_quote_str (ctx_quote, "Cc"), json_quote_str (ctx_quote, recipients_string)); printf (", %s: %s", - json_quote_str (ctx_quote, "Subject"), - json_quote_str (ctx_quote, g_mime_message_get_subject (message))); - printf (", %s: %s", json_quote_str (ctx_quote, "Date"), json_quote_str (ctx_quote, g_mime_message_get_date_as_string (message))); diff --git a/test/multipart b/test/multipart index 2dd73f5..4d14804 100755 --- a/test/multipart +++ b/test/multipart @@ -325,7 +325,7 @@ cat <EXPECTED {"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ {"id": 1, "content-type": "multipart/signed", "content": [ {"id": 2, "content-type": "multipart/mixed", "content": [ -{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth ", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ {"id": 4, "content-type": "multipart/alternative", "content": [ {"id": 5, "content-type": "text/html"}, {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, @@ -342,7 +342,7 @@ cat <EXPECTED {"id": 1, "content-type": "multipart/signed", "content": [ {"id": 2, "content-type": "multipart/mixed", "content": [ -{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth ", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ {"id": 4, "content-type": "multipart/alternative", "content": [ {"id": 5, "content-type": "text/html"}, {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, @@ -358,7 +358,7 @@ echo >>OUTPUT # expect *no* newline at end of output cat <EXPECTED {"id": 2, "content-type": "multipart/mixed", "content": [ -{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth ", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ {"id": 4, "content-type": "multipart/alternative", "content": [ {"id": 5, "content-type": "text/html"}, {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, @@ -372,7 +372,7 @@ notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | s echo >>OUTPUT # expect *no* newline at end of output cat <EXPECTED -{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"From": "Carl Worth ", "To": "cworth@cworth.org", "Subject": "html message", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +{"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ {"id": 4, "content-type": "multipart/alternative", "content": [ {"id": 5, "content-type": "text/html"}, {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]} -- 1.7.7.3