Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / ff / 278700fa8397cbec27a8a23b57ae47fbd3c2de
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 B43C2431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:25 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \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 mhYE7697k8vp for <notmuch@notmuchmail.org>;\r
17         Sat, 24 Nov 2012 17:17:21 -0800 (PST)\r
18 Received: from mail-da0-f53.google.com (mail-da0-f53.google.com\r
19         [209.85.210.53]) (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 AEB33431FAE\r
22         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:21 -0800 (PST)\r
23 Received: by mail-da0-f53.google.com with SMTP id x6so2305618dac.26\r
24         for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 17:17:21 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=jSzX/ZoXJUqxqQgDfkmXhUZTIHihiiune4PogwOKZLk=;\r
29         b=GOfF5hLERgS3XmyJgViQ0/Va6JadjzpncyniyeD2WT136jD4bp+F/Z6FEC4gYRT5v8\r
30         MrPEIhy290jmuI4ognzsZGcYubGrZ9/vFKRBDPM2hfGo7oPqckDNpfzv0cNTNlC0biPO\r
31         GCBOJzP1t1DXWtv7SZN7d6Py+wCKxMwueVpuz5eTaXN5M7Y4qJogeBwL2wnECff+OPX1\r
32         frFeXQsJzdNe/RvfEFR60dwBM9yhQhi+Os7eu0xt2TlCk7Nzxkj7aYQtw+u8xJhTFZa8\r
33         9vL0IzqxiyzxiT2XNUfiWM+7eTFM7TyoUz/mDRDKlKZLFqDJcH2mDBN7lR5zQXxv8rS9\r
34         fdFQ==\r
35 Received: by 10.68.209.230 with SMTP id mp6mr26308078pbc.8.1353806241382;\r
36         Sat, 24 Nov 2012 17:17:21 -0800 (PST)\r
37 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
38         [220.233.42.215])\r
39         by mx.google.com with ESMTPS id ot5sm6227251pbb.29.2012.11.24.17.17.18\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Sat, 24 Nov 2012 17:17:20 -0800 (PST)\r
42 From: Peter Wang <novalazy@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 03/20] cli: add stub for insert command\r
45 Date: Sun, 25 Nov 2012 12:16:29 +1100\r
46 Message-Id: <1353806206-29133-4-git-send-email-novalazy@gmail.com>\r
47 X-Mailer: git-send-email 1.7.12.1\r
48 In-Reply-To: <1353806206-29133-1-git-send-email-novalazy@gmail.com>\r
49 References: <1353806206-29133-1-git-send-email-novalazy@gmail.com>\r
50 MIME-Version: 1.0\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
55 Precedence: list\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, 25 Nov 2012 01:17:25 -0000\r
66 \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
71 \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
76 ---\r
77  Makefile.local   |  1 +\r
78  notmuch-client.h |  3 +++\r
79  notmuch-insert.c | 43 +++++++++++++++++++++++++++++++++++++++++++\r
80  notmuch.c        |  3 +++\r
81  4 files changed, 50 insertions(+)\r
82  create mode 100644 notmuch-insert.c\r
83 \r
84 diff --git a/Makefile.local b/Makefile.local\r
85 index 2b91946..6bbd588 100644\r
86 --- a/Makefile.local\r
87 +++ b/Makefile.local\r
88 @@ -261,6 +261,7 @@ notmuch_client_srcs =               \\r
89         notmuch-config.c        \\r
90         notmuch-count.c         \\r
91         notmuch-dump.c          \\r
92 +       notmuch-insert.c        \\r
93         notmuch-new.c           \\r
94         notmuch-reply.c         \\r
95         notmuch-restore.c       \\r
96 diff --git a/notmuch-client.h b/notmuch-client.h\r
97 index a7c3df2..c0d0e93 100644\r
98 --- a/notmuch-client.h\r
99 +++ b/notmuch-client.h\r
100 @@ -135,6 +135,9 @@ int\r
101  notmuch_dump_command (void *ctx, int argc, char *argv[]);\r
102  \r
103  int\r
104 +notmuch_insert_command (void *ctx, int argc, char *argv[]);\r
105 +\r
106 +int\r
107  notmuch_new_command (void *ctx, int argc, char *argv[]);\r
108  \r
109  int\r
110 diff --git a/notmuch-insert.c b/notmuch-insert.c\r
111 new file mode 100644\r
112 index 0000000..21424cf\r
113 --- /dev/null\r
114 +++ b/notmuch-insert.c\r
115 @@ -0,0 +1,43 @@\r
116 +/* notmuch - Not much of an email program, (just index and search)\r
117 + *\r
118 + * Copyright © 2012 Peter Wang\r
119 + *\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
124 + *\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
129 + *\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
132 + *\r
133 + * Author: Peter Wang <novalazy@gmail.com>\r
134 + */\r
135 +\r
136 +#include "notmuch-client.h"\r
137 +\r
138 +int\r
139 +notmuch_insert_command (void *ctx, int argc, char *argv[])\r
140 +{\r
141 +    notmuch_config_t *config;\r
142 +    notmuch_database_t *notmuch;\r
143 +    const char *db_path;\r
144 +\r
145 +    config = notmuch_config_open (ctx, NULL, NULL);\r
146 +    if (config == NULL)\r
147 +       return 1;\r
148 +\r
149 +    db_path = notmuch_config_get_database_path (config);\r
150 +\r
151 +    if (notmuch_database_open (notmuch_config_get_database_path (config),\r
152 +                              NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))\r
153 +       return 1;\r
154 +\r
155 +    notmuch_database_destroy (notmuch);\r
156 +\r
157 +    return 1;\r
158 +}\r
159 diff --git a/notmuch.c b/notmuch.c\r
160 index 477a09c..86239fd 100644\r
161 --- a/notmuch.c\r
162 +++ b/notmuch.c\r
163 @@ -53,6 +53,9 @@ static command_t commands[] = {\r
164      { "new", notmuch_new_command,\r
165        "[options...]",\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
173 -- \r
174 1.7.12.1\r
175 \r