1 Return-Path: <ethan.glasser.camp@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 EF2EC431FC2
\r
6 for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:49 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=1.061 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_BL_SPAMCOP_NET=1.246,
\r
14 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id UD8P465nqgBD for <notmuch@notmuchmail.org>;
\r
18 Mon, 25 Jun 2012 13:53:49 -0700 (PDT)
\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com
\r
20 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 03C28431FAF for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:48 -0700
\r
24 Received: by wgbdt14 with SMTP id dt14so3710368wgb.2
\r
25 for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:47 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=FHnNafQToxQ2x10ZyiW9HfN0hgVl0OZ7fBfEXC9nMDQ=;
\r
29 b=y3OJNmxcyoNOXQLd74YHiYjmfszW8WcMnJa+Y5ottk4XP4XfeLF+3h7xJjqMEctrwr
\r
30 0E0JYx5u0I1yPy4zTcLw17gAmkiRtPz5kNCAxPz4ADAOKeA9RhDHIvRPNHkZzzO5EJKx
\r
31 YK08IMIyULkJrLXou2bxYTV26bAuHh7XP7laWEMVcdJ6PRZX544hV+2n10VhUKJW2xNC
\r
32 YN9EDlni5K55eWWRFcgyBzpUcTqnNmNPk1YN2rQ45vPzk32vZ2/G10L2o9aZRPp/Lkh4
\r
33 E5FOiZAwGUrd4Eo9NuDHTd/VPlAau+hYJYOP2TD+wPrbKHo8WjUc3VmZD8Yu+Dl2GSJG
\r
35 Received: by 10.180.80.37 with SMTP id o5mr27148754wix.12.1340657627636;
\r
36 Mon, 25 Jun 2012 13:53:47 -0700 (PDT)
\r
37 Received: from localhost ([195.24.209.21])
\r
38 by mx.google.com with ESMTPS id hs8sm37653wib.10.2012.06.25.13.53.31
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Mon, 25 Jun 2012 13:53:35 -0700 (PDT)
\r
41 From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [RFC PATCH 10/14] new: add "scan" option
\r
44 Date: Mon, 25 Jun 2012 16:51:53 -0400
\r
45 Message-Id: <1340657517-6539-6-git-send-email-ethan@betacantrips.com>
\r
46 X-Mailer: git-send-email 1.7.9.5
\r
47 In-Reply-To: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>
\r
48 References: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>
\r
49 X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Mon, 25 Jun 2012 20:53:50 -0000
\r
64 This is just a quick hack to get started on adding an mbox backend.
\r
66 The fact that the default maildir is scanned "automagically" is a
\r
67 little weird, but it doesn't do any harm unless you decide to put mail
\r
68 there that you really don't want indexed.
\r
70 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
72 notmuch-client.h | 9 +++++++++
\r
73 notmuch-config.c | 30 +++++++++++++++++++++++++++++-
\r
74 notmuch-new.c | 18 ++++++++++++++++++
\r
76 4 files changed, 57 insertions(+), 1 deletion(-)
\r
78 diff --git a/notmuch-client.h b/notmuch-client.h
\r
79 index 9b63eae..9d922fe 100644
\r
80 --- a/notmuch-client.h
\r
81 +++ b/notmuch-client.h
\r
82 @@ -256,6 +256,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
\r
83 const char *new_ignore[],
\r
87 +notmuch_config_get_new_scan (notmuch_config_t *config,
\r
91 +notmuch_config_set_new_scan (notmuch_config_t *config,
\r
92 + const char *new_scan[],
\r
96 notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);
\r
98 diff --git a/notmuch-config.c b/notmuch-config.c
\r
99 index 3e37a2d..e9d99ea 100644
\r
100 --- a/notmuch-config.c
\r
101 +++ b/notmuch-config.c
\r
102 @@ -50,7 +50,10 @@ static const char new_config_comment[] =
\r
103 "\t that will not be searched for messages by \"notmuch new\".\n"
\r
105 "\t NOTE: *Every* file/directory that goes by one of those names will\n"
\r
106 - "\t be ignored, independent of its depth/location in the mail store.\n";
\r
107 + "\t be ignored, independent of its depth/location in the mail store.\n"
\r
109 + "\tscan A list (separated by ';') of mail URLs to scan.\n"
\r
110 + "\t The maildir located at database.path, above, will automatically be added.\n";
\r
112 static const char user_config_comment[] =
\r
113 " User configuration\n"
\r
114 @@ -113,6 +116,8 @@ struct _notmuch_config {
\r
115 size_t new_tags_length;
\r
116 const char **new_ignore;
\r
117 size_t new_ignore_length;
\r
118 + const char **new_scan;
\r
119 + size_t new_scan_length;
\r
120 notmuch_bool_t maildir_synchronize_flags;
\r
121 const char **search_exclude_tags;
\r
122 size_t search_exclude_tags_length;
\r
123 @@ -274,6 +279,8 @@ notmuch_config_open (void *ctx,
\r
124 config->new_tags_length = 0;
\r
125 config->new_ignore = NULL;
\r
126 config->new_ignore_length = 0;
\r
127 + config->new_scan = NULL;
\r
128 + config->new_scan_length = 0;
\r
129 config->maildir_synchronize_flags = TRUE;
\r
130 config->search_exclude_tags = NULL;
\r
131 config->search_exclude_tags_length = 0;
\r
132 @@ -375,6 +382,10 @@ notmuch_config_open (void *ctx,
\r
133 notmuch_config_set_new_ignore (config, NULL, 0);
\r
136 + if (notmuch_config_get_new_scan (config, &tmp) == NULL) {
\r
137 + notmuch_config_set_new_scan (config, NULL, 0);
\r
140 if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {
\r
142 const char *tags[] = { "deleted", "spam" };
\r
143 @@ -631,6 +642,14 @@ notmuch_config_get_new_ignore (notmuch_config_t *config, size_t *length)
\r
144 &(config->new_ignore_length), length);
\r
148 +notmuch_config_get_new_scan (notmuch_config_t *config, size_t *length)
\r
150 + return _config_get_list (config, "new", "scan",
\r
151 + &(config->new_scan),
\r
152 + &(config->new_scan_length), length);
\r
156 notmuch_config_set_user_other_email (notmuch_config_t *config,
\r
157 const char *list[],
\r
158 @@ -658,6 +677,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
\r
159 &(config->new_ignore));
\r
163 +notmuch_config_set_new_scan (notmuch_config_t *config,
\r
164 + const char *list[],
\r
167 + _config_set_list (config, "new", "scan", list, length,
\r
168 + &(config->new_scan));
\r
172 notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length)
\r
174 diff --git a/notmuch-new.c b/notmuch-new.c
\r
175 index 1f11b2c..57b27bf 100644
\r
176 --- a/notmuch-new.c
\r
177 +++ b/notmuch-new.c
\r
178 @@ -239,6 +239,16 @@ _entry_in_ignore_list (const char *entry, add_files_state_t *state)
\r
182 +/* Call out to the appropriate add_files function, based on the URI. */
\r
183 +static notmuch_status_t
\r
184 +add_files_uri (unused(notmuch_database_t *notmuch),
\r
185 + unused(const char *uri),
\r
186 + unused(add_files_state_t *state))
\r
188 + /* Stub for now */
\r
189 + return NOTMUCH_STATUS_SUCCESS;
\r
192 /* Examine 'path' recursively as follows:
\r
194 * o Ask the filesystem for the mtime of 'path' (fs_mtime)
\r
195 @@ -843,6 +853,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
198 const char *db_path;
\r
199 + const char **new_scan;
\r
200 + size_t new_scan_length, new_scan_i;
\r
201 char *dot_notmuch_path;
\r
202 struct sigaction action;
\r
203 _filename_node_t *f;
\r
204 @@ -941,6 +953,12 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
205 timer_is_active = TRUE;
\r
208 + new_scan = notmuch_config_get_new_scan (config, &new_scan_length);
\r
210 + for (new_scan_i = 0; new_scan_i < new_scan_length; new_scan_i++) {
\r
211 + add_files_uri (notmuch, new_scan[new_scan_i], &add_files_state);
\r
214 ret = add_files (notmuch, db_path, &add_files_state);
\r
217 diff --git a/test/config b/test/config
\r
218 index 93ecb13..b0ad0c1 100755
\r
221 @@ -52,6 +52,7 @@ user.primary_email=test_suite@notmuchmail.org
\r
222 user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
\r
223 new.tags=unread;inbox;
\r
226 search.exclude_tags=
\r
227 maildir.synchronize_flags=true
\r
228 foo.string=this is another string value
\r