diff --git a/TODO b/TODO index b0ee13ec..ea6c3c28 100644 --- a/TODO +++ b/TODO @@ -47,6 +47,9 @@ maildirs.) notmuch library --------------- +Add support for files that are moved or deleted (which obviously need +to be handled differently). + Actually compile and install a libnotmuch shared library. Fix to use the *last* Message-ID header if multiple such headers are diff --git a/lib/database.cc b/lib/database.cc index fb386647..95057a8f 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -441,7 +441,7 @@ notmuch_database_create (const char *path) } notmuch = notmuch_database_open (path, - NOTMUCH_DATABASE_MODE_WRITABLE); + NOTMUCH_DATABASE_MODE_READ_WRITE); DONE: if (notmuch_path) @@ -487,7 +487,7 @@ notmuch_database_open (const char *path, notmuch->mode = mode; try { - if (mode == NOTMUCH_DATABASE_MODE_WRITABLE) { + if (mode == NOTMUCH_DATABASE_MODE_READ_WRITE) { notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path, Xapian::DB_CREATE_OR_OPEN); } else { @@ -530,7 +530,7 @@ notmuch_database_open (const char *path, void notmuch_database_close (notmuch_database_t *notmuch) { - if (notmuch->mode == NOTMUCH_DATABASE_MODE_WRITABLE) + if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE) (static_cast (notmuch->xapian_db))->flush (); delete notmuch->term_gen; @@ -583,7 +583,7 @@ notmuch_database_set_timestamp (notmuch_database_t *notmuch, notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS; char *db_key = NULL; - if (notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY) { + if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) { fprintf (stderr, "Attempted to update a read-only database.\n"); return NOTMUCH_STATUS_READONLY_DATABASE; } diff --git a/lib/message.cc b/lib/message.cc index 7ba06c99..069cedb2 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -172,7 +172,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch, unsigned int doc_id; char *term; - if (notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY) { + if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) { *status_ret = NOTMUCH_PRIVATE_STATUS_READONLY_DATABASE; return NULL; } @@ -552,7 +552,7 @@ _notmuch_message_sync (notmuch_message_t *message) { Xapian::WritableDatabase *db; - if (message->notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY) + if (message->notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) return; db = static_cast (message->notmuch->xapian_db); diff --git a/lib/notmuch.h b/lib/notmuch.h index 89ed7ad8..bbeec559 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -137,14 +137,14 @@ typedef struct _notmuch_tags notmuch_tags_t; notmuch_database_t * notmuch_database_create (const char *path); +typedef enum { + NOTMUCH_DATABASE_MODE_READ_ONLY = 0, + NOTMUCH_DATABASE_MODE_READ_Write +} notmuch_database_mode_t; + /* XXX: I think I'd like this to take an extra argument of * notmuch_status_t* for returning a status value on failure. */ -typedef enum { - NOTMUCH_DATABASE_MODE_READONLY = 0, - NOTMUCH_DATABASE_MODE_WRITABLE -} notmuch_database_mode_t; - /* Open an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, diff --git a/notmuch-dump.c b/notmuch-dump.c index 86570d09..fc06f3f9 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -36,7 +36,7 @@ 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_READONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY); if (notmuch == NULL) return 1; diff --git a/notmuch-new.c b/notmuch-new.c index f241edf9..bc35b4e8 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -414,7 +414,7 @@ notmuch_new_command (void *ctx, add_files_state.total_files = count; } else { notmuch = notmuch_database_open (db_path, - NOTMUCH_DATABASE_MODE_READONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY); add_files_state.ignore_read_only_directories = TRUE; add_files_state.total_files = 0; } diff --git a/notmuch-reply.c b/notmuch-reply.c index 291cd024..44e17661 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -224,7 +224,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) } notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY); if (notmuch == NULL) return 1; diff --git a/notmuch-restore.c b/notmuch-restore.c index 001f3fcb..1b9598dc 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -37,7 +37,7 @@ 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_WRITABLE); + NOTMUCH_DATABASE_MODE_READ_WRITE); if (notmuch == NULL) return 1; diff --git a/notmuch-search.c b/notmuch-search.c index cde97351..aa6662bd 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -130,7 +130,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) return 1; notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY); if (notmuch == NULL) return 1; diff --git a/notmuch-show.c b/notmuch-show.c index a764e443..d727f302 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -221,7 +221,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) } notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READONLY); + NOTMUCH_DATABASE_MODE_READ_ONLY); if (notmuch == NULL) return 1; diff --git a/notmuch-tag.c b/notmuch-tag.c index 75d464f2..e2311f61 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -95,7 +95,7 @@ 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_WRITABLE); + NOTMUCH_DATABASE_MODE_READ_WRITE); if (notmuch == NULL) return 1;