[][src]Type Definition melib::backends::notmuch::bindings::notmuch_database_index_file

type notmuch_database_index_file = unsafe extern "C" fn(database: *mut notmuch_database_t, filename: *const c_char, indexopts: *mut notmuch_indexopts_t, message: *mut *mut notmuch_message_t) -> notmuch_status_t;

Add a message file to a database, indexing it for retrieval by future searches. If a message already exists with the same message ID as the specified file, their indexes will be merged, and this new filename will also be associated with the existing message.

Here, 'filename' should be a path relative to the path of 'database' (see notmuch_database_get_path), or else should be an absolute filename with initial components that match the path of 'database'.

The file should be a 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.

If another message with the same message ID already exists in the database, rather than creating a new message, this adds the search terms from the identified file to the existing message's index, and adds 'filename' to the list of filenames known for the message.

The 'indexopts' parameter can be NULL (meaning, use the indexing defaults from the database), or can be an explicit choice of indexing options that should govern the indexing of this specific 'filename'.

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 '*message' will be set to NULL.

Return value:

NOTMUCH_STATUS_SUCCESS: Message successfully added to database.

NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred, message not added.

NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: Message has the same message ID as another message already in the database. The new filename was successfully added to the message in the database (if not already present) and the existing message is returned.

NOTMUCH_STATUS_FILE_ERROR: an error occurred trying to open the file, (such as permission denied, or file not found, etc.). Nothing added to the database.

NOTMUCH_STATUS_FILE_NOT_EMAIL: the contents of filename don't look like an email message. Nothing added to the database.

NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only mode so no message can be added.

NOTMUCH_STATUS_UPGRADE_REQUIRED: The caller must upgrade the database to use this function.

@since libnotmuch 5.1 (notmuch 0.26)