-/* Examine 'path' recursively as follows:
- *
- * o Ask the filesystem for the mtime of 'path' (path_mtime)
- *
- * o Ask the database for its timestamp of 'path' (path_dbtime)
- *
- * o If 'path_mtime' > 'path_dbtime'
- *
- * o For each regular file in 'path' with mtime newer than the
- * 'path_dbtime' call add_message to add the file to the
- * database.
- *
- * o For each sub-directory of path, recursively call into this
- * same function.
- *
- * o Tell the database to update its time of 'path' to 'path_mtime'
- *
- * The 'struct stat *st' must point to a structure that has already
- * been initialized for 'path' by calling stat().
- */
-static notmuch_status_t
-add_files_recursive (notmuch_database_t *notmuch,
- const char *path,
- struct stat *st,
- add_files_state_t *state)
-{
- DIR *dir = NULL;
- struct dirent *e, *entry = NULL;
- int entry_length;
- int err;
- char *next = NULL;
- time_t path_mtime, path_dbtime;
- notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
-
- /* If we're told to, we bail out on encountering a read-only
- * directory, (with this being a clear clue from the user to
- * Notmuch that new mail won't be arriving there and we need not
- * look. */
- if (state->ignore_read_only_directories &&
- (st->st_mode & S_IWUSR) == 0)
- {
- state->saw_read_only_directory = TRUE;
- goto DONE;
- }
-
- path_mtime = st->st_mtime;
-
- path_dbtime = notmuch_database_get_timestamp (notmuch, path);
+static command_t commands[] = {
+ { NULL, notmuch_command, NOTMUCH_CONFIG_OPEN | NOTMUCH_CONFIG_CREATE,
+ "Notmuch main command." },
+ { "setup", notmuch_setup_command, NOTMUCH_CONFIG_OPEN | NOTMUCH_CONFIG_CREATE,
+ "Interactively set up notmuch for first use." },
+ { "new", notmuch_new_command, NOTMUCH_CONFIG_OPEN,
+ "Find and import new messages to the notmuch database." },
+ { "insert", notmuch_insert_command, NOTMUCH_CONFIG_OPEN,
+ "Add a new message into the maildir and notmuch database." },
+ { "search", notmuch_search_command, NOTMUCH_CONFIG_OPEN,
+ "Search for messages matching the given search terms." },
+ { "address", notmuch_address_command, NOTMUCH_CONFIG_OPEN,
+ "Get addresses from messages matching the given search terms." },
+ { "show", notmuch_show_command, NOTMUCH_CONFIG_OPEN,
+ "Show all messages matching the search terms." },
+ { "count", notmuch_count_command, NOTMUCH_CONFIG_OPEN,
+ "Count messages matching the search terms." },
+ { "reply", notmuch_reply_command, NOTMUCH_CONFIG_OPEN,
+ "Construct a reply template for a set of messages." },
+ { "tag", notmuch_tag_command, NOTMUCH_CONFIG_OPEN,
+ "Add/remove tags for all messages matching the search terms." },
+ { "dump", notmuch_dump_command, NOTMUCH_CONFIG_OPEN,
+ "Create a plain-text dump of the tags for each message." },
+ { "restore", notmuch_restore_command, NOTMUCH_CONFIG_OPEN,
+ "Restore the tags from the given dump file (see 'dump')." },
+ { "compact", notmuch_compact_command, NOTMUCH_CONFIG_OPEN,
+ "Compact the notmuch database." },
+ { "config", notmuch_config_command, NOTMUCH_CONFIG_OPEN,
+ "Get or set settings in the notmuch configuration file." },
+ { "help", notmuch_help_command, NOTMUCH_CONFIG_CREATE, /* create but don't save config */
+ "This message, or more detailed help for the named command." }
+};