Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / ed / e3ca6947451493fac017a49f8582374ecbbc83
1 Return-Path: <novalazy@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1308C431FD0\r
6         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 21:00:24 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id vY3wYX7PR+RK for <notmuch@notmuchmail.org>;\r
17         Sat, 11 Jan 2014 21:00:16 -0800 (PST)\r
18 Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com\r
19         [209.85.220.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id F3A76431FC3\r
22         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 21:00:15 -0800 (PST)\r
23 Received: by mail-pa0-f52.google.com with SMTP id kx10so2498821pab.25\r
24         for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 21:00:14 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id;\r
27         bh=lScT2gNr4j5m5tnAQT9fzWjvIbwWVU4+DR0YvantN6k=;\r
28         b=0HrQSqWII1+4WKIAs0vDfA+oeMa2iSXVDqqkKivI+SEESuhDKRK2q5P/w44UDa4XbK\r
29         Q7zcOVSeZbxqVDBICiBQUqCgzjlMtpYQgtvZNu6GVGEepLL1KMS4RpqN7MT7lC2QEI8U\r
30         TiaqK9pAEgSOBwnBmUJ6gau8E1wuAUoU7j1ogSUunGIF4g0vQ9kNxYOPdqpuVyX/ldFw\r
31         yugUIJ26cQmrlc+/ipGjYm89quYMue9VFoO7Pv/83WHex4j5oaYUKYM1R+f4KETCn+jn\r
32         MbHGE1CsWWOxf2xwD31zv+p3cQyWs13Ksrh9HTZ+xST+5PmCaB+M2xB/x2zg1ZRe5Igi\r
33         Pvdw==\r
34 X-Received: by 10.68.234.67 with SMTP id uc3mr21589381pbc.27.1389502814070;\r
35         Sat, 11 Jan 2014 21:00:14 -0800 (PST)\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
37         [220.233.42.215])\r
38         by mx.google.com with ESMTPSA id sx8sm36257204pab.5.2014.01.11.21.00.11\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
41         Sat, 11 Jan 2014 21:00:12 -0800 (PST)\r
42 From: Peter Wang <novalazy@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH] show: add In-reply-to, References fields to structured\r
45  formats\r
46 Date: Sun, 12 Jan 2014 16:00:00 +1100\r
47 Message-Id: <1389502800-9237-1-git-send-email-novalazy@gmail.com>\r
48 X-Mailer: git-send-email 1.8.4\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sun, 12 Jan 2014 05:00:24 -0000\r
62 \r
63 This is useful when 'show' is used to retrieve a draft message\r
64 which is in reply to another message.\r
65 ---\r
66  devel/schemata      |  9 ++++++++-\r
67  notmuch-show.c      | 16 ++++++++++++----\r
68  test/thread-replies |  7 +++++++\r
69  3 files changed, 27 insertions(+), 5 deletions(-)\r
70 \r
71 diff --git a/devel/schemata b/devel/schemata\r
72 index 41dc4a6..dd41217 100644\r
73 --- a/devel/schemata\r
74 +++ b/devel/schemata\r
75 @@ -14,7 +14,7 @@ are interleaved. Keys are printed as keywords (symbols preceded by a\r
76  colon), e.g. (:id "123" :time 54321 :from "foobar"). Null is printed as\r
77  nil, true as t and false as nil.\r
78  \r
79 -This is version 2 of the structured output format.\r
80 +This is version 3 of the structured output format.\r
81  \r
82  Version history\r
83  ---------------\r
84 @@ -26,6 +26,9 @@ v1\r
85  v2\r
86  - Added the thread_summary.query field.\r
87  \r
88 +v3\r
89 +- Added headers.in-reply-to and headers.references fields.\r
90 +\r
91  Common non-terminals\r
92  --------------------\r
93  \r
94 @@ -105,6 +108,10 @@ headers = {\r
95      Cc?:            string,\r
96      Bcc?:           string,\r
97      Reply-To?:      string,\r
98 +    # Added in schema version 3.\r
99 +    In-reply-to?:   string,\r
100 +    # Added in schema version 3.\r
101 +    References?:    string,\r
102      Date:           string\r
103  }\r
104  \r
105 diff --git a/notmuch-show.c b/notmuch-show.c\r
106 index c07f887..774ba44 100644\r
107 --- a/notmuch-show.c\r
108 +++ b/notmuch-show.c\r
109 @@ -222,6 +222,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,\r
110      InternetAddressList *recipients;\r
111      const char *recipients_string;\r
112      const char *reply_to_string;\r
113 +    const char *in_reply_to_string;\r
114 +    const char *references_string;\r
115  \r
116      sp->begin_map (sp);\r
117  \r
118 @@ -258,13 +260,19 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,\r
119         sp->string (sp, reply_to_string);\r
120      }\r
121  \r
122 -    if (reply) {\r
123 +    in_reply_to_string = g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to");\r
124 +    if (in_reply_to_string || reply) {\r
125         sp->map_key (sp, "In-reply-to");\r
126 -       sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to"));\r
127 +       sp->string (sp, in_reply_to_string);\r
128 +    }\r
129  \r
130 +    references_string = g_mime_object_get_header (GMIME_OBJECT (message), "References");\r
131 +    if (references_string || reply) {\r
132         sp->map_key (sp, "References");\r
133 -       sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "References"));\r
134 -    } else {\r
135 +       sp->string (sp, references_string);\r
136 +    }\r
137 +\r
138 +    if (! reply) {\r
139         sp->map_key (sp, "Date");\r
140         sp->string (sp, g_mime_message_get_date_as_string (message));\r
141      }\r
142 diff --git a/test/thread-replies b/test/thread-replies\r
143 index eeb70d0..9d4b379 100755\r
144 --- a/test/thread-replies\r
145 +++ b/test/thread-replies\r
146 @@ -39,6 +39,8 @@ expected='[[[{"id": "foo@one.com",\r
147   "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one",\r
148   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
149   "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
150 + "In-reply-to": "mumble",\r
151 + "References": "<foo@one.com>",\r
152   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
153   "body": [{"id": 1, "content-type": "text/plain",\r
154   "content": "This is just a test message (#2)\n"}]}, []]]]]]'\r
155 @@ -68,6 +70,8 @@ expected='[[[{"id": "foo@two.com",\r
156   "headers": {"Subject": "Re: two",\r
157   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
158   "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
159 + "In-reply-to": "<bar@baz.com>",\r
160 + "References": "<foo@two.com>",\r
161   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
162   "body": [{"id": 1,\r
163   "content-type": "text/plain", "content": "This is just a test message (#4)\n"}]},\r
164 @@ -95,6 +99,7 @@ expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,\r
165   "headers": {"Subject": "Re: three",\r
166   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
167   "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
168 + "In-reply-to": "<foo@three.com>",\r
169   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,\r
170   "content-type": "text/plain", "content": "This is just a test message (#6)\n"}]},\r
171   []]]]]]'\r
172 @@ -124,6 +129,8 @@ expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,\r
173   "headers": {"Subject": "neither",\r
174   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
175   "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
176 + "In-reply-to": "<baz@four.com>",\r
177 + "References": "<baz@four.com> <foo@four.com>",\r
178   "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,\r
179   "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},\r
180   []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false,\r
181 -- \r
182 1.8.4\r
183 \r