--- /dev/null
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id EF2EC431FC2\r
+ for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.061\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.061 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id UD8P465nqgBD for <notmuch@notmuchmail.org>;\r
+ Mon, 25 Jun 2012 13:53:49 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 03C28431FAF for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:48 -0700\r
+ (PDT)\r
+Received: by wgbdt14 with SMTP id dt14so3710368wgb.2\r
+ for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:47 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=FHnNafQToxQ2x10ZyiW9HfN0hgVl0OZ7fBfEXC9nMDQ=;\r
+ b=y3OJNmxcyoNOXQLd74YHiYjmfszW8WcMnJa+Y5ottk4XP4XfeLF+3h7xJjqMEctrwr\r
+ 0E0JYx5u0I1yPy4zTcLw17gAmkiRtPz5kNCAxPz4ADAOKeA9RhDHIvRPNHkZzzO5EJKx\r
+ YK08IMIyULkJrLXou2bxYTV26bAuHh7XP7laWEMVcdJ6PRZX544hV+2n10VhUKJW2xNC\r
+ YN9EDlni5K55eWWRFcgyBzpUcTqnNmNPk1YN2rQ45vPzk32vZ2/G10L2o9aZRPp/Lkh4\r
+ E5FOiZAwGUrd4Eo9NuDHTd/VPlAau+hYJYOP2TD+wPrbKHo8WjUc3VmZD8Yu+Dl2GSJG\r
+ J2/w==\r
+Received: by 10.180.80.37 with SMTP id o5mr27148754wix.12.1340657627636;\r
+ Mon, 25 Jun 2012 13:53:47 -0700 (PDT)\r
+Received: from localhost ([195.24.209.21])\r
+ by mx.google.com with ESMTPS id hs8sm37653wib.10.2012.06.25.13.53.31\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Mon, 25 Jun 2012 13:53:35 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 10/14] new: add "scan" option\r
+Date: Mon, 25 Jun 2012 16:51:53 -0400\r
+Message-Id: <1340657517-6539-6-git-send-email-ethan@betacantrips.com>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>\r
+References: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>\r
+X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 25 Jun 2012 20:53:50 -0000\r
+\r
+This is just a quick hack to get started on adding an mbox backend.\r
+\r
+The fact that the default maildir is scanned "automagically" is a\r
+little weird, but it doesn't do any harm unless you decide to put mail\r
+there that you really don't want indexed.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+ notmuch-client.h | 9 +++++++++\r
+ notmuch-config.c | 30 +++++++++++++++++++++++++++++-\r
+ notmuch-new.c | 18 ++++++++++++++++++\r
+ test/config | 1 +\r
+ 4 files changed, 57 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 9b63eae..9d922fe 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -256,6 +256,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,\r
+ const char *new_ignore[],\r
+ size_t length);\r
+ \r
++const char **\r
++notmuch_config_get_new_scan (notmuch_config_t *config,\r
++ size_t *length);\r
++\r
++void\r
++notmuch_config_set_new_scan (notmuch_config_t *config,\r
++ const char *new_scan[],\r
++ size_t length);\r
++\r
+ notmuch_bool_t\r
+ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);\r
+ \r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index 3e37a2d..e9d99ea 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -50,7 +50,10 @@ static const char new_config_comment[] =\r
+ "\t that will not be searched for messages by \"notmuch new\".\n"\r
+ "\n"\r
+ "\t NOTE: *Every* file/directory that goes by one of those names will\n"\r
+- "\t be ignored, independent of its depth/location in the mail store.\n";\r
++ "\t be ignored, independent of its depth/location in the mail store.\n"\r
++ "\n"\r
++ "\tscan A list (separated by ';') of mail URLs to scan.\n"\r
++ "\t The maildir located at database.path, above, will automatically be added.\n";\r
+ \r
+ static const char user_config_comment[] =\r
+ " User configuration\n"\r
+@@ -113,6 +116,8 @@ struct _notmuch_config {\r
+ size_t new_tags_length;\r
+ const char **new_ignore;\r
+ size_t new_ignore_length;\r
++ const char **new_scan;\r
++ size_t new_scan_length;\r
+ notmuch_bool_t maildir_synchronize_flags;\r
+ const char **search_exclude_tags;\r
+ size_t search_exclude_tags_length;\r
+@@ -274,6 +279,8 @@ notmuch_config_open (void *ctx,\r
+ config->new_tags_length = 0;\r
+ config->new_ignore = NULL;\r
+ config->new_ignore_length = 0;\r
++ config->new_scan = NULL;\r
++ config->new_scan_length = 0;\r
+ config->maildir_synchronize_flags = TRUE;\r
+ config->search_exclude_tags = NULL;\r
+ config->search_exclude_tags_length = 0;\r
+@@ -375,6 +382,10 @@ notmuch_config_open (void *ctx,\r
+ notmuch_config_set_new_ignore (config, NULL, 0);\r
+ }\r
+ \r
++ if (notmuch_config_get_new_scan (config, &tmp) == NULL) {\r
++ notmuch_config_set_new_scan (config, NULL, 0);\r
++ }\r
++\r
+ if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {\r
+ if (is_new) {\r
+ const char *tags[] = { "deleted", "spam" };\r
+@@ -631,6 +642,14 @@ notmuch_config_get_new_ignore (notmuch_config_t *config, size_t *length)\r
+ &(config->new_ignore_length), length);\r
+ }\r
+ \r
++const char **\r
++notmuch_config_get_new_scan (notmuch_config_t *config, size_t *length)\r
++{\r
++ return _config_get_list (config, "new", "scan",\r
++ &(config->new_scan),\r
++ &(config->new_scan_length), length);\r
++}\r
++\r
+ void\r
+ notmuch_config_set_user_other_email (notmuch_config_t *config,\r
+ const char *list[],\r
+@@ -658,6 +677,15 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,\r
+ &(config->new_ignore));\r
+ }\r
+ \r
++void\r
++notmuch_config_set_new_scan (notmuch_config_t *config,\r
++ const char *list[],\r
++ size_t length)\r
++{\r
++ _config_set_list (config, "new", "scan", list, length,\r
++ &(config->new_scan));\r
++}\r
++\r
+ const char **\r
+ notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length)\r
+ {\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 1f11b2c..57b27bf 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -239,6 +239,16 @@ _entry_in_ignore_list (const char *entry, add_files_state_t *state)\r
+ return FALSE;\r
+ }\r
+ \r
++/* Call out to the appropriate add_files function, based on the URI. */\r
++static notmuch_status_t\r
++add_files_uri (unused(notmuch_database_t *notmuch),\r
++ unused(const char *uri),\r
++ unused(add_files_state_t *state))\r
++{\r
++ /* Stub for now */\r
++ return NOTMUCH_STATUS_SUCCESS;\r
++}\r
++\r
+ /* Examine 'path' recursively as follows:\r
+ *\r
+ * o Ask the filesystem for the mtime of 'path' (fs_mtime)\r
+@@ -843,6 +853,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
+ int ret = 0;\r
+ struct stat st;\r
+ const char *db_path;\r
++ const char **new_scan;\r
++ size_t new_scan_length, new_scan_i;\r
+ char *dot_notmuch_path;\r
+ struct sigaction action;\r
+ _filename_node_t *f;\r
+@@ -941,6 +953,12 @@ notmuch_new_command (void *ctx, int argc, char *argv[])\r
+ timer_is_active = TRUE;\r
+ }\r
+ \r
++ new_scan = notmuch_config_get_new_scan (config, &new_scan_length);\r
++\r
++ for (new_scan_i = 0; new_scan_i < new_scan_length; new_scan_i++) {\r
++ add_files_uri (notmuch, new_scan[new_scan_i], &add_files_state);\r
++ }\r
++\r
+ ret = add_files (notmuch, db_path, &add_files_state);\r
+ if (ret)\r
+ goto DONE;\r
+diff --git a/test/config b/test/config\r
+index 93ecb13..b0ad0c1 100755\r
+--- a/test/config\r
++++ b/test/config\r
+@@ -52,6 +52,7 @@ user.primary_email=test_suite@notmuchmail.org\r
+ user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org\r
+ new.tags=unread;inbox;\r
+ new.ignore=\r
++new.scan=\r
+ search.exclude_tags=\r
+ maildir.synchronize_flags=true\r
+ foo.string=this is another string value\r
+-- \r
+1.7.9.5\r
+\r