[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / aa / 9861eb098a7a3a763c414ad50d87fb0602a4f1
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 7B34B431FD2\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Jul 2012 12:55:26 -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 vjij9oEEoSi7 for <notmuch@notmuchmail.org>;\r
17         Sun,  1 Jul 2012 12:55:23 -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 AEC99431FAF\r
22         for <notmuch@notmuchmail.org>; Sun,  1 Jul 2012 12:55:22 -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 1SlQEl-0005oT-UC; Sun, 01 Jul 2012 20:55:21 +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 1SlQEl-0002Yp-8p; Sun, 01 Jul 2012 20:55:15 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH v2 5/8] notmuch-new: pull out useful bits of\r
35         add_files_recursive\r
36 In-Reply-To: <1341160790-14525-6-git-send-email-ethan@betacantrips.com>\r
37 References:\r
38  <CAOJ+Ob0MSOez2MvD2fCgF7t32kFPk4g2+xCud88QmBLt_b5pOA@mail.gmail.com>\r
39         <1341160790-14525-1-git-send-email-ethan@betacantrips.com>\r
40         <1341160790-14525-6-git-send-email-ethan@betacantrips.com>\r
41 User-Agent: Notmuch/0.13.2+70~gb6a56e7 (http://notmuchmail.org) Emacs/23.4.1\r
42         (x86_64-pc-linux-gnu)\r
43 Date: Sun, 01 Jul 2012 20:55:11 +0100\r
44 Message-ID: <87ehov2r4w.fsf@qmul.ac.uk>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 X-Sender-Host-Address: 94.192.233.223\r
48 X-QM-SPAM-Info: Sender has good ham record.  :)\r
49 X-QM-Body-MD5: 5107d4a02d45af8f7cec3abc1d9625a6 (of first 20000 bytes)\r
50 X-SpamAssassin-Score: -1.8\r
51 X-SpamAssassin-SpamBar: -\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
53         determine if it is\r
54         spam. We require at least 5.0 points to mark a message as spam.\r
55         This message scored -1.8 points.\r
56         Summary of the scoring: \r
57         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
58         *      medium trust\r
59         *      [138.37.6.40 listed in list.dnswl.org]\r
60         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
61         provider *      (markwalters1009[at]gmail.com)\r
62         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
63         *      domain\r
64         *  0.5 AWL AWL: From: address is in the auto white-list\r
65 X-QM-Scan-Virus: ClamAV says the message is clean\r
66 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Sun, 01 Jul 2012 19:55:26 -0000\r
80 \r
81 On Sun, 01 Jul 2012, Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> wrote:\r
82 > This patch pulls some bits out of add_files_recursive which will be\r
83 > useful for other backends: two reporting functions\r
84 > _report_before_adding_file and _report_added_file, as well as\r
85 > _add_message, which actually does the message adding.\r
86 >\r
87 > No functional changes.\r
88 \r
89 This looks fine. Personally, I would split it into two or three bits so\r
90 it is easier to see that it is just code movement.\r
91 \r
92 Best wishes\r
93 \r
94 Mark\r
95 \r
96 >\r
97 > Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
98 > ---\r
99 >  notmuch-new.c |  192 +++++++++++++++++++++++++++++++++++----------------------\r
100 >  1 file changed, 119 insertions(+), 73 deletions(-)\r
101 >\r
102 > diff --git a/notmuch-new.c b/notmuch-new.c\r
103 > index 8377750..5250562 100644\r
104 > --- a/notmuch-new.c\r
105 > +++ b/notmuch-new.c\r
106 > @@ -239,6 +239,122 @@ _entry_in_ignore_list (const char *entry, add_files_state_t *state)\r
107 >      return FALSE;\r
108 >  }\r
109 >  \r
110 > +/* Progress-reporting function.\r
111 > + *\r
112 > + * Can be used by any mailstore-crawling function that wants to alert\r
113 > + * users what message it's about to add. Subsequent errors will be due\r
114 > + * to this message ;)\r
115 > + */\r
116 > +static void\r
117 > +_report_before_adding_file (add_files_state_t *state, const char *filename)\r
118 > +{\r
119 > +    state->processed_files++;\r
120 > +\r
121 > +    if (state->verbose) {\r
122 > +     if (state->output_is_a_tty)\r
123 > +         printf("\r\033[K");\r
124 > +\r
125 > +     printf ("%i/%i: %s",\r
126 > +             state->processed_files,\r
127 > +             state->total_files,\r
128 > +             filename);\r
129 > +\r
130 > +     putchar((state->output_is_a_tty) ? '\r' : '\n');\r
131 > +     fflush (stdout);\r
132 > +    }\r
133 > +}\r
134 > +\r
135 > +/* Progress-reporting function.\r
136 > + *\r
137 > + * Call this to respond to the signal handler for SIGALRM.\r
138 > + */\r
139 > +static void\r
140 > +_report_added_file (add_files_state_t *state)\r
141 > +{\r
142 > +    if (do_print_progress) {\r
143 > +     do_print_progress = 0;\r
144 > +     generic_print_progress ("Processed", "files", state->tv_start,\r
145 > +                             state->processed_files, state->total_files);\r
146 > +    }\r
147 > +}\r
148 > +\r
149 > +\r
150 > +/* Atomically handles adding a message to the database.\r
151 > + *\r
152 > + * Should be used by any mailstore-crawling function that finds a new\r
153 > + * message to add.\r
154 > + */\r
155 > +static notmuch_status_t\r
156 > +_add_message (add_files_state_t *state, notmuch_database_t *notmuch,\r
157 > +           const char *filename)\r
158 > +{\r
159 > +    notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;\r
160 > +    notmuch_message_t *message;\r
161 > +    const char **tag;\r
162 > +\r
163 > +    status = notmuch_database_begin_atomic (notmuch);\r
164 > +    if (status) {\r
165 > +     ret = status;\r
166 > +     goto DONE;\r
167 > +    }\r
168 > +\r
169 > +    status = notmuch_database_add_message (notmuch, filename, &message);\r
170 > +\r
171 > +    switch (status) {\r
172 > +    /* success */\r
173 > +    case NOTMUCH_STATUS_SUCCESS:\r
174 > +     state->added_messages++;\r
175 > +     notmuch_message_freeze (message);\r
176 > +     for (tag=state->new_tags; *tag != NULL; tag++)\r
177 > +         notmuch_message_add_tag (message, *tag);\r
178 > +     if (state->synchronize_flags == TRUE)\r
179 > +         notmuch_message_maildir_flags_to_tags (message);\r
180 > +     notmuch_message_thaw (message);\r
181 > +     break;\r
182 > +    /* Non-fatal issues (go on to next file) */\r
183 > +    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
184 > +     if (state->synchronize_flags == TRUE)\r
185 > +         notmuch_message_maildir_flags_to_tags (message);\r
186 > +     break;\r
187 > +    case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
188 > +     fprintf (stderr, "Note: Ignoring non-mail file: %s\n",\r
189 > +              filename);\r
190 > +     break;\r
191 > +    /* Fatal issues. Don't process anymore. */\r
192 > +    case NOTMUCH_STATUS_READ_ONLY_DATABASE:\r
193 > +    case NOTMUCH_STATUS_XAPIAN_EXCEPTION:\r
194 > +    case NOTMUCH_STATUS_OUT_OF_MEMORY:\r
195 > +     fprintf (stderr, "Error: %s. Halting processing.\n",\r
196 > +              notmuch_status_to_string (status));\r
197 > +     ret = status;\r
198 > +     goto DONE;\r
199 > +    default:\r
200 > +    case NOTMUCH_STATUS_FILE_ERROR:\r
201 > +    case NOTMUCH_STATUS_NULL_POINTER:\r
202 > +    case NOTMUCH_STATUS_TAG_TOO_LONG:\r
203 > +    case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:\r
204 > +    case NOTMUCH_STATUS_UNBALANCED_ATOMIC:\r
205 > +    case NOTMUCH_STATUS_LAST_STATUS:\r
206 > +     INTERNAL_ERROR ("add_message returned unexpected value: %d",  status);\r
207 > +     ret = status;\r
208 > +     goto DONE;\r
209 > +    }\r
210 > +\r
211 > +    status = notmuch_database_end_atomic (notmuch);\r
212 > +    if (status) {\r
213 > +     ret = status;\r
214 > +     goto DONE;\r
215 > +    }\r
216 > +\r
217 > +  DONE:\r
218 > +    if (message) {\r
219 > +     notmuch_message_destroy (message);\r
220 > +     message = NULL;\r
221 > +    }\r
222 > +\r
223 > +    return ret;\r
224 > +}\r
225 > +\r
226 >  /* Examine 'path' recursively as follows:\r
227 >   *\r
228 >   *   o Ask the filesystem for the mtime of 'path' (fs_mtime)\r
229 > @@ -290,7 +406,6 @@ add_files (notmuch_database_t *notmuch,\r
230 >      char *next = NULL;\r
231 >      time_t fs_mtime, db_mtime;\r
232 >      notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;\r
233 > -    notmuch_message_t *message = NULL;\r
234 >      struct dirent **fs_entries = NULL;\r
235 >      int i, num_fs_entries = 0, entry_type;\r
236 >      notmuch_directory_t *directory;\r
237 > @@ -299,7 +414,6 @@ add_files (notmuch_database_t *notmuch,\r
238 >      time_t stat_time;\r
239 >      struct stat st;\r
240 >      notmuch_bool_t is_maildir;\r
241 > -    const char **tag;\r
242 >  \r
243 >      if (stat (path, &st)) {\r
244 >       fprintf (stderr, "Error reading directory %s: %s\n",\r
245 > @@ -469,83 +583,15 @@ add_files (notmuch_database_t *notmuch,\r
246 >        * in the database, so add it. */\r
247 >       next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);\r
248 >  \r
249 > -     state->processed_files++;\r
250 > -\r
251 > -     if (state->verbose) {\r
252 > -         if (state->output_is_a_tty)\r
253 > -             printf("\r\033[K");\r
254 > -\r
255 > -         printf ("%i/%i: %s",\r
256 > -                 state->processed_files,\r
257 > -                 state->total_files,\r
258 > -                 next);\r
259 > -\r
260 > -         putchar((state->output_is_a_tty) ? '\r' : '\n');\r
261 > -         fflush (stdout);\r
262 > -     }\r
263 > +     _report_before_adding_file (state, next);\r
264 >  \r
265 > -     status = notmuch_database_begin_atomic (notmuch);\r
266 > +     status = _add_message (state, notmuch, next);\r
267 >       if (status) {\r
268 >           ret = status;\r
269 >           goto DONE;\r
270 >       }\r
271 >  \r
272 > -     status = notmuch_database_add_message (notmuch, next, &message);\r
273 > -     switch (status) {\r
274 > -     /* success */\r
275 > -     case NOTMUCH_STATUS_SUCCESS:\r
276 > -         state->added_messages++;\r
277 > -         notmuch_message_freeze (message);\r
278 > -         for (tag=state->new_tags; *tag != NULL; tag++)\r
279 > -             notmuch_message_add_tag (message, *tag);\r
280 > -         if (state->synchronize_flags == TRUE)\r
281 > -             notmuch_message_maildir_flags_to_tags (message);\r
282 > -         notmuch_message_thaw (message);\r
283 > -         break;\r
284 > -     /* Non-fatal issues (go on to next file) */\r
285 > -     case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
286 > -         if (state->synchronize_flags == TRUE)\r
287 > -             notmuch_message_maildir_flags_to_tags (message);\r
288 > -         break;\r
289 > -     case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
290 > -         fprintf (stderr, "Note: Ignoring non-mail file: %s\n",\r
291 > -                  next);\r
292 > -         break;\r
293 > -     /* Fatal issues. Don't process anymore. */\r
294 > -     case NOTMUCH_STATUS_READ_ONLY_DATABASE:\r
295 > -     case NOTMUCH_STATUS_XAPIAN_EXCEPTION:\r
296 > -     case NOTMUCH_STATUS_OUT_OF_MEMORY:\r
297 > -         fprintf (stderr, "Error: %s. Halting processing.\n",\r
298 > -                  notmuch_status_to_string (status));\r
299 > -         ret = status;\r
300 > -         goto DONE;\r
301 > -     default:\r
302 > -     case NOTMUCH_STATUS_FILE_ERROR:\r
303 > -     case NOTMUCH_STATUS_NULL_POINTER:\r
304 > -     case NOTMUCH_STATUS_TAG_TOO_LONG:\r
305 > -     case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:\r
306 > -     case NOTMUCH_STATUS_UNBALANCED_ATOMIC:\r
307 > -     case NOTMUCH_STATUS_LAST_STATUS:\r
308 > -         INTERNAL_ERROR ("add_message returned unexpected value: %d",  status);\r
309 > -         goto DONE;\r
310 > -     }\r
311 > -\r
312 > -     status = notmuch_database_end_atomic (notmuch);\r
313 > -     if (status) {\r
314 > -         ret = status;\r
315 > -         goto DONE;\r
316 > -     }\r
317 > -\r
318 > -     if (message) {\r
319 > -         notmuch_message_destroy (message);\r
320 > -         message = NULL;\r
321 > -     }\r
322 > -\r
323 > -     if (do_print_progress) {\r
324 > -         do_print_progress = 0;\r
325 > -         generic_print_progress ("Processed", "files", state->tv_start,\r
326 > -                                 state->processed_files, state->total_files);\r
327 > -     }\r
328 > +     _report_added_file (state);\r
329 >  \r
330 >       talloc_free (next);\r
331 >       next = NULL;\r
332 > -- \r
333 > 1.7.9.5\r
334 >\r
335 > _______________________________________________\r
336 > notmuch mailing list\r
337 > notmuch@notmuchmail.org\r
338 > http://notmuchmail.org/mailman/listinfo/notmuch\r