1 Return-Path: <amdragon@mit.edu>
\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 47D5F431FC0
\r
6 for <notmuch@notmuchmail.org>; Sat, 23 Jun 2012 08:19:29 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id T5Ib8krcOilx for <notmuch@notmuchmail.org>;
\r
16 Sat, 23 Jun 2012 08:19:28 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 2EB7E431FAF
\r
20 for <notmuch@notmuchmail.org>; Sat, 23 Jun 2012 08:19:28 -0700 (PDT)
\r
21 X-AuditID: 12074425-b7f9b6d0000008c4-df-4fe5de7f20dd
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 97.45.02244.F7ED5EF4; Sat, 23 Jun 2012 11:19:27 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q5NFJQ50010122;
\r
27 Sat, 23 Jun 2012 11:19:27 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q5NFJPiY025537
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Sat, 23 Jun 2012 11:19:26 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1SiS7R-0005JJ-I9; Sat, 23 Jun 2012 11:19:25 -0400
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
39 Subject: Re: [Patch v8 2/6] cli: Let json output "null" messages for non
\r
41 In-Reply-To: <1339842107-10632-3-git-send-email-markwalters1009@gmail.com>
\r
42 References: <1339842107-10632-1-git-send-email-markwalters1009@gmail.com>
\r
43 <1339842107-10632-3-git-send-email-markwalters1009@gmail.com>
\r
44 User-Agent: Notmuch/0.12+132~gf2f390b (http://notmuchmail.org) Emacs/23.3.1
\r
46 Date: Sat, 23 Jun 2012 11:19:25 -0400
\r
47 Message-ID: <87vcii12f6.fsf@awakening.csail.mit.edu>
\r
49 Content-Type: text/plain; charset=us-ascii
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsUixCmqrFt/76m/wauzuhar5/JYXL85k9mB
\r
52 yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyuh6KV6wQKTi5e0VzA2MT/i7GDk5JARMJO59
\r
53 PswCYYtJXLi3nq2LkYtDSGAfo8Tkv23MEM4GRolPLX2MEM5JJonXtzqhMksYJeb+m80E0s8m
\r
54 oCGxbf9yRhBbRMBV4um3z8wgtrBAhMT17dPYuxg5ODgFvCQO7gwECQsJtDNKTFrJCWKLCsRL
\r
55 /OndzAZiswioSmxfeAhsJC/QeWtnT2WDsAUlTs58AnYqs4CWxI1/L5kmMArMQpKahSS1gJFp
\r
56 FaNsSm6Vbm5iZk5xarJucXJiXl5qka6FXm5miV5qSukmRlA4sruo7mCccEjpEKMAB6MSD++r
\r
57 ZU/8hVgTy4orcw8xSnIwKYnyat996i/El5SfUpmRWJwRX1Sak1p8iFGCg1lJhHcqSI43JbGy
\r
58 KrUoHyYlzcGiJM57I+Wmv5BAemJJanZqakFqEUxWhoNDSYL3IUijYFFqempFWmZOCUKaiYMT
\r
59 ZDgP0PD5YMOLCxJzizPTIfKnGBWlxHl3gCQEQBIZpXlwvbB08YpRHOgVYd47IFU8wFQD1/0K
\r
60 aDAT0GBOhscgg0sSEVJSDYxZhuJ555puGgp4TlvLUX/CYJUjy3Km+uCbP6Yx79k3N//8D8+O
\r
61 WS2nTD880rVdX3zmYMrkq62+Mn/Nmc5G26Xq9aeXpG1rO145f5psnEVCmOsJ403tE+PeaKqe
\r
62 yVuy5IqJE9+OjVUBbbI/ejp+cExcoel66GrK4iV3p3WtmTCVV6cvXdHncpwSS3FGoqEWc1Fx
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Sat, 23 Jun 2012 15:19:29 -0000
\r
78 The JSON format change LGTM. This seems like the right way to do this.
\r
80 On Sat, 16 Jun 2012, Mark Walters <markwalters1009@gmail.com> wrote:
\r
81 > All formats except Json can output empty messages for non
\r
82 > entire-thread, but in Json format we output "null" to keep the other
\r
83 > elements (e.g. the replies to the omitted message) in the correct
\r
86 > notmuch-client.h | 1 +
\r
87 > notmuch-show.c | 20 ++++++++++++++++----
\r
88 > 2 files changed, 17 insertions(+), 4 deletions(-)
\r
90 > diff --git a/notmuch-client.h b/notmuch-client.h
\r
91 > index 9b63eae..0c17b79 100644
\r
92 > --- a/notmuch-client.h
\r
93 > +++ b/notmuch-client.h
\r
94 > @@ -75,6 +75,7 @@ typedef struct notmuch_show_format {
\r
95 > const struct notmuch_show_params *params);
\r
96 > const char *message_set_sep;
\r
97 > const char *message_set_end;
\r
98 > + const char *null_message;
\r
99 > } notmuch_show_format_t;
\r
101 > typedef struct notmuch_crypto {
\r
102 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
103 > index 8247f1d..b004468 100644
\r
104 > --- a/notmuch-show.c
\r
105 > +++ b/notmuch-show.c
\r
106 > @@ -37,7 +37,8 @@ static const notmuch_show_format_t format_json = {
\r
107 > .message_set_start = "[",
\r
108 > .part = format_part_json_entry,
\r
109 > .message_set_sep = ", ",
\r
110 > - .message_set_end = "]"
\r
111 > + .message_set_end = "]",
\r
112 > + .null_message = "null"
\r
115 > static notmuch_status_t
\r
116 > @@ -800,6 +801,15 @@ format_part_raw (unused (const void *ctx), mime_node_t *node,
\r
119 > static notmuch_status_t
\r
120 > +show_null_message (const notmuch_show_format_t *format)
\r
122 > + /* Output a null message. Currently empty for all formats except Json */
\r
123 > + if (format->null_message)
\r
124 > + printf ("%s", format->null_message);
\r
125 > + return NOTMUCH_STATUS_SUCCESS;
\r
128 > +static notmuch_status_t
\r
129 > show_message (void *ctx,
\r
130 > const notmuch_show_format_t *format,
\r
131 > notmuch_message_t *message,
\r
132 > @@ -861,11 +871,13 @@ show_messages (void *ctx,
\r
133 > if (status && !res)
\r
135 > next_indent = indent + 1;
\r
137 > - if (!status && format->message_set_sep)
\r
138 > - fputs (format->message_set_sep, stdout);
\r
140 > + status = show_null_message (format);
\r
143 > + if (!status && format->message_set_sep)
\r
144 > + fputs (format->message_set_sep, stdout);
\r
146 > status = show_messages (ctx,
\r
148 > notmuch_message_get_replies (message),
\r
152 > _______________________________________________
\r
153 > notmuch mailing list
\r
154 > notmuch@notmuchmail.org
\r
155 > http://notmuchmail.org/mailman/listinfo/notmuch
\r