]> git.cworth.org Git - notmuch/blobdiff - lib/database.cc
lib: Clarify internal documentation of _notmuch_database_filename_to_direntry
[notmuch] / lib / database.cc
index 510d13cbcd8ff09972164603b8adfe32495af4e5..125b37ebb6b5538d4d4d07cf2d6c3eaef2df7ee2 100644 (file)
@@ -199,7 +199,7 @@ notmuch_status_to_string (notmuch_status_t status)
     case NOTMUCH_STATUS_OUT_OF_MEMORY:
        return "Out of memory";
     case NOTMUCH_STATUS_READONLY_DATABASE:
-       return "The database is read-only";
+       return "Attempt to write to a read-only database";
     case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
        return "A Xapian exception occurred";
     case NOTMUCH_STATUS_FILE_ERROR:
@@ -723,6 +723,9 @@ _notmuch_database_get_directory_path (void *ctx,
  * database path or absolute with initial components identical to
  * database path), return a new string (with 'ctx' as the talloc
  * owner) suitable for use as a direntry term value.
+ *
+ * The necessary directory documents will be created in the database
+ * as needed.
  */
 notmuch_status_t
 _notmuch_database_filename_to_direntry (void *ctx,
@@ -1201,14 +1204,16 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
            strncmp ((*j).c_str (), prefix, strlen (prefix)))
        {
            db->delete_document (document.get_docid ());
+           status = NOTMUCH_STATUS_SUCCESS;
        } else {
            db->replace_document (document.get_docid (), document);
+           status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
        }
     }
 
     talloc_free (local);
 
-    return NOTMUCH_STATUS_SUCCESS;
+    return status;
 }
 
 notmuch_tags_t *