Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 23FBE404965 for ; Thu, 18 Mar 2010 08:40:59 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.269 X-Spam-Level: X-Spam-Status: No, score=-2.269 tagged_above=-999 required=5 tests=[AWL=0.330, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OKmA-PbJGQQg for ; Thu, 18 Mar 2010 08:40:55 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 81BEE404964 for ; Thu, 18 Mar 2010 08:40:54 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id E82B719F3409; Thu, 18 Mar 2010 16:40:53 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id xS-7LdHy5MBJ; Thu, 18 Mar 2010 16:40:51 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 1D18519F3401; Thu, 18 Mar 2010 16:40:51 +0100 (CET) Received: from steelpick.localdomain (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id ED612FA004; Thu, 18 Mar 2010 16:40:50 +0100 (CET) Received: from wsh by steelpick.localdomain with local (Exim 4.71) (envelope-from ) id 1NsHq6-0005Hf-It; Thu, 18 Mar 2010 16:40:50 +0100 From: Michal Sojka To: notmuch@notmuchmail.org Date: Thu, 18 Mar 2010 16:39:37 +0100 Message-Id: <1268926780-20045-2-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1268926780-20045-1-git-send-email-sojkam1@fel.cvut.cz> References: <1268926780-20045-1-git-send-email-sojkam1@fel.cvut.cz> Subject: [notmuch] [PATCH 1/4] Mailstore abstraction interface X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2010 15:40:59 -0000 The goal of mailstore abstraction is to allow notmuch to store tags together with email messages. The abstract interface is needed because people want to use different ways of storing their emails. This patchseries implements two types of mailstore - plain files and maildir. It is expected that additional git-based mailstore will follow. This patch contains only the interface changes. No functionality is added, removed or changed. A new configuration group [mailstore] is defined. Currently, there is only one key 'type' whose value determines the used mailstore. The default value of this option is the plain-file mailstore currently implemented in notmuch. Signed-off-by: Michal Sojka --- lib/Makefile.local | 2 + lib/database-private.h | 1 + lib/database.cc | 15 ++++++-- lib/mailstore-files.c | 43 ++++++++++++++++++++++++ lib/mailstore-private.h | 59 ++++++++++++++++++++++++++++++++ lib/mailstore.c | 77 ++++++++++++++++++++++++++++++++++++++++++ lib/message.cc | 13 +++++++ lib/notmuch.h | 85 ++++++++++++++++++++++++++++++++++++++++++++-- notmuch-client.h | 7 ++++ notmuch-config.c | 34 +++++++++++++++++++ notmuch-count.c | 3 +- notmuch-dump.c | 3 +- notmuch-new.c | 6 ++- notmuch-reply.c | 3 +- notmuch-restore.c | 3 +- notmuch-search-tags.c | 3 +- notmuch-search.c | 3 +- notmuch-show.c | 3 +- notmuch-tag.c | 3 +- 19 files changed, 348 insertions(+), 18 deletions(-) create mode 100644 lib/mailstore-files.c create mode 100644 lib/mailstore-private.h create mode 100644 lib/mailstore.c diff --git a/lib/Makefile.local b/lib/Makefile.local index 495b27e..fc8883d 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -3,6 +3,8 @@ extra_cflags += -I$(dir) libnotmuch_c_srcs = \ $(dir)/libsha1.c \ + $(dir)/mailstore.c \ + $(dir)/mailstore-files.c\ $(dir)/message-file.c \ $(dir)/messages.c \ $(dir)/sha1.c \ diff --git a/lib/database-private.h b/lib/database-private.h index 41918d7..4499b1a 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -49,6 +49,7 @@ struct _notmuch_database { Xapian::TermGenerator *term_gen; Xapian::ValueRangeProcessor *value_range_processor; + notmuch_mailstore_t *mailstore; }; /* Convert tags from Xapian internal format to notmuch format. diff --git a/lib/database.cc b/lib/database.cc index c91e97c..93c8d0f 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -19,6 +19,7 @@ */ #include "database-private.h" +#include "mailstore-private.h" #include @@ -438,7 +439,7 @@ parse_references (void *ctx, } notmuch_database_t * -notmuch_database_create (const char *path) +notmuch_database_create (const char *path, notmuch_mailstore_t *mailstore) { notmuch_database_t *notmuch = NULL; char *notmuch_path = NULL; @@ -474,7 +475,8 @@ notmuch_database_create (const char *path) } notmuch = notmuch_database_open (path, - NOTMUCH_DATABASE_MODE_READ_WRITE); + NOTMUCH_DATABASE_MODE_READ_WRITE, + mailstore); notmuch_database_upgrade (notmuch, NULL, NULL); DONE: @@ -497,7 +499,8 @@ _notmuch_database_ensure_writable (notmuch_database_t *notmuch) notmuch_database_t * notmuch_database_open (const char *path, - notmuch_database_mode_t mode) + notmuch_database_mode_t mode, + notmuch_mailstore_t *mailstore) { notmuch_database_t *notmuch = NULL; char *notmuch_path = NULL, *xapian_path = NULL; @@ -605,6 +608,9 @@ notmuch_database_open (const char *path, prefix_t *prefix = &PROBABILISTIC_PREFIX[i]; notmuch->query_parser->add_prefix (prefix->name, prefix->prefix); } + + notmuch->mailstore = mailstore; + mailstore->notmuch = notmuch; } catch (const Xapian::Error &error) { fprintf (stderr, "A Xapian exception occurred opening database: %s\n", error.get_msg().c_str()); @@ -1493,7 +1499,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch, DONE: if (message) { - if (ret == NOTMUCH_STATUS_SUCCESS && message_ret) + if ((ret == NOTMUCH_STATUS_SUCCESS || + ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) && message_ret) *message_ret = message; else notmuch_message_destroy (message); diff --git a/lib/mailstore-files.c b/lib/mailstore-files.c new file mode 100644 index 0000000..92d7f5d --- /dev/null +++ b/lib/mailstore-files.c @@ -0,0 +1,43 @@ +/* mailstore-files.c - Original notmuch mail store - a collection of + * plain-text email messages (one message per file). + * + * Copyright © 2009 Carl Worth + * + * 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 http://www.gnu.org/licenses/ . + * + * Authors: Carl Worth + * Michal Sojka + */ + +#include "notmuch.h" +#include "mailstore-private.h" + + +static FILE * +open_file(notmuch_mailstore_t *mailstore, const char *filename) +{ + const char *db_path, *abs_filename; + + db_path = notmuch_database_get_path(mailstore->notmuch); + abs_filename = talloc_asprintf(mailstore, "%s/%s", db_path, filename); + if (unlikely(abs_filename == NULL)) + return NULL; + return fopen (abs_filename, "r"); +} + +/* Original notmuch mail store */ +struct _notmuch_mailstore mailstore_files = { + .type = "files", + .open_file = open_file, +}; diff --git a/lib/mailstore-private.h b/lib/mailstore-private.h new file mode 100644 index 0000000..f606e3f --- /dev/null +++ b/lib/mailstore-private.h @@ -0,0 +1,59 @@ +/* mailstore-private.h - Mailstore abstraction + * + * Copyright © 2010 Michal Sojka + * + * 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 http://www.gnu.org/licenses/ . + * + * Author: Michal Sojka + */ + +#ifndef MAILSTORE_PRIVATE_H +#define MAILSTORE_PRIVATE_H + +#include "notmuch-private.h" + +struct _notmuch_mailstore { + /* Constant fields */ + const char *type; /* identification in .notmuch-config */ + void *priv; + + /* Count files in mailstore so that initial invocation of notmuch + * new can report remaining time */ + void (*count_files)(notmuch_mailstore_t *mailstore, + const char *path, int *count, + volatile sig_atomic_t *interrupted); + /* Scan for new messages and add them to the database. */ + notmuch_private_status_t (*index_new)(notmuch_mailstore_t *mailstore, + const char* path, + notmuch_indexing_context_t *ctx); + /* Store the tags assigned to the 'messages' to the + * 'mailstore'. */ + notmuch_private_status_t (*sync_tags)(notmuch_mailstore_t *mailstore, + notmuch_message_t *message); + /* Return file handle from which the message can be read. + * + * Currently, this is not used and all message access is hardcoded + * to notmuch. We will need this operation for git-based and other + * non-filesystem mailstores. */ + FILE * (*open_file)(notmuch_mailstore_t *mailstore, + const char *filename); + + /* Run-time fields */ + notmuch_database_t *notmuch; +}; + +extern struct _notmuch_mailstore mailstore_files; +extern struct _notmuch_mailstore mailstore_maildir; + +#endif /* MAILSTORE_PRIVATE_H */ diff --git a/lib/mailstore.c b/lib/mailstore.c new file mode 100644 index 0000000..cdac9a6 --- /dev/null +++ b/lib/mailstore.c @@ -0,0 +1,77 @@ +/* mailstore.c - Mailstore abstraction + * + * Copyright © 2010 Michal Sojka + * + * 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 http://www.gnu.org/licenses/ . + * + * Author: Michal Sojka + */ + +#include +#include "mailstore-private.h" + +#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0])) + +static notmuch_mailstore_t *available[] = { + &mailstore_files, +}; + +notmuch_mailstore_t * +notmuch_mailstore_get_by_type (const char *type) +{ + unsigned i; + + if (type == NULL) + return available[0]; + + for (i = 0; i < ARRAY_SIZE(available); i++) { + if (strcasecmp (type, available[i]->type) == 0) + return available[i]; + } + return NULL; +} + +const char * +notmuch_mailstore_get_type (notmuch_mailstore_t *mailstore) +{ + if (!mailstore) + return NULL; + + return mailstore->type; +} + +void +notmuch_mailstore_count_files (notmuch_mailstore_t *mailstore, + const char *path, int *count, + volatile sig_atomic_t *interrupted) +{ + mailstore->count_files (mailstore, path, count, interrupted); +} + +notmuch_status_t +notmuch_mailstore_index_new (notmuch_mailstore_t *mailstore, + const char *path, + notmuch_indexing_context_t *ctx) +{ + notmuch_private_status_t status; + status = mailstore->index_new (mailstore, path, ctx); + return COERCE_STATUS (status, "Index new"); +} + +FILE * +notmuch_mailstore_open_file (notmuch_mailstore_t *mailstore, + const char *filename) +{ + return mailstore->open_file (mailstore, filename); +} diff --git a/lib/message.cc b/lib/message.cc index 721c9a6..c32ee7d 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -20,6 +20,7 @@ #include "notmuch-private.h" #include "database-private.h" +#include "mailstore-private.h" #include @@ -555,10 +556,22 @@ void _notmuch_message_sync (notmuch_message_t *message) { Xapian::WritableDatabase *db; + notmuch_private_status_t status; if (message->notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) return; + if (message->notmuch->mailstore->sync_tags) { + status = message->notmuch->mailstore->sync_tags (message->notmuch->mailstore, + message); + if (status != NOTMUCH_PRIVATE_STATUS_SUCCESS) { + fprintf (stderr, "Error: Cannot sync tags to mailstore (%s)\n", + notmuch_status_to_string ((notmuch_status_t)status)); + /* Exit to avoid unsynchronized mailstore. */ + exit(1); + } + } + db = static_cast (message->notmuch->xapian_db); db->replace_document (message->doc_id, message->doc); } diff --git a/lib/notmuch.h b/lib/notmuch.h index 0d9cb0f..4f4cc8b 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -32,6 +32,9 @@ NOTMUCH_BEGIN_DECLS #include +#include /* For struct timeval */ +#include /* For sig_atomic_t */ +#include /* For FILE */ #ifndef FALSE #define FALSE 0 @@ -119,6 +122,8 @@ typedef struct _notmuch_message notmuch_message_t; typedef struct _notmuch_tags notmuch_tags_t; typedef struct _notmuch_directory notmuch_directory_t; typedef struct _notmuch_filenames notmuch_filenames_t; +typedef struct _notmuch_mailstore notmuch_mailstore_t; + /* Create a new, empty notmuch database located at 'path'. * @@ -127,6 +132,8 @@ typedef struct _notmuch_filenames notmuch_filenames_t; * create a new ".notmuch" directory within 'path' where notmuch will * store its data. * + * FIXME: Mailstore... + * * After a successful call to notmuch_database_create, the returned * database will be open so the caller should call * notmuch_database_close when finished with it. @@ -140,7 +147,7 @@ typedef struct _notmuch_filenames notmuch_filenames_t; * an error message on stderr). */ notmuch_database_t * -notmuch_database_create (const char *path); +notmuch_database_create (const char *path, notmuch_mailstore_t *mailstore); typedef enum { NOTMUCH_DATABASE_MODE_READ_ONLY = 0, @@ -152,6 +159,8 @@ typedef enum { /* Open an existing notmuch database located at 'path'. * + * The database will index mails stored in 'mailstore'. + * * The database should have been created at some time in the past, * (not necessarily by this process), by calling * notmuch_database_create with 'path'. By default the database should be @@ -169,7 +178,8 @@ typedef enum { */ notmuch_database_t * notmuch_database_open (const char *path, - notmuch_database_mode_t mode); + notmuch_database_mode_t mode, + notmuch_mailstore_t *mailstore); /* Close the given notmuch database, freeing all associated * resources. See notmuch_database_open. */ @@ -236,7 +246,8 @@ notmuch_database_get_directory (notmuch_database_t *database, * notmuch database will reference the filename, and will not copy the * entire contents of the file. * - * If 'message' is not NULL, then, on successful return '*message' + * If 'message' is not NULL, then, on successful return + * (NOTMUCH_STATUS_SUCCESS or NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) '*message' * will be initialized to a message object that can be used for things * such as adding tags to the just-added message. The user should call * notmuch_message_destroy when done with the message. On any failure @@ -495,7 +506,7 @@ notmuch_threads_destroy (notmuch_threads_t *threads); */ unsigned notmuch_query_count_messages (notmuch_query_t *query); - + /* Get the thread ID of 'thread'. * * The returned string belongs to 'thread' and as such, should not be @@ -1104,6 +1115,72 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames); void notmuch_filenames_destroy (notmuch_filenames_t *filenames); +/* Returns notmuch_mailstore_t object of a given 'type'. + * + * The 'type' is case insensitive. If 'type' is NULL, a default + * mailstore is returned. + * + * When no available mailstore matches 'type', NULL is returned. + */ +notmuch_mailstore_t * +notmuch_mailstore_get_by_type (const char *type); + +/* Returns the type of a mailstore. + * + * The returned string is owned by mailstore so should not be modified + * nor freed by the caller. + */ +const char * +notmuch_mailstore_get_type (notmuch_mailstore_t *mailstore); + +/* Count emails in mailstore. + * + * This function returns when interrupted is set to non-zero value. + */ +void +notmuch_mailstore_count_files (notmuch_mailstore_t *mailstore, + const char *path, int *count, + volatile sig_atomic_t *interrupted); + +typedef struct notmuch_indexing_context { + int output_is_a_tty; + int verbose; + + int total_files; + int processed_files; + int added_messages; + int renamed_files; + int removed_files; + struct timeval tv_start; + + void *priv; + + volatile sig_atomic_t interrupted; + volatile sig_atomic_t print_progress; + void (*print_progress_cb)(struct notmuch_indexing_context *ctx); + +} notmuch_indexing_context_t; + + +/* Index new mails in the mailstore. + * + * Mailstore is responsible for detecting new emails, adding them to + * the database and tagging them with tags stored in the mailstore. + */ +notmuch_status_t +notmuch_mailstore_index_new (notmuch_mailstore_t *mailstore, + const char *path, + notmuch_indexing_context_t *ctx); + +/* Returns file handle to the file in the mailstore. + * + * TODO: This function is currently not used and access to mails is + * hardcoded in other parts of notmuch. + */ +FILE * +notmuch_mailstore_open_file (notmuch_mailstore_t *mailstore, + const char *filename); + NOTMUCH_END_DECLS #endif diff --git a/notmuch-client.h b/notmuch-client.h index c80b39c..4794b8e 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -171,6 +171,13 @@ notmuch_config_set_user_other_email (notmuch_config_t *config, const char *other_email[], size_t length); +notmuch_mailstore_t * +notmuch_config_get_mailstore(notmuch_config_t *config); + +void +notmuch_config_set_mailstore(notmuch_config_t *config, + notmuch_mailstore_t *mailstore); + notmuch_bool_t debugger_is_active (void); diff --git a/notmuch-config.c b/notmuch-config.c index 95430db..299423a 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -62,6 +62,7 @@ struct _notmuch_config { char *user_primary_email; char **user_other_email; size_t user_other_email_length; + notmuch_mailstore_t *mailstore; }; static int @@ -199,6 +200,7 @@ notmuch_config_open (void *ctx, config->user_primary_email = NULL; config->user_other_email = NULL; config->user_other_email_length = 0; + config->mailstore = NULL; if (! g_key_file_load_from_file (config->key_file, config->filename, @@ -264,6 +266,10 @@ notmuch_config_open (void *ctx, } } + if (notmuch_config_get_mailstore (config) == NULL) { + notmuch_config_set_mailstore(config, notmuch_mailstore_get_by_type(NULL)); + } + /* When we create a new configuration file here, we add some * comments to help the user understand what can be done. */ if (is_new) { @@ -452,3 +458,31 @@ notmuch_config_set_user_other_email (notmuch_config_t *config, talloc_free (config->user_other_email); config->user_other_email = NULL; } + +notmuch_mailstore_t * +notmuch_config_get_mailstore(notmuch_config_t *config) +{ + char *type; + + if (config->mailstore == NULL) { + type = g_key_file_get_string (config->key_file, + "mailstore", "type", NULL); + if (type) { + config->mailstore = notmuch_mailstore_get_by_type(type); + free (type); + } + } + + return config->mailstore; +} + +void +notmuch_config_set_mailstore(notmuch_config_t *config, + notmuch_mailstore_t *mailstore) +{ + g_key_file_set_string (config->key_file, + "mailstore", "type", + notmuch_mailstore_get_type(mailstore)); + + config->mailstore = NULL; +} diff --git a/notmuch-count.c b/notmuch-count.c index 77aa433..631b8f8 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -81,7 +81,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore(config)); if (notmuch == NULL) return 1; diff --git a/notmuch-dump.c b/notmuch-dump.c index 7e7bc17..e74dfcb 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -36,7 +36,8 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[]) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-new.c b/notmuch-new.c index 44b50aa..2d0ba6c 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -749,11 +749,13 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) return 1; printf ("Found %d total files (that's not much mail).\n", count); - notmuch = notmuch_database_create (db_path); + notmuch = notmuch_database_create (db_path, + notmuch_config_get_mailstore (config)); add_files_state.total_files = count; } else { notmuch = notmuch_database_open (db_path, - NOTMUCH_DATABASE_MODE_READ_WRITE); + NOTMUCH_DATABASE_MODE_READ_WRITE, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-reply.c b/notmuch-reply.c index 6c15536..0d6b7cf 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -468,7 +468,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) } notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-restore.c b/notmuch-restore.c index b0a4e1c..97d817b 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -37,7 +37,8 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE); + NOTMUCH_DATABASE_MODE_READ_WRITE, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-search-tags.c b/notmuch-search-tags.c index 6f3cfcc..323f416 100644 --- a/notmuch-search-tags.c +++ b/notmuch-search-tags.c @@ -52,7 +52,8 @@ notmuch_search_tags_command (void *ctx, int argc, char *argv[]) } db = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore (config)); if (db == NULL) { goto error; } diff --git a/notmuch-search.c b/notmuch-search.c index 4e3514b..d57479d 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -245,7 +245,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-show.c b/notmuch-show.c index ff1fecb..26581c1 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -458,7 +458,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) } notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_ONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; diff --git a/notmuch-tag.c b/notmuch-tag.c index 8b6f7dc..5e1a5c3 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -97,7 +97,8 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[])) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE); + NOTMUCH_DATABASE_MODE_READ_WRITE, + notmuch_config_get_mailstore (config)); if (notmuch == NULL) return 1; -- 1.7.0