1 Return-Path: <novalazy@gmail.com>
\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 B2FE1431FD6
\r
6 for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:50:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 XObZwNJscWfN for <notmuch@notmuchmail.org>;
\r
17 Sat, 19 Jan 2013 16:50:40 -0800 (PST)
\r
18 Received: from mail-da0-f47.google.com (mail-da0-f47.google.com
\r
19 [209.85.210.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 2E560431FB6
\r
22 for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:50:40 -0800 (PST)
\r
23 Received: by mail-da0-f47.google.com with SMTP id s35so2162804dak.34
\r
24 for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:50:38 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to
\r
27 :references:mime-version:content-type:content-transfer-encoding;
\r
28 bh=rH20fsxEfTcU/1UXvdaNpQTYJGGtR9D/WwNSv9grl4s=;
\r
29 b=LZVtn0Vbbbv8o1B+LCFZJmfWrtKG0UdciQ3g2ptmksTTqBneD8X6uyohTQ6rxXzkWq
\r
30 NBGcomp15Ldnv6w3TmbXSgoO4eP+MFEUpnif6ez8DJomKqh3k/odQpVc42gscmcXLBzG
\r
31 DJivG+/7kHcMViTIMKHfw+JOIQa0GQt2H9KHgyVZBz2dp/TlAJTs96FlU4GskREWC7bt
\r
32 vdd5xHo5VFbBwNFBCg4OO/fFZl47sw9t8fBKHCUbV2MD/Mb2DThXtexolX2QGy++jc+K
\r
33 +kauFBk1QDXCxhZe7eEUis4IDZ3SqRmNrwkEP8L9RAOh+B0AOHhojGoNiaWBEO6aO5ld
\r
35 X-Received: by 10.66.84.232 with SMTP id c8mr36576008paz.8.1358643038139;
\r
36 Sat, 19 Jan 2013 16:50:38 -0800 (PST)
\r
37 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
39 by mx.google.com with ESMTPS id a9sm6265419pav.24.2013.01.19.16.50.35
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sat, 19 Jan 2013 16:50:37 -0800 (PST)
\r
42 From: Peter Wang <novalazy@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH v3 01/20] cli: add stub for insert command
\r
45 Date: Sun, 20 Jan 2013 11:49:45 +1100
\r
46 Message-Id: <1358643004-14522-2-git-send-email-novalazy@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.12.1
\r
48 In-Reply-To: <1358643004-14522-1-git-send-email-novalazy@gmail.com>
\r
49 References: <1358643004-14522-1-git-send-email-novalazy@gmail.com>
\r
51 Content-Type: text/plain; charset=UTF-8
\r
52 Content-Transfer-Encoding: 8bit
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Sun, 20 Jan 2013 00:50:41 -0000
\r
67 The notmuch insert command should read a message from standard input
\r
68 and deliver it to a Maildir folder, and then incorporate the message
\r
69 into the notmuch database. Essentially it moves the functionality of
\r
70 notmuch-deliver into notmuch.
\r
72 Though it could be used as an alternative to notmuch new, the reason
\r
73 I want this is to allow my notmuch frontend to add postponed or sent
\r
74 messages to the mail store and notmuch database, without resorting to
\r
75 another tool (e.g. notmuch-deliver) nor directly modifying the maildir.
\r
77 Makefile.local | 1 +
\r
78 notmuch-client.h | 3 +++
\r
79 notmuch-insert.c | 43 +++++++++++++++++++++++++++++++++++++++++++
\r
81 4 files changed, 50 insertions(+)
\r
82 create mode 100644 notmuch-insert.c
\r
84 diff --git a/Makefile.local b/Makefile.local
\r
85 index c274f07..bb2381d 100644
\r
86 --- a/Makefile.local
\r
87 +++ b/Makefile.local
\r
88 @@ -261,6 +261,7 @@ notmuch_client_srcs = \
\r
92 + notmuch-insert.c \
\r
96 diff --git a/notmuch-client.h b/notmuch-client.h
\r
97 index 5f28836..af7d094 100644
\r
98 --- a/notmuch-client.h
\r
99 +++ b/notmuch-client.h
\r
100 @@ -175,6 +175,9 @@ int
\r
101 notmuch_dump_command (void *ctx, int argc, char *argv[]);
\r
104 +notmuch_insert_command (void *ctx, int argc, char *argv[]);
\r
107 notmuch_new_command (void *ctx, int argc, char *argv[]);
\r
110 diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
111 new file mode 100644
\r
112 index 0000000..c1d359c
\r
114 +++ b/notmuch-insert.c
\r
116 +/* notmuch - Not much of an email program, (just index and search)
\r
118 + * Copyright © 2013 Peter Wang
\r
120 + * This program is free software: you can redistribute it and/or modify
\r
121 + * it under the terms of the GNU General Public License as published by
\r
122 + * the Free Software Foundation, either version 3 of the License, or
\r
123 + * (at your option) any later version.
\r
125 + * This program is distributed in the hope that it will be useful,
\r
126 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
127 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
128 + * GNU General Public License for more details.
\r
130 + * You should have received a copy of the GNU General Public License
\r
131 + * along with this program. If not, see http://www.gnu.org/licenses/ .
\r
133 + * Author: Peter Wang <novalazy@gmail.com>
\r
136 +#include "notmuch-client.h"
\r
139 +notmuch_insert_command (void *ctx, int argc, char *argv[])
\r
141 + notmuch_config_t *config;
\r
142 + notmuch_database_t *notmuch;
\r
143 + const char *db_path;
\r
145 + config = notmuch_config_open (ctx, NULL, NULL);
\r
146 + if (config == NULL)
\r
149 + db_path = notmuch_config_get_database_path (config);
\r
151 + if (notmuch_database_open (notmuch_config_get_database_path (config),
\r
152 + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much))
\r
155 + notmuch_database_destroy (notmuch);
\r
159 diff --git a/notmuch.c b/notmuch.c
\r
160 index 4fc0973..1c3b893 100644
\r
163 @@ -53,6 +53,9 @@ static command_t commands[] = {
\r
164 { "new", notmuch_new_command,
\r
166 "Find and import new messages to the notmuch database." },
\r
167 + { "insert", notmuch_insert_command,
\r
168 + "[options...] [--] [+<tag>|-<tag> ...] < message",
\r
169 + "Add a new message into the maildir and notmuch database." },
\r
170 { "search", notmuch_search_command,
\r
171 "[options...] <search-terms> [...]",
\r
172 "Search for messages matching the given search terms." },
\r