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 A8986431FAE
\r
6 for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:26 -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 sLQN313KXklS for <notmuch@notmuchmail.org>;
\r
16 Fri, 27 Jul 2012 21:29:25 -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 63907431FB6
\r
20 for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:25 -0700 (PDT)
\r
21 X-AuditID: 12074425-b7f9b6d0000008c4-8f-50136aa4e5f9
\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 95.70.02244.4AA63105; Sat, 28 Jul 2012 00:29:24 -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 q6S4TNF4017242;
\r
27 Sat, 28 Jul 2012 00:29:23 -0400
\r
28 Received: from drake.dyndns.org
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6S4TL3V027362
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 28 Jul 2012 00:29:22 -0400 (EDT)
\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
36 (envelope-from <amdragon@mit.edu>)
\r
37 id 1SuyeW-0002XD-T4; Sat, 28 Jul 2012 00:29:20 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v2 11/13] show: Convert show_message to use sprinter
\r
41 Date: Sat, 28 Jul 2012 00:29:12 -0400
\r
42 Message-Id: <1343449754-9010-12-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10
\r
44 In-Reply-To: <1343449754-9010-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1343449754-9010-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsUixCmqrLskSzjA4NtqbYu9De2MFqvn8lhc
\r
48 vzmT2eLNynmsDiweO2fdZfdYvGk/m8fhrwtZPJ6tusUcwBLFZZOSmpNZllqkb5fAlfHg3mWm
\r
49 gi6RimNrbrE1MD7l72Lk5JAQMJE4MOkPO4QtJnHh3nq2LkYuDiGBfYwSK86eYIZwNjBKnOhY
\r
50 AJV5xCTRu3wzI4Qzl1Fi2qc9rCD9bAIaEtv2L2cEsUUEpCV23p0NFOfgYBbIk3i8VgIkLCzg
\r
51 IrFo6mMWEJtFQFXiw7dVYK28Ag4St08fYoU4Q17i6f0+NhCbEyi++eUHZhBbSMBeYvfkDawT
\r
52 GPkXMDKsYpRNya3SzU3MzClOTdYtTk7My0st0rXQy80s0UtNKd3ECAo4dhfVHYwTDikdYhTg
\r
53 YFTi4T11RShAiDWxrLgy9xCjJAeTkihvVLhwgBBfUn5KZUZicUZ8UWlOavEhRgkOZiUR3p2C
\r
54 QDnelMTKqtSifJiUNAeLkjjvjZSb/kIC6YklqdmpqQWpRTBZGQ4OJQne7ZlAjYJFqempFWmZ
\r
55 OSUIaSYOTpDhPEDD14DU8BYXJOYWZ6ZD5E8xKkqJ804CSQiAJDJK8+B6YQnhFaM40CvCvNdA
\r
56 qniAyQSu+xXQYCagwRbRQiCDSxIRUlINjBUpeeurrh8M38qTGSb+rcy8Zlftyp079lz9JH2K
\r
57 d9Jzxh2cNk9fbfn0wP96wO6yKz/vcpbeXOmh/iE/4oYGR3jG/4U5fS9WMl5i141a25x1VWmb
\r
58 lWoyZ4H+P/0Hx0xmuRxvKZ38xid/8oNZz9I1v09q0bqf5zbDjbfmh7jJ0hk8m3b/fTpt5U8l
\r
59 luKMREMt5qLiRADlxulU4wIAAA==
\r
60 Cc: tomi.ollila@iki.fi
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Sat, 28 Jul 2012 04:29:27 -0000
\r
75 Unlike the previous patches, this function is used for all formats.
\r
76 However, for formats other than the JSON format, the sprinter methods
\r
77 used by show_message are all no-ops, so this code continues to
\r
78 function correctly for all of the formats.
\r
80 Converting show_message eliminates show_null_message in the process,
\r
81 since this maps directly to an sprinter method.
\r
83 notmuch-show.c | 31 +++++--------------------------
\r
84 1 file changed, 5 insertions(+), 26 deletions(-)
\r
86 diff --git a/notmuch-show.c b/notmuch-show.c
\r
87 index b9d9f5d..ec3e861 100644
\r
88 --- a/notmuch-show.c
\r
89 +++ b/notmuch-show.c
\r
90 @@ -842,15 +842,6 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
\r
93 static notmuch_status_t
\r
94 -show_null_message (const notmuch_show_format_t *format)
\r
96 - /* Output a null message. Currently empty for all formats except Json */
\r
97 - if (format->null_message)
\r
98 - printf ("%s", format->null_message);
\r
99 - return NOTMUCH_STATUS_SUCCESS;
\r
102 -static notmuch_status_t
\r
103 show_message (void *ctx,
\r
104 const notmuch_show_format_t *format,
\r
106 @@ -884,23 +875,16 @@ show_messages (void *ctx,
\r
107 notmuch_message_t *message;
\r
108 notmuch_bool_t match;
\r
109 notmuch_bool_t excluded;
\r
110 - int first_set = 1;
\r
112 notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
\r
114 - if (format->message_set_start)
\r
115 - fputs (format->message_set_start, stdout);
\r
116 + sp->begin_list (sp);
\r
119 notmuch_messages_valid (messages);
\r
120 notmuch_messages_move_to_next (messages))
\r
122 - if (!first_set && format->message_set_sep)
\r
123 - fputs (format->message_set_sep, stdout);
\r
126 - if (format->message_set_start)
\r
127 - fputs (format->message_set_start, stdout);
\r
128 + sp->begin_list (sp);
\r
130 message = notmuch_messages_get (messages);
\r
132 @@ -915,12 +899,9 @@ show_messages (void *ctx,
\r
134 next_indent = indent + 1;
\r
136 - status = show_null_message (format);
\r
140 - if (!status && format->message_set_sep)
\r
141 - fputs (format->message_set_sep, stdout);
\r
143 status = show_messages (ctx,
\r
145 notmuch_message_get_replies (message),
\r
146 @@ -931,12 +912,10 @@ show_messages (void *ctx,
\r
148 notmuch_message_destroy (message);
\r
150 - if (format->message_set_end)
\r
151 - fputs (format->message_set_end, stdout);
\r
155 - if (format->message_set_end)
\r
156 - fputs (format->message_set_end, stdout);
\r