return NOTMUCH_STATUS_READ_ONLY_DATABASE;
}
+ if (! notmuch->open) {
+ _notmuch_database_log (notmuch, "Cannot write to a closed database.\n");
+ return NOTMUCH_STATUS_CLOSED_DATABASE;
+ }
+
return NOTMUCH_STATUS_SUCCESS;
}
notmuch->date_range_processor = NULL;
delete notmuch->last_mod_range_processor;
notmuch->last_mod_range_processor = NULL;
+ delete notmuch->stemmer;
+ notmuch->stemmer = NULL;
talloc_free (notmuch);
notmuch_query_t *query = NULL;
unsigned int count = 0, total = 0;
- status = _notmuch_database_ensure_writable (notmuch);
- if (status)
- return status;
+ if (_notmuch_database_mode (notmuch) != NOTMUCH_DATABASE_MODE_READ_WRITE)
+ return NOTMUCH_STATUS_READ_ONLY_DATABASE;
db = notmuch->writable_xapian_db;
if (status == NOTMUCH_STATUS_SUCCESS && message) {
status = _notmuch_message_remove_filename (message, filename);
if (status == NOTMUCH_STATUS_SUCCESS)
- _notmuch_message_delete (message);
+ status = _notmuch_message_delete (message);
else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
_notmuch_message_sync (message);