--- /dev/null
+Return-Path: <jani@nikula.org>\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 3EF51431E84\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Jan 2014 07:31:47 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 wQ2HW6eUSwgx for <notmuch@notmuchmail.org>;\r
+ Sun, 12 Jan 2014 07:31:39 -0800 (PST)\r
+Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com\r
+ [74.125.83.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 46815431FAE for <notmuch@notmuchmail.org>; Sun, 12 Jan 2014 07:31:39 -0800\r
+ (PST)\r
+Received: by mail-ee0-f46.google.com with SMTP id d49so2717706eek.33\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Jan 2014 07:31:36 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=3DWeqNY4j2Iv7/PRSIMt4miWpI2bN2eusfR7Rhmahc4=;\r
+ b=CxIOebTk5zz5Ruorv24Qwc2yhYv5ynaVYh13QGKeJl0W47lFZYhUkJnOZ+aE1teZVu\r
+ xpRzxoIul4aqZ0OM0oerV+HMQ4bw1tJ+G+r7q6CC7PsuaGnNKpqeoMdnt3PTQu5JKdWx\r
+ eJXlVHU54IVA0nVBeeRvZ6Q4iA2mpIuUeXSEpUe4xJjsYTxkBkJnnPgOboj1IoAe2JFx\r
+ CP6ItONswvyPqggKdLgEstP16ta+b9vqq4pZcRk75hhWYwrLnDCRf5fa8lnjc3HU3uYX\r
+ 1FIvbgW04vJORCm6fjVK70BWgesdN5fEHZ2HpZrmJHDsgpsKfJmbfuGNO/9vEOv44FJ5\r
+ 20uQ==\r
+X-Gm-Message-State:\r
+ ALoCoQmH5Mi8TaNXE3vQleQ258wOxfHa3S/7KKvaKZh0DTFZlXaIKdBN5X9PeV9Ou3fg55W81kXg\r
+X-Received: by 10.14.53.65 with SMTP id f41mr3482481eec.105.1389540695329;\r
+ Sun, 12 Jan 2014 07:31:35 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id l4sm31869006een.13.2014.01.12.07.31.33\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sun, 12 Jan 2014 07:31:34 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] show: add In-reply-to,\r
+ References fields to structured formats\r
+In-Reply-To: <1389502800-9237-1-git-send-email-novalazy@gmail.com>\r
+References: <1389502800-9237-1-git-send-email-novalazy@gmail.com>\r
+User-Agent: Notmuch/0.17~rc2+18~g39a67a6 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 12 Jan 2014 17:31:32 +0200\r
+Message-ID: <878uulush7.fsf@nikula.org>\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: Sun, 12 Jan 2014 15:31:47 -0000\r
+\r
+On Sun, 12 Jan 2014, Peter Wang <novalazy@gmail.com> wrote:\r
+> This is useful when 'show' is used to retrieve a draft message\r
+> which is in reply to another message.\r
+\r
+I'd like to know more about *how* this is useful. Indeed the whole big\r
+picture about supporting draft or postponed messages is foggy. I would\r
+like to have some clarity about that first.\r
+\r
+Apparently the idea is to index draft messages. How do you save them?\r
+What guarantees are there that they look enough like real messages that\r
+they get indexed? Does this patch mean that the idea is to resume draft\r
+messages using the structured formats instead of opening the raw file?\r
+Why? What do you plan to do with the saved draft? And so on...\r
+\r
+BR,\r
+Jani.\r
+\r
+> ---\r
+> devel/schemata | 9 ++++++++-\r
+> notmuch-show.c | 16 ++++++++++++----\r
+> test/thread-replies | 7 +++++++\r
+> 3 files changed, 27 insertions(+), 5 deletions(-)\r
+>\r
+> diff --git a/devel/schemata b/devel/schemata\r
+> index 41dc4a6..dd41217 100644\r
+> --- a/devel/schemata\r
+> +++ b/devel/schemata\r
+> @@ -14,7 +14,7 @@ are interleaved. Keys are printed as keywords (symbols preceded by a\r
+> colon), e.g. (:id "123" :time 54321 :from "foobar"). Null is printed as\r
+> nil, true as t and false as nil.\r
+> \r
+> -This is version 2 of the structured output format.\r
+> +This is version 3 of the structured output format.\r
+> \r
+> Version history\r
+> ---------------\r
+> @@ -26,6 +26,9 @@ v1\r
+> v2\r
+> - Added the thread_summary.query field.\r
+> \r
+> +v3\r
+> +- Added headers.in-reply-to and headers.references fields.\r
+> +\r
+> Common non-terminals\r
+> --------------------\r
+> \r
+> @@ -105,6 +108,10 @@ headers = {\r
+> Cc?: string,\r
+> Bcc?: string,\r
+> Reply-To?: string,\r
+> + # Added in schema version 3.\r
+> + In-reply-to?: string,\r
+> + # Added in schema version 3.\r
+> + References?: string,\r
+> Date: string\r
+> }\r
+> \r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index c07f887..774ba44 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -222,6 +222,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,\r
+> InternetAddressList *recipients;\r
+> const char *recipients_string;\r
+> const char *reply_to_string;\r
+> + const char *in_reply_to_string;\r
+> + const char *references_string;\r
+> \r
+> sp->begin_map (sp);\r
+> \r
+> @@ -258,13 +260,19 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,\r
+> sp->string (sp, reply_to_string);\r
+> }\r
+> \r
+> - if (reply) {\r
+> + in_reply_to_string = g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to");\r
+> + if (in_reply_to_string || 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
+> + sp->string (sp, in_reply_to_string);\r
+> + }\r
+> \r
+> + references_string = g_mime_object_get_header (GMIME_OBJECT (message), "References");\r
+> + if (references_string || reply) {\r
+> sp->map_key (sp, "References");\r
+> - sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "References"));\r
+> - } else {\r
+> + sp->string (sp, references_string);\r
+> + }\r
+> +\r
+> + if (! reply) {\r
+> sp->map_key (sp, "Date");\r
+> sp->string (sp, g_mime_message_get_date_as_string (message));\r
+> }\r
+> diff --git a/test/thread-replies b/test/thread-replies\r
+> index eeb70d0..9d4b379 100755\r
+> --- a/test/thread-replies\r
+> +++ b/test/thread-replies\r
+> @@ -39,6 +39,8 @@ expected='[[[{"id": "foo@one.com",\r
+> "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one",\r
+> "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> + "In-reply-to": "mumble",\r
+> + "References": "<foo@one.com>",\r
+> "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
+> "body": [{"id": 1, "content-type": "text/plain",\r
+> "content": "This is just a test message (#2)\n"}]}, []]]]]]'\r
+> @@ -68,6 +70,8 @@ expected='[[[{"id": "foo@two.com",\r
+> "headers": {"Subject": "Re: two",\r
+> "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> + "In-reply-to": "<bar@baz.com>",\r
+> + "References": "<foo@two.com>",\r
+> "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
+> "body": [{"id": 1,\r
+> "content-type": "text/plain", "content": "This is just a test message (#4)\n"}]},\r
+> @@ -95,6 +99,7 @@ expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,\r
+> "headers": {"Subject": "Re: three",\r
+> "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> + "In-reply-to": "<foo@three.com>",\r
+> "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,\r
+> "content-type": "text/plain", "content": "This is just a test message (#6)\n"}]},\r
+> []]]]]]'\r
+> @@ -124,6 +129,8 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,\r
+> "headers": {"Subject": "neither",\r
+> "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+> + "In-reply-to": "<baz@four.com>",\r
+> + "References": "<baz@four.com> <foo@four.com>",\r
+> "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,\r
+> "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},\r
+> []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false,\r
+> -- \r
+> 1.8.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r