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 C2C41431E64
\r
6 for <notmuch@notmuchmail.org>; Thu, 2 Aug 2012 18:15:39 -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 RNQy8KKnnp0Z for <notmuch@notmuchmail.org>;
\r
16 Thu, 2 Aug 2012 18:15:38 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 26EF9429E48
\r
20 for <notmuch@notmuchmail.org>; Thu, 2 Aug 2012 18:15:12 -0700 (PDT)
\r
21 X-AuditID: 1209190c-b7f806d000006b87-21-501b261f92e1
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id DC.2B.27527.F162B105; Thu, 2 Aug 2012 21:15:11 -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 q731FBmV012774;
\r
27 Thu, 2 Aug 2012 21:15:11 -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 q731F4ld002794
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Thu, 2 Aug 2012 21:15:05 -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 1Sx6To-0003wa-Gv; Thu, 02 Aug 2012 21:15:04 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v3 11/13] show: Convert show_message to use sprinter
\r
41 Date: Thu, 2 Aug 2012 21:14:57 -0400
\r
42 Message-Id: <1343956499-14543-12-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10
\r
44 In-Reply-To: <1343956499-14543-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1343956499-14543-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrCuvJh1gsL3D3GL1XB6L6zdnMlu8
\r
48 WTmP1YHZY+esu+weh78uZPF4tuoWcwBzFJdNSmpOZllqkb5dAlfGg3uXmQq6RCqOrbnF1sD4
\r
49 lL+LkZNDQsBE4vOnL2wQtpjEhXvrwWwhgX2MEhdveXYxcgHZ6xklrixYwALhPGSSmPPiKxOE
\r
50 M5dR4vuG04wgLWwCGhLb9i8Hs0UEpCV23p3NCmIzC8RJbJnyHywuLOAi8XHVarA4i4CqxM3P
\r
51 m8HivAKOEld//GCFOENe4un9PrAzOIHir9++YoQ4yUFieVs36wRG/gWMDKsYZVNyq3RzEzNz
\r
52 ilOTdYuTE/PyUot0DfVyM0v0UlNKNzGCg0uSZwfjm4NKhxgFOBiVeHhviUkHCLEmlhVX5h5i
\r
53 lORgUhLlZVYCCvEl5adUZiQWZ8QXleakFh9ilOBgVhLhrVoiFSDEm5JYWZValA+TkuZgURLn
\r
54 vZxy019IID2xJDU7NbUgtQgmK8PBoSTBO18FaKhgUWp6akVaZk4JQpqJgxNkOA/Q8GMgNbzF
\r
55 BYm5xZnpEPlTjIpS4ryLQC4SAElklObB9cKi/xWjONArwrxTQdp5gIkDrvsV0GAmoMF2ZiBX
\r
56 F5ckIqSkGhhlL8aor1m4p3HyxzkLLix88fJrwJSqDawCZwrPTV29/H/l5LDPAp/sdOIOpcWf
\r
57 alv0u7vCMDl73y8ej2XPBMNU8v6FfN12YceZRbe6nog6Hd75+4mrXnGQ8NuPay9UPmKzrzT/
\r
58 4apd+d063vkik+1k8z1Ltk5/t2dejnxORJeA8pTDlpsM8yx9lFiKMxINtZiLihMBYsFgotkC AAA=
\r
59 Cc: tomi.ollila@iki.fi
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Fri, 03 Aug 2012 01:15:40 -0000
\r
74 Unlike the previous patches, this function is used for all formats.
\r
75 However, for formats other than the JSON format, the sprinter methods
\r
76 used by show_message are all no-ops, so this code continues to
\r
77 function correctly for all of the formats.
\r
79 Converting show_message eliminates show_null_message in the process,
\r
80 since this maps directly to an sprinter method.
\r
82 notmuch-show.c | 31 +++++--------------------------
\r
83 1 file changed, 5 insertions(+), 26 deletions(-)
\r
85 diff --git a/notmuch-show.c b/notmuch-show.c
\r
86 index b9d9f5d..ec3e861 100644
\r
87 --- a/notmuch-show.c
\r
88 +++ b/notmuch-show.c
\r
89 @@ -842,15 +842,6 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
\r
92 static notmuch_status_t
\r
93 -show_null_message (const notmuch_show_format_t *format)
\r
95 - /* Output a null message. Currently empty for all formats except Json */
\r
96 - if (format->null_message)
\r
97 - printf ("%s", format->null_message);
\r
98 - return NOTMUCH_STATUS_SUCCESS;
\r
101 -static notmuch_status_t
\r
102 show_message (void *ctx,
\r
103 const notmuch_show_format_t *format,
\r
105 @@ -884,23 +875,16 @@ show_messages (void *ctx,
\r
106 notmuch_message_t *message;
\r
107 notmuch_bool_t match;
\r
108 notmuch_bool_t excluded;
\r
109 - int first_set = 1;
\r
111 notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
\r
113 - if (format->message_set_start)
\r
114 - fputs (format->message_set_start, stdout);
\r
115 + sp->begin_list (sp);
\r
118 notmuch_messages_valid (messages);
\r
119 notmuch_messages_move_to_next (messages))
\r
121 - if (!first_set && format->message_set_sep)
\r
122 - fputs (format->message_set_sep, stdout);
\r
125 - if (format->message_set_start)
\r
126 - fputs (format->message_set_start, stdout);
\r
127 + sp->begin_list (sp);
\r
129 message = notmuch_messages_get (messages);
\r
131 @@ -915,12 +899,9 @@ show_messages (void *ctx,
\r
133 next_indent = indent + 1;
\r
135 - status = show_null_message (format);
\r
139 - if (!status && format->message_set_sep)
\r
140 - fputs (format->message_set_sep, stdout);
\r
142 status = show_messages (ctx,
\r
144 notmuch_message_get_replies (message),
\r
145 @@ -931,12 +912,10 @@ show_messages (void *ctx,
\r
147 notmuch_message_destroy (message);
\r
149 - if (format->message_set_end)
\r
150 - fputs (format->message_set_end, stdout);
\r
154 - if (format->message_set_end)
\r
155 - fputs (format->message_set_end, stdout);
\r