--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 62A3B431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 7 Sep 2012 04:52:57 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id UWru7xwLO2xY for <notmuch@notmuchmail.org>;\r
+ Fri, 7 Sep 2012 04:52:56 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id 32DB0431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 7 Sep 2012 04:52:56 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id CADCA19F32E0;\r
+ Fri, 7 Sep 2012 13:52:50 +0200 (CEST)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+ by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+ port 10044)\r
+ with ESMTP id iF4H32WDSwLn; Fri, 7 Sep 2012 13:52:49 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 1F49619F32DA;\r
+ Fri, 7 Sep 2012 13:52:49 +0200 (CEST)\r
+Received: from steelpick.2x.cz (note-sojka.felk.cvut.cz [147.32.86.30])\r
+ (Authenticated sender: sojkam1)\r
+ by imap.feld.cvut.cz (Postfix) with ESMTPSA id 257CF660968;\r
+ Fri, 7 Sep 2012 13:52:48 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.80)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1T9x7A-0002Qo-3k; Fri, 07 Sep 2012 13:52:48 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: Michal Nazarewicz <mpn@google.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] notmuch-show: include Bcc header in json output\r
+In-Reply-To:\r
+ <821b9893f8b26cfe624568015c52c5b7753a9eac.1346944540.git.mina86@mina86.com>\r
+References:\r
+ <e07afdc98fd9517fba3060970b1150cef4d7ac80.1346881123.git.mina86@mina86.com>\r
+ <821b9893f8b26cfe624568015c52c5b7753a9eac.1346944540.git.mina86@mina86.com>\r
+User-Agent: Notmuch/0.14+23~g9d68aca (http://notmuchmail.org) Emacs/24.1.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 07 Sep 2012 13:52:48 +0200\r
+Message-ID: <87pq5yaw33.fsf@steelpick.2x.cz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 07 Sep 2012 11:52:57 -0000\r
+\r
+On Thu, Sep 06 2012, Michal Nazarewicz wrote:\r
+> From: Michal Nazarewicz <mina86@mina86.com>\r
+>\r
+> ---\r
+> notmuch-show.c | 7 +++++++\r
+> test/json | 8 ++++----\r
+> test/test-lib.sh | 5 +++++\r
+> 3 files changed, 16 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index 3556293..0b7abf1 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -233,6 +233,13 @@ format_headers_json (sprinter_t *sp, GMimeMessage *message,\r
+> sp->string (sp, recipients_string);\r
+> }\r
+> \r
+> + recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_BCC);\r
+> + recipients_string = internet_address_list_to_string (recipients, 0);\r
+> + if (recipients_string) {\r
+> + sp->map_key (sp, "Bcc");\r
+> + sp->string (sp, recipients_string);\r
+> + }\r
+> +\r
+> if (reply) {\r
+> sp->map_key (sp, "In-reply-to");\r
+> sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to"));\r
+> diff --git a/test/json b/test/json\r
+> index ac8fa8e..40d0ba3 100755\r
+> --- a/test/json\r
+> +++ b/test/json\r
+> @@ -3,18 +3,18 @@ test_description="--format=json output"\r
+> . ./test-lib.sh\r
+> \r
+> test_begin_subtest "Show message: json"\r
+> -add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-show-message\""\r
+> +add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[body]=\"json-show-message\""\r
+> output=$(notmuch show --format=json "json-show-message")\r
+> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
+> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
+> \r
+> # This should be the same output as above.\r
+> test_begin_subtest "Show message: json --body=true"\r
+> output=$(notmuch show --format=json --body=true "json-show-message")\r
+> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
+> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
+> \r
+> test_begin_subtest "Show message: json --body=false"\r
+> output=$(notmuch show --format=json --body=false "json-show-message")\r
+> -test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"\r
+> +test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Bcc\": \"test_suite+bcc@notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}}, []]]]"\r
+> \r
+> test_begin_subtest "Search message: json"\r
+> add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""\r
+> diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+> index f34b1fb..e14203d 100644\r
+> --- a/test/test-lib.sh\r
+> +++ b/test/test-lib.sh\r
+> @@ -350,6 +350,11 @@ ${additional_headers}"\r
+> ${additional_headers}"\r
+> fi\r
+> \r
+> + if [ ! -z "${template[bcc]}" ]; then\r
+> + additional_headers="Bcc: ${template[bcc]}\r
+> +${additional_headers}"\r
+> + fi\r
+> +\r
+> if [ ! -z "${template[references]}" ]; then\r
+> additional_headers="References: ${template[references]}\r
+> ${additional_headers}"\r
+> -- \r
+> 1.7.7.3\r
+\r
+LGTM\r
+\r
+It's good that you left there a few tests without bcc header so that we\r
+have covered both cases.\r
+\r
+-Michal\r