diff --git a/lib/Makefile.local b/lib/Makefile.local index 0b5c4b08..93b08d15 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -43,6 +43,7 @@ libnotmuch_c_srcs = \ $(dir)/sha1.c \ $(dir)/built-with.c \ $(dir)/string-map.c \ + $(dir)/indexopts.c \ $(dir)/tags.c libnotmuch_cxx_srcs = \ diff --git a/lib/add-message.cc b/lib/add-message.cc index 7b5cb702..73bde7fa 100644 --- a/lib/add-message.cc +++ b/lib/add-message.cc @@ -460,7 +460,7 @@ _notmuch_database_link_message (notmuch_database_t *notmuch, notmuch_status_t notmuch_database_index_file (notmuch_database_t *notmuch, const char *filename, - notmuch_param_t unused (*indexopts), + notmuch_indexopts_t unused (*indexopts), notmuch_message_t **message_ret) { notmuch_message_file_t *message_file; diff --git a/lib/indexopts.c b/lib/indexopts.c new file mode 100644 index 00000000..2f9b841b --- /dev/null +++ b/lib/indexopts.c @@ -0,0 +1,33 @@ +/* indexopts.c - options for indexing messages (currently a stub) + * + * Copyright © 2017 Daniel Kahn Gillmor + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/ . + * + * Author: Daniel Kahn Gillmor + */ + +#include "notmuch-private.h" + +notmuch_indexopts_t * +notmuch_database_get_default_indexopts (notmuch_database_t unused (*db)) +{ + return NULL; +} + +void +notmuch_indexopts_destroy (notmuch_indexopts_t *indexopts) +{ + talloc_free (indexopts); +} diff --git a/lib/message.cc b/lib/message.cc index 539d3320..98a88d3a 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1939,7 +1939,7 @@ _notmuch_message_frozen (notmuch_message_t *message) notmuch_status_t notmuch_message_reindex (notmuch_message_t *message, - notmuch_param_t unused (*indexopts)) + notmuch_indexopts_t unused (*indexopts)) { notmuch_database_t *notmuch = NULL; notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS; diff --git a/lib/notmuch.h b/lib/notmuch.h index a64efc17..e025bc1f 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -219,7 +219,7 @@ typedef struct _notmuch_tags notmuch_tags_t; typedef struct _notmuch_directory notmuch_directory_t; typedef struct _notmuch_filenames notmuch_filenames_t; typedef struct _notmuch_config_list notmuch_config_list_t; -typedef struct _notmuch_param notmuch_param_t; +typedef struct _notmuch_indexopts notmuch_indexopts_t; #endif /* __DOXYGEN__ */ /** @@ -603,7 +603,7 @@ notmuch_database_get_directory (notmuch_database_t *database, notmuch_status_t notmuch_database_index_file (notmuch_database_t *database, const char *filename, - notmuch_param_t *indexopts, + notmuch_indexopts_t *indexopts, notmuch_message_t **message); /** @@ -1430,7 +1430,7 @@ notmuch_message_get_filenames (notmuch_message_t *message); */ notmuch_status_t notmuch_message_reindex (notmuch_message_t *message, - notmuch_param_t *indexopts); + notmuch_indexopts_t *indexopts); /** * Message flags. @@ -2172,6 +2172,31 @@ notmuch_config_list_move_to_next (notmuch_config_list_t *config_list); void notmuch_config_list_destroy (notmuch_config_list_t *config_list); + +/** + * get the current default indexing options for a given database. + * + * This object will survive until the database itself is destroyed, + * but the caller may also release it earlier with + * notmuch_indexopts_destroy. + * + * This object represents a set of options on how a message can be + * added to the index. At the moment it is a featureless stub. + * + * @since libnotmuch 5.1 (notmuch 0.26) + */ +notmuch_indexopts_t * +notmuch_database_get_default_indexopts (notmuch_database_t *db); + +/** + * Destroy a notmuch_indexopts_t object. + * + * @since libnotmuch 5.1 (notmuch 0.26) + */ +void +notmuch_indexopts_destroy (notmuch_indexopts_t *options); + + /** * interrogate the library for compile time features * diff --git a/notmuch-reindex.c b/notmuch-reindex.c index 44223042..bceac722 100644 --- a/notmuch-reindex.c +++ b/notmuch-reindex.c @@ -40,7 +40,7 @@ handle_sigint (unused (int sig)) */ static int reindex_query (notmuch_database_t *notmuch, const char *query_string, - notmuch_param_t *indexopts) + notmuch_indexopts_t *indexopts) { notmuch_query_t *query; notmuch_messages_t *messages; @@ -89,7 +89,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[]) struct sigaction action; int opt_index; int ret; - notmuch_param_t *indexopts = NULL; + notmuch_indexopts_t *indexopts = NULL; /* Set up our handler for SIGINT */ memset (&action, 0, sizeof (struct sigaction));