X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.h;h=b63a7d77b7616ae1f8bf12d3a68b7022d49fa28a;hp=873c88d227732c7349b330cdaf667ea4c3554336;hb=55c8ee9a862f8f25be84adb591564b3777d88135;hpb=10c176ba0e6d71e920b72a3165c0e56f26b5e4b3 diff --git a/notmuch.h b/notmuch.h index 873c88d2..b63a7d77 100644 --- a/notmuch.h +++ b/notmuch.h @@ -40,10 +40,14 @@ NOTMUCH_BEGIN_DECLS * NOTMUCH_STATUS_SUCCESS: No error occurred. * * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred + * + * NOTMUCH_STATUS_FILE_NOT_EMAIL: A file was presented that doesn't + * appear to be an email message. */ typedef enum _notmuch_status { NOTMUCH_STATUS_SUCCESS = 0, - NOTMUCH_STATUS_XAPIAN_EXCEPTION + NOTMUCH_STATUS_XAPIAN_EXCEPTION, + NOTMUCH_STATUS_FILE_NOT_EMAIL } notmuch_status_t; /* An opaque data structure representing a notmuch database. See @@ -106,6 +110,23 @@ notmuch_database_open (const char *path); void notmuch_database_close (notmuch_database_t *database); +/* Lookup the default database path. + * + * This is the path that will be used by notmuch_database_create and + * notmuch_database_open if given a NULL path. Specifically it will be + * the value of the NOTMUCH_BASE environment variable if set, + * otherwise ${HOME}/mail + * + * Returns a newly allocated string which the caller should free() + * when finished with it. + */ +char * +notmuch_database_default_path (void); + +/* Return the database path of the given database. + * + * The return value is a string owned by notmuch so should not be + * modified nor freed by the caller. */ const char * notmuch_database_get_path (notmuch_database_t *database); @@ -116,7 +137,15 @@ notmuch_database_get_path (notmuch_database_t *database); * single mail message (not a multi-message mbox) that is expected to * remain at its current location, (since the notmuch database will * reference the filename, and will not copy the entire contents of - * the file. */ + * the file. + * + * Return value: + * + * NOTMUCH_STATUS_SUCCESS: Message successfully added to database. + * + * NOTMUCH_STATUS_FILE_NOT_EMAIL: the contents of filename don't look + * like an email message. Nothing added to the database. + */ notmuch_status_t notmuch_database_add_message (notmuch_database_t *database, const char *filename);