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 B8913431FBC
\r
6 for <notmuch@notmuchmail.org>; Sun, 1 Jul 2012 09:46:07 -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 gB2xCOqmtyvR for <notmuch@notmuchmail.org>;
\r
18 Sun, 1 Jul 2012 09:46:07 -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 BBD09431FAF for <notmuch@notmuchmail.org>; Sun, 1 Jul 2012 09:46:06 -0700
\r
24 Received: by wgbdt14 with SMTP id dt14so3720895wgb.2
\r
25 for <notmuch@notmuchmail.org>; Sun, 01 Jul 2012 09:46:05 -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=YHzkxLnuVlTBuioDrrEwI0x6FOi3UmhIQIDC0yQ+AB8=;
\r
29 b=uMXdbO7bTW2qk5jMSTzBvoPoKvlULSNIH7C4kNd0Pnkd+bamxi0j/0qolEeT1FQ/cV
\r
30 haym2FOwjfBjYfZQ1AY+dZz3zr0S/UGQgP2MeZeyFpQnCKtHu9+tvONy/9GSGgC8vIWo
\r
31 9kXeeEDNvFZy7R2MPB3GFhIPyv28X0zzbEY2/kJyns/jqRCuLPKbMnE5afGuL2+YyLRc
\r
32 M4M3QQKYv8fl4AMNZ4v/m7eOzm+UDHGiIvNHNvhYIYOHQy29WH9K3EwMPK6ZsvlzvgnR
\r
33 HMrVpNLBzjMWlMynDEmMsKRQQnBtbd7AJ6Bg27NCwqUdecCWGOviYR3TMqzYgTa72aeJ
\r
35 Received: by 10.216.226.32 with SMTP id a32mr439540weq.190.1341161165346;
\r
36 Sun, 01 Jul 2012 09:46:05 -0700 (PDT)
\r
37 Received: from localhost ([195.24.209.21])
\r
38 by mx.google.com with ESMTPS id fw4sm19720264wib.0.2012.07.01.09.45.48
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 01 Jul 2012 09:46:04 -0700 (PDT)
\r
41 From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH v2 4/8] new: add "scan" option
\r
44 Date: Sun, 1 Jul 2012 12:39:46 -0400
\r
45 Message-Id: <1341160790-14525-5-git-send-email-ethan@betacantrips.com>
\r
46 X-Mailer: git-send-email 1.7.9.5
\r
47 In-Reply-To: <1341160790-14525-1-git-send-email-ethan@betacantrips.com>
\r
49 <CAOJ+Ob0MSOez2MvD2fCgF7t32kFPk4g2+xCud88QmBLt_b5pOA@mail.gmail.com>
\r
50 <1341160790-14525-1-git-send-email-ethan@betacantrips.com>
\r
51 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Sun, 01 Jul 2012 16:46:07 -0000
\r
66 The new.scan option is a list of URLs that can be "scanned".
\r
68 The fact that the database maildir is scanned "automagically" is a
\r
69 little weird, but it doesn't do any harm unless you decide to put mail
\r
70 there that you really don't want indexed.
\r
72 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
74 I added text here to respond to Mark Walters's confusion regarding how
\r
75 I implemented scanning.
\r
77 notmuch-client.h | 9 +++++++++
\r
78 notmuch-config.c | 33 ++++++++++++++++++++++++++++++++-
\r
79 notmuch-new.c | 18 ++++++++++++++++++
\r
81 4 files changed, 60 insertions(+), 1 deletion(-)
\r
83 diff --git a/notmuch-client.h b/notmuch-client.h
\r
84 index 0c17b79..20349b2 100644
\r
85 --- a/notmuch-client.h
\r
86 +++ b/notmuch-client.h
\r
87 @@ -257,6 +257,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
\r
88 const char *new_ignore[],
\r
92 +notmuch_config_get_new_scan (notmuch_config_t *config,
\r
96 +notmuch_config_set_new_scan (notmuch_config_t *config,
\r
97 + const char *new_scan[],
\r
101 notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);
\r
103 diff --git a/notmuch-config.c b/notmuch-config.c
\r
104 index 3e37a2d..387f855 100644
\r
105 --- a/notmuch-config.c
\r
106 +++ b/notmuch-config.c
\r
107 @@ -50,7 +50,13 @@ static const char new_config_comment[] =
\r
108 "\t that will not be searched for messages by \"notmuch new\".\n"
\r
110 "\t NOTE: *Every* file/directory that goes by one of those names will\n"
\r
111 - "\t be ignored, independent of its depth/location in the mail store.\n";
\r
112 + "\t be ignored, independent of its depth/location in the mail store.\n"
\r
114 + "\tscan A list (separated by ';') of mail URLs to scan.\n"
\r
115 + "\t Each URL denotes a \"root\" which will be searched for mail files.\n"
\r
116 + "\t How this search is performed depends on the scheme of the URL (the\n"
\r
117 + "\t part before the first colon).\n"
\r
118 + "\t The maildir located at database.path, above, will automatically be added.\n";
\r
120 static const char user_config_comment[] =
\r
121 " User configuration\n"
\r
122 @@ -113,6 +119,8 @@ struct _notmuch_config {
\r
123 size_t new_tags_length;
\r
124 const char **new_ignore;
\r
125 size_t new_ignore_length;
\r
126 + const char **new_scan;
\r
127 + size_t new_scan_length;
\r
128 notmuch_bool_t maildir_synchronize_flags;
\r
129 const char **search_exclude_tags;
\r
130 size_t search_exclude_tags_length;
\r
131 @@ -274,6 +282,8 @@ notmuch_config_open (void *ctx,
\r
132 config->new_tags_length = 0;
\r
133 config->new_ignore = NULL;
\r
134 config->new_ignore_length = 0;
\r
135 + config->new_scan = NULL;
\r
136 + config->new_scan_length = 0;
\r
137 config->maildir_synchronize_flags = TRUE;
\r
138 config->search_exclude_tags = NULL;
\r
139 config->search_exclude_tags_length = 0;
\r
140 @@ -375,6 +385,10 @@ notmuch_config_open (void *ctx,
\r
141 notmuch_config_set_new_ignore (config, NULL, 0);
\r
144 + if (notmuch_config_get_new_scan (config, &tmp) == NULL) {
\r
145 + notmuch_config_set_new_scan (config, NULL, 0);
\r
148 if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {
\r
150 const char *tags[] = { "deleted", "spam" };
\r
151 @@ -631,6 +645,14 @@ notmuch_config_get_new_ignore (notmuch_config_t *config, size_t *length)
\r
152 &(config->new_ignore_length), length);
\r
156 +notmuch_config_get_new_scan (notmuch_config_t *config, size_t *length)
\r
158 + return _config_get_list (config, "new", "scan",
\r
159 + &(config->new_scan),
\r
160 + &(config->new_scan_length), length);
\r
164 notmuch_config_set_user_other_email (notmuch_config_t *config,
\r
165 const char *list[],
\r
166 @@ -658,6 +680,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
\r
167 &(config->new_ignore));
\r
171 +notmuch_config_set_new_scan (notmuch_config_t *config,
\r
172 + const char *list[],
\r
175 + _config_set_list (config, "new", "scan", list, length,
\r
176 + &(config->new_scan));
\r
180 notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length)
\r
182 diff --git a/notmuch-new.c b/notmuch-new.c
\r
183 index 938ae29..8377750 100644
\r
184 --- a/notmuch-new.c
\r
185 +++ b/notmuch-new.c
\r
186 @@ -607,6 +607,16 @@ add_files (notmuch_database_t *notmuch,
\r
190 +/* Call out to the appropriate add_files function, based on the URI. */
\r
191 +static notmuch_status_t
\r
192 +add_files_uri (unused(notmuch_database_t *notmuch),
\r
193 + unused(const char *uri),
\r
194 + unused(add_files_state_t *state))
\r
196 + /* Stub for now */
\r
197 + return NOTMUCH_STATUS_SUCCESS;
\r
201 setup_progress_printing_timer (void)
\r
203 @@ -832,6 +842,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
206 const char *db_path;
\r
207 + const char **new_scan;
\r
208 + size_t new_scan_length, new_scan_i;
\r
209 char *dot_notmuch_path;
\r
210 struct sigaction action;
\r
211 _filename_node_t *f;
\r
212 @@ -930,6 +942,12 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
213 timer_is_active = TRUE;
\r
216 + new_scan = notmuch_config_get_new_scan (config, &new_scan_length);
\r
218 + for (new_scan_i = 0; new_scan_i < new_scan_length; new_scan_i++) {
\r
219 + add_files_uri (notmuch, new_scan[new_scan_i], &add_files_state);
\r
222 ret = add_files (notmuch, db_path, &add_files_state);
\r
225 diff --git a/test/config b/test/config
\r
226 index 93ecb13..b0ad0c1 100755
\r
229 @@ -52,6 +52,7 @@ user.primary_email=test_suite@notmuchmail.org
\r
230 user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
\r
231 new.tags=unread;inbox;
\r
234 search.exclude_tags=
\r
235 maildir.synchronize_flags=true
\r
236 foo.string=this is another string value
\r