Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 73 / a40cbcb2c58afa44c5dccb4e144df54dbd88a5
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 B590D431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 22 Jun 2013 23:43:09 -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 4UxkTVK2p4lG for <notmuch@notmuchmail.org>;\r
17         Sat, 22 Jun 2013 23:43:00 -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 EE43C431FAE\r
22         for <notmuch@notmuchmail.org>; Sat, 22 Jun 2013 23:42:59 -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 1Uqe0h-0008LL-B8; Sun, 23 Jun 2013 07:42:54 +0100\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1Uqe0g-0002UP-Gv; Sun, 23 Jun 2013 07:42:51 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v7 03/12] cli: add insert command\r
34 In-Reply-To: <1371961445-15182-4-git-send-email-novalazy@gmail.com>\r
35 References: <1371961445-15182-1-git-send-email-novalazy@gmail.com>\r
36         <1371961445-15182-4-git-send-email-novalazy@gmail.com>\r
37 User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1\r
38         (x86_64-pc-linux-gnu)\r
39 Date: Sun, 23 Jun 2013 07:42:49 +0100\r
40 Message-ID: <8761x5uy3a.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=utf-8\r
43 Content-Transfer-Encoding: quoted-printable\r
44 X-Sender-Host-Address: 93.97.24.31\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: 13e90c218e42dd5590f050a8490443e5 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -0.0\r
48 X-SpamAssassin-SpamBar: /\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -0.0 points.\r
53         Summary of the scoring: \r
54         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
55         provider *      (markwalters1009[at]gmail.com)\r
56         * -0.0 AWL AWL: From: address is in the auto white-list\r
57 X-QM-Scan-Virus: ClamAV says the message is clean\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Sun, 23 Jun 2013 06:43:09 -0000\r
71 \r
72 \r
73 This is a +1 modulo one small bug (I think) I found below. I am happy to\r
74 delay the fail-on-index-fail option, especially as that will need some\r
75 bikeshedding on its name.\r
76 \r
77 Also when posting new versions please include a diff from the previous\r
78 version (this is more difficult if there was significant rebasing). This\r
79 makew the v6 to v7 change obvious (the one comment change and the\r
80 bugfix).\r
81 \r
82 Moreover doing the diff with v4 (which I happen to have locally) I\r
83 found the bug below.\r
84 \r
85 Best wishes\r
86 \r
87 Mark\r
88 \r
89 \r
90 \r
91 \r
92 \r
93 On Sun, 23 Jun 2013, Peter Wang <novalazy@gmail.com> wrote:\r
94 > The notmuch insert command reads a message from standard input,\r
95 > writes it to a Maildir folder, and then incorporates the message into\r
96 > the notmuch database.  Essentially it moves the functionality of\r
97 > notmuch-deliver into notmuch.\r
98 >\r
99 > Though it could be used as an alternative to notmuch new, the reason\r
100 > I want this is to allow my notmuch frontend to add postponed or sent\r
101 > messages to the mail store and notmuch database, without resorting to\r
102 > another tool (e.g. notmuch-deliver) nor directly modifying the maildir.\r
103 > ---\r
104 >  Makefile.local   |   1 +\r
105 >  notmuch-client.h |   3 +\r
106 >  notmuch-insert.c | 335 +++++++++++++++++++++++++++++++++++++++++++++++++=\r
107 ++++++\r
108 >  notmuch.c        |   2 +\r
109 >  4 files changed, 341 insertions(+)\r
110 >  create mode 100644 notmuch-insert.c\r
111 >\r
112 > diff --git a/Makefile.local b/Makefile.local\r
113 > index 644623f..84043fe 100644\r
114 > --- a/Makefile.local\r
115 > +++ b/Makefile.local\r
116 > @@ -261,6 +261,7 @@ notmuch_client_srcs =3D           \\r
117 >       notmuch-config.c        \\r
118 >       notmuch-count.c         \\r
119 >       notmuch-dump.c          \\r
120 > +     notmuch-insert.c        \\r
121 >       notmuch-new.c           \\r
122 >       notmuch-reply.c         \\r
123 >       notmuch-restore.c       \\r
124 > diff --git a/notmuch-client.h b/notmuch-client.h\r
125 > index 4a3c7ac..dfe81e6 100644\r
126 > --- a/notmuch-client.h\r
127 > +++ b/notmuch-client.h\r
128 > @@ -181,6 +181,9 @@ int\r
129 >  notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]);\r
130 >=20=20\r
131 >  int\r
132 > +notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]=\r
133 );\r
134 > +\r
135 > +int\r
136 >  notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[]);\r
137 >=20=20\r
138 >  int\r
139 > diff --git a/notmuch-insert.c b/notmuch-insert.c\r
140 > new file mode 100644\r
141 > index 0000000..591189f\r
142 > --- /dev/null\r
143 > +++ b/notmuch-insert.c\r
144 > @@ -0,0 +1,335 @@\r
145 > +/* notmuch - Not much of an email program, (just index and search)\r
146 > + *\r
147 > + * Copyright =C2=A9 2013 Peter Wang\r
148 > + *\r
149 > + * Based in part on notmuch-deliver\r
150 > + * Copyright =C2=A9 2010 Ali Polatel\r
151 > + *\r
152 > + * This program is free software: you can redistribute it and/or modify\r
153 > + * it under the terms of the GNU General Public License as published by\r
154 > + * the Free Software Foundation, either version 3 of the License, or\r
155 > + * (at your option) any later version.\r
156 > + *\r
157 > + * This program is distributed in the hope that it will be useful,\r
158 > + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
159 > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
160 > + * GNU General Public License for more details.\r
161 > + *\r
162 > + * You should have received a copy of the GNU General Public License\r
163 > + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
164 > + *\r
165 > + * Author: Peter Wang <novalazy@gmail.com>\r
166 > + */\r
167 > +\r
168 > +#include "notmuch-client.h"\r
169 > +#include "tag-util.h"\r
170 > +\r
171 > +#include <sys/types.h>\r
172 > +#include <sys/stat.h>\r
173 > +#include <fcntl.h>\r
174 > +\r
175 > +static volatile sig_atomic_t interrupted;\r
176 > +\r
177 > +static void\r
178 > +handle_sigint (unused (int sig))\r
179 > +{\r
180 > +    static char msg[] =3D "Stopping...         \n";\r
181 > +\r
182 > +    /* This write is "opportunistic", so it's okay to ignore the\r
183 > +     * result.  It is not required for correctness, and if it does\r
184 > +     * fail or produce a short write, we want to get out of the signal\r
185 > +     * handler as quickly as possible, not retry it. */\r
186 > +    IGNORE_RESULT (write (2, msg, sizeof (msg) - 1));\r
187 > +    interrupted =3D 1;\r
188 > +}\r
189 > +\r
190 > +/* Like gethostname but guarantees that a null-terminated hostname is\r
191 > + * returned, even if it has to make one up. Invalid characters are\r
192 > + * substituted such that the hostname can be used within a filename.\r
193 > + */\r
194 > +static void\r
195 > +safe_gethostname (char *hostname, size_t len)\r
196 > +{\r
197 > +    char *p;\r
198 > +\r
199 > +    if (gethostname (hostname, len) =3D=3D -1) {\r
200 > +     strncpy (hostname, "unknown", len);\r
201 > +    }\r
202 > +    hostname[len - 1] =3D '\0';\r
203 > +\r
204 > +    for (p =3D hostname; *p !=3D '\0'; p++) {\r
205 > +     if (*p =3D=3D '/' || *p =3D=3D ':')\r
206 > +         *p =3D '_';\r
207 > +    }\r
208 > +}\r
209 > +\r
210 > +/* Call fsync() on a directory path. */\r
211 > +static notmuch_bool_t\r
212 > +sync_dir (const char *dir)\r
213 > +{\r
214 > +    notmuch_bool_t ret;\r
215 > +    int fd;\r
216 > +\r
217 > +    fd =3D open (dir, O_RDONLY);\r
218 > +    if (fd =3D=3D -1) {\r
219 > +     fprintf (stderr, "Error: open() dir failed: %s\n", strerror (errno));\r
220 > +     return FALSE;\r
221 > +    }\r
222 > +    ret =3D (fsync (fd) =3D=3D 0);\r
223 > +    if (! ret) {\r
224 > +     fprintf (stderr, "Error: fsync() dir failed: %s\n", strerror (errno));\r
225 > +    }\r
226 > +    close (fd);\r
227 > +    return ret;\r
228 > +}\r
229 > +\r
230 > +/* Open a unique file in the 'tmp' sub-directory of dir.\r
231 > + * Returns the file descriptor on success, or -1 on failure.\r
232 > + * On success, file paths for the message in the 'tmp' and 'new'\r
233 > + * directories are returned via tmppath and newpath,\r
234 > + * and the path of the 'new' directory itself in newdir. */\r
235 > +static int\r
236 > +maildir_open_tmp_file (void *ctx, const char *dir,\r
237 > +                    char **tmppath, char **newpath, char **newdir)\r
238 > +{\r
239 > +    pid_t pid;\r
240 > +    char hostname[256];\r
241 > +    struct timeval tv;\r
242 > +    char *filename;\r
243 > +    int fd =3D -1;\r
244 > +\r
245 > +    /* We follow the Dovecot file name generation algorithm. */\r
246 > +    pid =3D getpid ();\r
247 > +    safe_gethostname (hostname, sizeof (hostname));\r
248 > +    do {\r
249 > +     gettimeofday (&tv, NULL);\r
250 > +     filename =3D talloc_asprintf (ctx, "%ld.M%ldP%d.%s",\r
251 > +                                 tv.tv_sec, tv.tv_usec, pid, hostname);\r
252 > +     if (! filename) {\r
253 > +         fprintf (stderr, "Out of memory\n");\r
254 > +         return -1;\r
255 > +     }\r
256 > +\r
257 > +     *tmppath =3D talloc_asprintf (ctx, "%s/tmp/%s", dir, filename);\r
258 > +     if (! *tmppath) {\r
259 > +         fprintf (stderr, "Out of memory\n");\r
260 > +         return -1;\r
261 > +     }\r
262 > +\r
263 > +     fd =3D open (*tmppath, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);\r
264 > +    } while (fd =3D=3D -1 && errno =3D=3D EEXIST);\r
265 > +\r
266 > +    if (fd =3D=3D -1) {\r
267 > +     fprintf (stderr, "Error: opening %s: %s\n", *tmppath, strerror (errno));\r
268 > +     return -1;\r
269 > +    }\r
270 > +\r
271 > +    *newdir =3D talloc_asprintf (ctx, "%s/new", dir);\r
272 > +    *newpath =3D talloc_asprintf (ctx, "%s/new/%s", dir, filename);\r
273 > +    if (! *newdir || ! *newpath) {\r
274 > +     fprintf (stderr, "Out of memory\n");\r
275 > +     close (fd);\r
276 > +     unlink (*tmppath);\r
277 > +     return -1;\r
278 > +    }\r
279 > +\r
280 > +    talloc_free (filename);\r
281 > +\r
282 > +    return fd;\r
283 > +}\r
284 > +\r
285 > +/* Copy the contents of standard input (fdin) into fdout.\r
286 > + * Returns TRUE if a non-empty file was written successfully.\r
287 > + * Otherwise, return FALSE. */\r
288 > +static notmuch_bool_t\r
289 > +copy_stdin (int fdin, int fdout)\r
290 > +{\r
291 > +    notmuch_bool_t empty =3D TRUE;\r
292 > +\r
293 > +    while (! interrupted) {\r
294 > +     ssize_t remain;\r
295 > +     char buf[4096];\r
296 > +     char *p;\r
297 > +\r
298 > +     remain =3D read (fdin, buf, sizeof (buf));\r
299 > +     if (remain =3D=3D 0)\r
300 > +         break;\r
301 > +     if (remain < 0) {\r
302 > +         if (errno =3D=3D EINTR)\r
303 > +             continue;\r
304 > +         fprintf (stderr, "Error: reading from standard input: %s\n",\r
305 > +                  strerror (errno));\r
306 > +         return FALSE;\r
307 > +     }\r
308 > +\r
309 > +     p =3D buf;\r
310 > +     do {\r
311 > +         ssize_t written =3D write (fdout, p, remain);\r
312 > +         if (written < 0 && errno =3D=3D EINTR)\r
313 > +             continue;\r
314 > +         if (written <=3D 0) {\r
315 > +             fprintf (stderr, "Error: writing to temporary file: %s",\r
316 > +                      strerror (errno));\r
317 > +             return FALSE;\r
318 > +         }\r
319 > +         p +=3D written;\r
320 > +         remain -=3D written;\r
321 > +         empty =3D FALSE;\r
322 > +     } while (remain > 0);\r
323 > +    }\r
324 > +\r
325 > +    return (!interrupted && !empty);\r
326 > +}\r
327 > +\r
328 > +/* Add the specified message file to the notmuch database, applying tags.\r
329 > + * The file is renamed to encode notmuch tags as maildir flags. */\r
330 > +static void\r
331 > +add_file_to_database (notmuch_database_t *notmuch, const char *path,\r
332 > +                   tag_op_list_t *tag_ops)\r
333 > +{\r
334 > +    notmuch_message_t *message;\r
335 > +    notmuch_status_t status;\r
336 > +\r
337 > +    status =3D notmuch_database_add_message (notmuch, path, &message);\r
338 > +    switch (status) {\r
339 > +    case NOTMUCH_STATUS_SUCCESS:\r
340 > +    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
341 > +     break;\r
342 > +    default:\r
343 > +    case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
344 > +    case NOTMUCH_STATUS_READ_ONLY_DATABASE:\r
345 > +    case NOTMUCH_STATUS_XAPIAN_EXCEPTION:\r
346 > +    case NOTMUCH_STATUS_OUT_OF_MEMORY:\r
347 > +    case NOTMUCH_STATUS_FILE_ERROR:\r
348 > +    case NOTMUCH_STATUS_NULL_POINTER:\r
349 > +    case NOTMUCH_STATUS_TAG_TOO_LONG:\r
350 > +    case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:\r
351 > +    case NOTMUCH_STATUS_UNBALANCED_ATOMIC:\r
352 > +    case NOTMUCH_STATUS_LAST_STATUS:\r
353 > +     fprintf (stderr, "Error: failed to add `%s' to notmuch database: %s\n",\r
354 > +              path, notmuch_status_to_string (status));\r
355 > +     return;\r
356 > +    }\r
357 > +\r
358 > +    if (status =3D=3D NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {\r
359 > +     /* Don't change tags of an existing message. */\r
360 > +     status =3D notmuch_message_tags_to_maildir_flags (message);\r
361 > +     if (status !=3D NOTMUCH_STATUS_SUCCESS)\r
362 > +         fprintf (stderr, "Error: failed to sync tags to maildir flags\n");\r
363 > +    } else {\r
364 > +     tag_op_list_apply (message, tag_ops, TAG_FLAG_MAILDIR_SYNC);\r
365 > +    }\r
366 > +\r
367 > +    notmuch_message_destroy (message);\r
368 > +}\r
369 > +\r
370 > +static notmuch_bool_t\r
371 > +insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,\r
372 > +             const char *dir, tag_op_list_t *tag_ops)\r
373 > +{\r
374 > +    char *tmppath;\r
375 > +    char *newpath;\r
376 > +    char *newdir;\r
377 > +    int fdout;\r
378 > +    char *cleanup_path;\r
379 > +\r
380 > +    fdout =3D maildir_open_tmp_file (ctx, dir, &tmppath, &newpath, &newd=\r
381 ir);\r
382 > +    if (fdout < 0)\r
383 > +     return FALSE;\r
384 > +\r
385 > +    cleanup_path =3D tmppath;\r
386 > +\r
387 > +    if (! copy_stdin (fdin, fdout))\r
388 > +     goto FAIL;\r
389 > +\r
390 > +    if (fsync (fdout) !=3D 0) {\r
391 > +     fprintf (stderr, "Error: fsync failed: %s\n", strerror (errno));\r
392 > +     goto FAIL;\r
393 > +    }\r
394 > +\r
395 > +    close (fdout);\r
396 > +    fdout =3D -1;\r
397 > +\r
398 > +    /* Atomically move the new message file from the Maildir 'tmp' direc=\r
399 tory\r
400 > +     * to the 'new' directory.  We follow the Dovecot recommendation to\r
401 > +     * simply use rename() instead of link() and unlink().\r
402 > +     * See also: http://wiki.dovecot.org/MailboxFormat/Maildir#Mail_deli=\r
403 very\r
404 > +     */\r
405 > +    if (rename (tmppath, newpath) !=3D 0) {\r
406 > +     fprintf (stderr, "Error: rename() failed: %s\n", strerror (errno));\r
407 > +     goto FAIL;\r
408 > +    }\r
409 > +\r
410 > +    if (! sync_dir (newdir))\r
411 > +     goto FAIL;\r
412 \r
413 I think cleanup_path needs to be updated before the sync_dir is test as\r
414 newpath should be unlinked rather than oldpath. (v4 explicitly unlinked new=\r
415 path)\r
416 \r
417 \r
418 > +\r
419 > +    /* Even if adding the message to the notmuch database fails,\r
420 > +     * the message is on disk and we consider the delivery completed. */\r
421 > +    add_file_to_database (notmuch, newpath, tag_ops);\r
422 > +\r
423 > +    return TRUE;\r
424 > +\r
425 > +  FAIL:\r
426 > +    if (fdout >=3D 0)\r
427 > +     close (fdout);\r
428 > +    unlink (cleanup_path);\r
429 > +    return FALSE;\r
430 > +}\r
431 > +\r
432 > +int\r
433 > +notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])\r
434 > +{\r
435 > +    notmuch_database_t *notmuch;\r
436 > +    struct sigaction action;\r
437 > +    const char *db_path;\r
438 > +    const char **new_tags;\r
439 > +    size_t new_tags_length;\r
440 > +    tag_op_list_t *tag_ops;\r
441 > +    char *query_string =3D NULL;\r
442 > +    const char *maildir;\r
443 > +    int opt_index =3D 1;\r
444 > +    unsigned int i;\r
445 > +    notmuch_bool_t ret;\r
446 > +\r
447 > +    db_path =3D notmuch_config_get_database_path (config);\r
448 > +    new_tags =3D notmuch_config_get_new_tags (config, &new_tags_length);\r
449 > +\r
450 > +    tag_ops =3D tag_op_list_create (config);\r
451 > +    if (tag_ops =3D=3D NULL) {\r
452 > +     fprintf (stderr, "Out of memory.\n");\r
453 > +     return 1;\r
454 > +    }\r
455 > +    for (i =3D 0; i < new_tags_length; i++) {\r
456 > +     if (tag_op_list_append (tag_ops, new_tags[i], FALSE))\r
457 > +         return 1;\r
458 > +    }\r
459 > +\r
460 > +    if (parse_tag_command_line (config, argc - opt_index, argv + opt_ind=\r
461 ex,\r
462 > +                             &query_string, tag_ops))\r
463 > +     return 1;\r
464 > +\r
465 > +    if (*query_string !=3D '\0') {\r
466 > +     fprintf (stderr, "Error: unexpected query string: %s\n", query_string);\r
467 > +     return 1;\r
468 > +    }\r
469 > +\r
470 > +    maildir =3D db_path;\r
471 > +\r
472 > +    /* Setup our handler for SIGINT. We do not set SA_RESTART so that co=\r
473 pying\r
474 > +     * from standard input may be interrupted. */\r
475 > +    memset (&action, 0, sizeof (struct sigaction));\r
476 > +    action.sa_handler =3D handle_sigint;\r
477 > +    sigemptyset (&action.sa_mask);\r
478 > +    action.sa_flags =3D 0;\r
479 > +    sigaction (SIGINT, &action, NULL);\r
480 > +\r
481 > +    if (notmuch_database_open (notmuch_config_get_database_path (config),\r
482 > +                            NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))\r
483 > +     return 1;\r
484 > +\r
485 > +    ret =3D insert_message (config, notmuch, STDIN_FILENO, maildir, tag_=\r
486 ops);\r
487 > +\r
488 > +    notmuch_database_destroy (notmuch);\r
489 > +\r
490 > +    return (ret) ? 0 : 1;\r
491 > +}\r
492 > diff --git a/notmuch.c b/notmuch.c\r
493 > index 45a73ce..d11f214 100644\r
494 > --- a/notmuch.c\r
495 > +++ b/notmuch.c\r
496 > @@ -44,6 +44,8 @@ static command_t commands[] =3D {\r
497 >        "Interactively setup notmuch for first use." },\r
498 >      { "new", notmuch_new_command, FALSE,\r
499 >        "Find and import new messages to the notmuch database." },\r
500 > +    { "insert", notmuch_insert_command, FALSE,\r
501 > +      "Add a new message into the maildir and notmuch database." },\r
502 >      { "search", notmuch_search_command, FALSE,\r
503 >        "Search for messages matching the given search terms." },\r
504 >      { "show", notmuch_show_command, FALSE,\r
505 > --=20\r
506 > 1.7.12.1\r
507 >\r
508 > _______________________________________________\r
509 > notmuch mailing list\r
510 > notmuch@notmuchmail.org\r
511 > http://notmuchmail.org/mailman/listinfo/notmuch\r