On Sun, 12 Jan 2014, Peter Wang <[email protected]> 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": "[email protected]",
>   "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one",
>   "From": "Notmuch Test Suite <[email protected]>",
>   "To": "Notmuch Test Suite <[email protected]>",
> + "In-reply-to": "mumble",
> + "References": "<[email protected]>",
>   "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": "[email protected]",
>   "headers": {"Subject": "Re: two",
>   "From": "Notmuch Test Suite <[email protected]>",
>   "To": "Notmuch Test Suite <[email protected]>",
> + "In-reply-to": "<[email protected]>",
> + "References": "<[email protected]>",
>   "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": "[email protected]", "match": true, 
> "excluded": false,
>   "headers": {"Subject": "Re: three",
>   "From": "Notmuch Test Suite <[email protected]>",
>   "To": "Notmuch Test Suite <[email protected]>",
> + "In-reply-to": "<[email protected]>",
>   "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": "[email protected]", "match": true, 
> "excluded": false,
>   "headers": {"Subject": "neither",
>   "From": "Notmuch Test Suite <[email protected]>",
>   "To": "Notmuch Test Suite <[email protected]>",
> + "In-reply-to": "<[email protected]>",
> + "References": "<[email protected]> <[email protected]>",
>   "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": "[email protected]", "match": true, "excluded": false,
> -- 
> 1.8.4
>
> _______________________________________________
> notmuch mailing list
> [email protected]
> http://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to