[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 10 / de5693c534ae729a5172ea6bb0b8c958adeb6e
1 Return-Path: <m.walters@qmul.ac.uk>\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 32E27431FAF\r
6         for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 12:03:43 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 SkHYyThtQhSI for <notmuch@notmuchmail.org>;\r
17         Wed, 25 Jul 2012 12:03:42 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 1AF19431FAE\r
22         for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 12:03:42 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Su6s0-0003km-DV; Wed, 25 Jul 2012 20:03:40 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Su6s0-0001j5-1X; Wed, 25 Jul 2012 20:03:40 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH 10/13] show: Convert envelope format_part_json to use\r
35         sprinter\r
36 In-Reply-To: <1343183693-17134-11-git-send-email-amdragon@mit.edu>\r
37 References: <1343183693-17134-1-git-send-email-amdragon@mit.edu>\r
38         <1343183693-17134-11-git-send-email-amdragon@mit.edu>\r
39 User-Agent: Notmuch/0.13.2+93~gf33b188 (http://notmuchmail.org) Emacs/23.4.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Wed, 25 Jul 2012 20:03:40 +0100\r
42 Message-ID: <874novirxv.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: ded7eccf8ef343a5cf8db2bb05f40a95 (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\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: Wed, 25 Jul 2012 19:03:43 -0000\r
77 \r
78 On Wed, 25 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
79 > ---\r
80 >  notmuch-show.c |   57 +++++++++++++++++++++++++++++++++-----------------------\r
81 >  1 file changed, 34 insertions(+), 23 deletions(-)\r
82 >\r
83 > diff --git a/notmuch-show.c b/notmuch-show.c\r
84 > index afbd9d0..fa1e6e9 100644\r
85 > --- a/notmuch-show.c\r
86 > +++ b/notmuch-show.c\r
87 > @@ -110,34 +110,44 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)\r
88 >  }\r
89 >  \r
90 >  static void\r
91 > -format_message_json (const void *ctx, notmuch_message_t *message)\r
92 > +format_message_json (sprinter_t *sp, notmuch_message_t *message)\r
93 >  {\r
94 \r
95 It might be nice to have a comment for this function (and other similar ones) saying\r
96 what it prints: is it a sequence of key: value pairs, or a map or an\r
97 array etc. On the other hand it might be that it is best as it is where\r
98 you just read the code to see.\r
99 \r
100 > +    void *local = talloc_new (NULL);\r
101 >      notmuch_tags_t *tags;\r
102 > -    int first = 1;\r
103 > -    void *ctx_quote = talloc_new (ctx);\r
104 >      time_t date;\r
105 >      const char *relative_date;\r
106 >  \r
107 >      date = notmuch_message_get_date (message);\r
108 > -    relative_date = notmuch_time_relative_date (ctx, date);\r
109 > +    relative_date = notmuch_time_relative_date (local, date);\r
110 \r
111 This makes the diff very easy to read but it might be nicer to have\r
112 these two assignments further down where they are used.\r
113 \r
114 Best wishes\r
115 \r
116 Mark\r
117 \r
118 > +\r
119 > +    sp->map_key (sp, "id");\r
120 > +    sp->string (sp, notmuch_message_get_message_id (message));\r
121 > +\r
122 > +    sp->map_key (sp, "match");\r
123 > +    sp->boolean (sp, notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH));\r
124 > +\r
125 > +    sp->map_key (sp, "excluded");\r
126 > +    sp->boolean (sp, notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED));\r
127 > +\r
128 > +    sp->map_key (sp, "filename");\r
129 > +    sp->string (sp, notmuch_message_get_filename (message));\r
130 > +\r
131 > +    sp->map_key (sp, "timestamp");\r
132 > +    date = notmuch_message_get_date (message);\r
133 > +    sp->integer (sp, date);\r
134 >  \r
135 > -    printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
136 > -         json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
137 > -         notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
138 > -         notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",\r
139 > -         json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
140 > -         date, relative_date);\r
141 > +    sp->map_key (sp, "date_relative");\r
142 > +    sp->string (sp, relative_date);\r
143 >  \r
144 > +    sp->map_key (sp, "tags");\r
145 > +    sp->begin_list (sp);\r
146 >      for (tags = notmuch_message_get_tags (message);\r
147 >        notmuch_tags_valid (tags);\r
148 >        notmuch_tags_move_to_next (tags))\r
149 > -    {\r
150 > -         printf("%s%s", first ? "" : ",",\r
151 > -               json_quote_str (ctx_quote, notmuch_tags_get (tags)));\r
152 > -         first = 0;\r
153 > -    }\r
154 > -    printf("], ");\r
155 > -    talloc_free (ctx_quote);\r
156 > +     sp->string (sp, notmuch_tags_get (tags));\r
157 > +    sp->end (sp);\r
158 > +\r
159 > +    talloc_free (local);\r
160 >  }\r
161 >  \r
162 >  /* Extract just the email address from the contents of a From:\r
163 > @@ -573,18 +583,19 @@ format_part_json (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
164 >       * devel/schemata. */\r
165 >  \r
166 >      if (node->envelope_file) {\r
167 > -     printf ("{");\r
168 > -     format_message_json (ctx, node->envelope_file);\r
169 > +     sp->begin_map (sp);\r
170 > +     format_message_json (sp, node->envelope_file);\r
171 >  \r
172 > -     printf ("\"headers\": ");\r
173 > +     sp->map_key (sp, "headers");\r
174 >       format_headers_json (sp, GMIME_MESSAGE (node->part), FALSE);\r
175 >  \r
176 >       if (output_body) {\r
177 > -         printf (", \"body\": [");\r
178 > +         sp->map_key (sp, "body");\r
179 > +         sp->begin_list (sp);\r
180 >           format_part_json (ctx, sp, mime_node_child (node, 0), first, TRUE);\r
181 > -         printf ("]");\r
182 > +         sp->end (sp);\r
183 >       }\r
184 > -     printf ("}");\r
185 > +     sp->end (sp);\r
186 >       return;\r
187 >      }\r
188 >  \r
189 > -- \r
190 > 1.7.10\r
191 >\r
192 > _______________________________________________\r
193 > notmuch mailing list\r
194 > notmuch@notmuchmail.org\r
195 > http://notmuchmail.org/mailman/listinfo/notmuch\r