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