1 /* notmuch - Not much of an email library, (just index and search)
3 * Copyright © 2009 Carl Worth
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see http://www.gnu.org/licenses/ .
18 * Author: Carl Worth <cworth@cworth.org>
22 * @defgroup notmuch The notmuch API
24 * Not much of an email library, (just index and search)
35 # define NOTMUCH_BEGIN_DECLS extern "C" {
36 # define NOTMUCH_END_DECLS }
38 # define NOTMUCH_BEGIN_DECLS
39 # define NOTMUCH_END_DECLS
55 * The library version number. This must agree with the soname
56 * version in Makefile.local.
58 #define LIBNOTMUCH_MAJOR_VERSION 3
59 #define LIBNOTMUCH_MINOR_VERSION 1
60 #define LIBNOTMUCH_MICRO_VERSION 0
62 #endif /* __DOXYGEN__ */
65 * Check the version of the notmuch library being compiled against.
67 * Return true if the library being compiled against is of the
68 * specified version or above. For example:
71 * #if LIBNOTMUCH_CHECK_VERSION(3, 1, 0)
72 * (code requiring libnotmuch 3.1.0 or above)
76 * LIBNOTMUCH_CHECK_VERSION has been defined since version 3.1.0; to
77 * check for versions prior to that, use:
80 * #if !defined(NOTMUCH_CHECK_VERSION)
81 * (code requiring libnotmuch prior to 3.1.0)
85 #define LIBNOTMUCH_CHECK_VERSION (major, minor, micro) \
86 (LIBNOTMUCH_MAJOR_VERSION > (major) || \
87 (LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION > (minor)) || \
88 (LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION == (minor) && \
89 LIBNOTMUCH_MICRO_VERSION >= (micro)))
92 * Notmuch boolean type.
94 typedef int notmuch_bool_t;
97 * Status codes used for the return values of most functions.
99 * A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function
100 * completed without error. Any other value indicates an error.
102 typedef enum _notmuch_status {
106 NOTMUCH_STATUS_SUCCESS = 0,
110 NOTMUCH_STATUS_OUT_OF_MEMORY,
112 * An attempt was made to write to a database opened in read-only
115 NOTMUCH_STATUS_READ_ONLY_DATABASE,
117 * A Xapian exception occurred.
119 NOTMUCH_STATUS_XAPIAN_EXCEPTION,
121 * An error occurred trying to read or write to a file (this could
122 * be file not found, permission denied, etc.)
124 * @todo We don't really want to expose this lame XAPIAN_EXCEPTION
125 * value. Instead we should map to things like DATABASE_LOCKED or
128 NOTMUCH_STATUS_FILE_ERROR,
130 * A file was presented that doesn't appear to be an email
133 NOTMUCH_STATUS_FILE_NOT_EMAIL,
135 * A file contains a message ID that is identical to a message
136 * already in the database.
138 NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID,
140 * The user erroneously passed a NULL pointer to a notmuch
143 NOTMUCH_STATUS_NULL_POINTER,
145 * A tag value is too long (exceeds NOTMUCH_TAG_MAX).
147 NOTMUCH_STATUS_TAG_TOO_LONG,
149 * The notmuch_message_thaw function has been called more times
150 * than notmuch_message_freeze.
152 NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
154 * notmuch_database_end_atomic has been called more times than
155 * notmuch_database_begin_atomic.
157 NOTMUCH_STATUS_UNBALANCED_ATOMIC,
159 * The operation is not supported.
161 NOTMUCH_STATUS_UNSUPPORTED_OPERATION,
163 * Not an actual status value. Just a way to find out how many
164 * valid status values there are.
166 NOTMUCH_STATUS_LAST_STATUS
170 * Get a string representation of a notmuch_status_t value.
172 * The result is read-only.
175 notmuch_status_to_string (notmuch_status_t status);
177 /* Various opaque data types. For each notmuch_<foo>_t see the various
178 * notmuch_<foo> functions below. */
180 typedef struct _notmuch_database notmuch_database_t;
181 typedef struct _notmuch_query notmuch_query_t;
182 typedef struct _notmuch_threads notmuch_threads_t;
183 typedef struct _notmuch_thread notmuch_thread_t;
184 typedef struct _notmuch_messages notmuch_messages_t;
185 typedef struct _notmuch_message notmuch_message_t;
186 typedef struct _notmuch_tags notmuch_tags_t;
187 typedef struct _notmuch_directory notmuch_directory_t;
188 typedef struct _notmuch_filenames notmuch_filenames_t;
189 #endif /* __DOXYGEN__ */
192 * Create a new, empty notmuch database located at 'path'.
194 * The path should be a top-level directory to a collection of
195 * plain-text email messages (one message per file). This call will
196 * create a new ".notmuch" directory within 'path' where notmuch will
199 * After a successful call to notmuch_database_create, the returned
200 * database will be open so the caller should call
201 * notmuch_database_destroy when finished with it.
203 * The database will not yet have any data in it
204 * (notmuch_database_create itself is a very cheap function). Messages
205 * contained within 'path' can be added to the database by calling
206 * notmuch_database_add_message.
208 * In case of any failure, this function returns an error status and
209 * sets *database to NULL (after printing an error message on stderr).
213 * NOTMUCH_STATUS_SUCCESS: Successfully created the database.
215 * NOTMUCH_STATUS_NULL_POINTER: The given 'path' argument is NULL.
217 * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory.
219 * NOTMUCH_STATUS_FILE_ERROR: An error occurred trying to create the
220 * database file (such as permission denied, or file not found,
221 * etc.), or the database already exists.
223 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred.
226 notmuch_database_create (const char *path, notmuch_database_t **database);
229 * Database open mode for notmuch_database_open.
233 * Open database for reading only.
235 NOTMUCH_DATABASE_MODE_READ_ONLY = 0,
237 * Open database for reading and writing.
239 NOTMUCH_DATABASE_MODE_READ_WRITE
240 } notmuch_database_mode_t;
243 * Open an existing notmuch database located at 'path'.
245 * The database should have been created at some time in the past,
246 * (not necessarily by this process), by calling
247 * notmuch_database_create with 'path'. By default the database should be
248 * opened for reading only. In order to write to the database you need to
249 * pass the NOTMUCH_DATABASE_MODE_READ_WRITE mode.
251 * An existing notmuch database can be identified by the presence of a
252 * directory named ".notmuch" below 'path'.
254 * The caller should call notmuch_database_destroy when finished with
257 * In case of any failure, this function returns an error status and
258 * sets *database to NULL (after printing an error message on stderr).
262 * NOTMUCH_STATUS_SUCCESS: Successfully opened the database.
264 * NOTMUCH_STATUS_NULL_POINTER: The given 'path' argument is NULL.
266 * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory.
268 * NOTMUCH_STATUS_FILE_ERROR: An error occurred trying to open the
269 * database file (such as permission denied, or file not found,
270 * etc.), or the database version is unknown.
272 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred.
275 notmuch_database_open (const char *path,
276 notmuch_database_mode_t mode,
277 notmuch_database_t **database);
280 * Close the given notmuch database.
282 * After notmuch_database_close has been called, calls to other
283 * functions on objects derived from this database may either behave
284 * as if the database had not been closed (e.g., if the required data
285 * has been cached) or may fail with a
286 * NOTMUCH_STATUS_XAPIAN_EXCEPTION.
288 * notmuch_database_close can be called multiple times. Later calls
292 notmuch_database_close (notmuch_database_t *database);
295 * A callback invoked by notmuch_database_compact to notify the user
296 * of the progress of the compaction process.
298 typedef void (*notmuch_compact_status_cb_t)(const char *message, void *closure);
301 * Compact a notmuch database, backing up the original database to the
304 * The database will be opened with NOTMUCH_DATABASE_MODE_READ_WRITE
305 * during the compaction process to ensure no writes are made.
307 * If the optional callback function 'status_cb' is non-NULL, it will
308 * be called with diagnostic and informational messages. The argument
309 * 'closure' is passed verbatim to any callback invoked.
312 notmuch_database_compact (const char* path,
313 const char* backup_path,
314 notmuch_compact_status_cb_t status_cb,
318 * Destroy the notmuch database, closing it if necessary and freeing
319 * all associated resources.
322 notmuch_database_destroy (notmuch_database_t *database);
325 * Return the database path of the given database.
327 * The return value is a string owned by notmuch so should not be
328 * modified nor freed by the caller.
331 notmuch_database_get_path (notmuch_database_t *database);
334 * Return the database format version of the given database.
337 notmuch_database_get_version (notmuch_database_t *database);
340 * Does this database need to be upgraded before writing to it?
342 * If this function returns TRUE then no functions that modify the
343 * database (notmuch_database_add_message, notmuch_message_add_tag,
344 * notmuch_directory_set_mtime, etc.) will work unless the function
345 * notmuch_database_upgrade is called successfully first.
348 notmuch_database_needs_upgrade (notmuch_database_t *database);
351 * Upgrade the current database.
353 * After opening a database in read-write mode, the client should
354 * check if an upgrade is needed (notmuch_database_needs_upgrade) and
355 * if so, upgrade with this function before making any modifications.
357 * The optional progress_notify callback can be used by the caller to
358 * provide progress indication to the user. If non-NULL it will be
359 * called periodically with 'progress' as a floating-point value in
360 * the range of [0.0 .. 1.0] indicating the progress made so far in
361 * the upgrade process. The argument 'closure' is passed verbatim to
362 * any callback invoked.
365 notmuch_database_upgrade (notmuch_database_t *database,
366 void (*progress_notify) (void *closure,
371 * Begin an atomic database operation.
373 * Any modifications performed between a successful begin and a
374 * notmuch_database_end_atomic will be applied to the database
375 * atomically. Note that, unlike a typical database transaction, this
376 * only ensures atomicity, not durability; neither begin nor end
377 * necessarily flush modifications to disk.
379 * Atomic sections may be nested. begin_atomic and end_atomic must
380 * always be called in pairs.
384 * NOTMUCH_STATUS_SUCCESS: Successfully entered atomic section.
386 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred;
387 * atomic section not entered.
390 notmuch_database_begin_atomic (notmuch_database_t *notmuch);
393 * Indicate the end of an atomic database operation.
397 * NOTMUCH_STATUS_SUCCESS: Successfully completed atomic section.
399 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred;
400 * atomic section not ended.
402 * NOTMUCH_STATUS_UNBALANCED_ATOMIC: The database is not currently in
406 notmuch_database_end_atomic (notmuch_database_t *notmuch);
409 * Retrieve a directory object from the database for 'path'.
411 * Here, 'path' should be a path relative to the path of 'database'
412 * (see notmuch_database_get_path), or else should be an absolute path
413 * with initial components that match the path of 'database'.
415 * If this directory object does not exist in the database, this
416 * returns NOTMUCH_STATUS_SUCCESS and sets *directory to NULL.
420 * NOTMUCH_STATUS_SUCCESS: Successfully retrieved directory.
422 * NOTMUCH_STATUS_NULL_POINTER: The given 'directory' argument is NULL.
424 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred;
425 * directory not retrieved.
428 notmuch_database_get_directory (notmuch_database_t *database,
430 notmuch_directory_t **directory);
433 * Add a new message to the given notmuch database or associate an
434 * additional filename with an existing message.
436 * Here, 'filename' should be a path relative to the path of
437 * 'database' (see notmuch_database_get_path), or else should be an
438 * absolute filename with initial components that match the path of
441 * The file should be a single mail message (not a multi-message mbox)
442 * that is expected to remain at its current location, (since the
443 * notmuch database will reference the filename, and will not copy the
444 * entire contents of the file.
446 * If another message with the same message ID already exists in the
447 * database, rather than creating a new message, this adds 'filename'
448 * to the list of the filenames for the existing message.
450 * If 'message' is not NULL, then, on successful return
451 * (NOTMUCH_STATUS_SUCCESS or NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) '*message'
452 * will be initialized to a message object that can be used for things
453 * such as adding tags to the just-added message. The user should call
454 * notmuch_message_destroy when done with the message. On any failure
455 * '*message' will be set to NULL.
459 * NOTMUCH_STATUS_SUCCESS: Message successfully added to database.
461 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred,
464 * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: Message has the same message
465 * ID as another message already in the database. The new
466 * filename was successfully added to the message in the database
467 * (if not already present) and the existing message is returned.
469 * NOTMUCH_STATUS_FILE_ERROR: an error occurred trying to open the
470 * file, (such as permission denied, or file not found,
471 * etc.). Nothing added to the database.
473 * NOTMUCH_STATUS_FILE_NOT_EMAIL: the contents of filename don't look
474 * like an email message. Nothing added to the database.
476 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
477 * mode so no message can be added.
480 notmuch_database_add_message (notmuch_database_t *database,
481 const char *filename,
482 notmuch_message_t **message);
485 * Remove a message filename from the given notmuch database. If the
486 * message has no more filenames, remove the message.
488 * If the same message (as determined by the message ID) is still
489 * available via other filenames, then the message will persist in the
490 * database for those filenames. When the last filename is removed for
491 * a particular message, the database content for that message will be
496 * NOTMUCH_STATUS_SUCCESS: The last filename was removed and the
497 * message was removed from the database.
499 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred,
500 * message not removed.
502 * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: This filename was removed but
503 * the message persists in the database with at least one other
506 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
507 * mode so no message can be removed.
510 notmuch_database_remove_message (notmuch_database_t *database,
511 const char *filename);
514 * Find a message with the given message_id.
516 * If a message with the given message_id is found then, on successful return
517 * (NOTMUCH_STATUS_SUCCESS) '*message' will be initialized to a message
518 * object. The caller should call notmuch_message_destroy when done with the
521 * On any failure or when the message is not found, this function initializes
522 * '*message' to NULL. This means, when NOTMUCH_STATUS_SUCCESS is returned, the
523 * caller is supposed to check '*message' for NULL to find out whether the
524 * message with the given message_id was found.
528 * NOTMUCH_STATUS_SUCCESS: Successful return, check '*message'.
530 * NOTMUCH_STATUS_NULL_POINTER: The given 'message' argument is NULL
532 * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory, creating message object
534 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred
537 notmuch_database_find_message (notmuch_database_t *database,
538 const char *message_id,
539 notmuch_message_t **message);
542 * Find a message with the given filename.
544 * If the database contains a message with the given filename then, on
545 * successful return (NOTMUCH_STATUS_SUCCESS) '*message' will be initialized to
546 * a message object. The caller should call notmuch_message_destroy when done
549 * On any failure or when the message is not found, this function initializes
550 * '*message' to NULL. This means, when NOTMUCH_STATUS_SUCCESS is returned, the
551 * caller is supposed to check '*message' for NULL to find out whether the
552 * message with the given filename is found.
556 * NOTMUCH_STATUS_SUCCESS: Successful return, check '*message'
558 * NOTMUCH_STATUS_NULL_POINTER: The given 'message' argument is NULL
560 * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory, creating the message object
562 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred
565 notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
566 const char *filename,
567 notmuch_message_t **message);
570 * Return a list of all tags found in the database.
572 * This function creates a list of all tags found in the database. The
573 * resulting list contains all tags from all messages found in the database.
575 * On error this function returns NULL.
578 notmuch_database_get_all_tags (notmuch_database_t *db);
581 * Create a new query for 'database'.
583 * Here, 'database' should be an open database, (see
584 * notmuch_database_open and notmuch_database_create).
586 * For the query string, we'll document the syntax here more
587 * completely in the future, but it's likely to be a specialized
588 * version of the general Xapian query syntax:
590 * http://xapian.org/docs/queryparser.html
592 * As a special case, passing either a length-zero string, (that is ""),
593 * or a string consisting of a single asterisk (that is "*"), will
594 * result in a query that returns all messages in the database.
596 * See notmuch_query_set_sort for controlling the order of results.
597 * See notmuch_query_search_messages and notmuch_query_search_threads
598 * to actually execute the query.
600 * User should call notmuch_query_destroy when finished with this
603 * Will return NULL if insufficient memory is available.
606 notmuch_query_create (notmuch_database_t *database,
607 const char *query_string);
610 * Sort values for notmuch_query_set_sort.
616 NOTMUCH_SORT_OLDEST_FIRST,
620 NOTMUCH_SORT_NEWEST_FIRST,
622 * Sort by message-id.
624 NOTMUCH_SORT_MESSAGE_ID,
628 NOTMUCH_SORT_UNSORTED
632 * Return the query_string of this query. See notmuch_query_create.
635 notmuch_query_get_query_string (notmuch_query_t *query);
638 * Exclude values for notmuch_query_set_omit_excluded. The strange
639 * order is to maintain backward compatibility: the old FALSE/TRUE
640 * options correspond to the new
641 * NOTMUCH_EXCLUDE_FLAG/NOTMUCH_EXCLUDE_TRUE options.
644 NOTMUCH_EXCLUDE_FLAG,
645 NOTMUCH_EXCLUDE_TRUE,
646 NOTMUCH_EXCLUDE_FALSE,
651 * Specify whether to omit excluded results or simply flag them. By
652 * default, this is set to TRUE.
654 * If set to TRUE or ALL, notmuch_query_search_messages will omit excluded
655 * messages from the results, and notmuch_query_search_threads will omit
656 * threads that match only in excluded messages. If set to TRUE,
657 * notmuch_query_search_threads will include all messages in threads that
658 * match in at least one non-excluded message. Otherwise, if set to ALL,
659 * notmuch_query_search_threads will omit excluded messages from all threads.
661 * If set to FALSE or FLAG then both notmuch_query_search_messages and
662 * notmuch_query_search_threads will return all matching
663 * messages/threads regardless of exclude status. If set to FLAG then
664 * the exclude flag will be set for any excluded message that is
665 * returned by notmuch_query_search_messages, and the thread counts
666 * for threads returned by notmuch_query_search_threads will be the
667 * number of non-excluded messages/matches. Otherwise, if set to
668 * FALSE, then the exclude status is completely ignored.
670 * The performance difference when calling
671 * notmuch_query_search_messages should be relatively small (and both
672 * should be very fast). However, in some cases,
673 * notmuch_query_search_threads is very much faster when omitting
674 * excluded messages as it does not need to construct the threads that
675 * only match in excluded messages.
678 notmuch_query_set_omit_excluded (notmuch_query_t *query,
679 notmuch_exclude_t omit_excluded);
682 * Specify the sorting desired for this query.
685 notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort);
688 * Return the sort specified for this query. See
689 * notmuch_query_set_sort.
692 notmuch_query_get_sort (notmuch_query_t *query);
695 * Add a tag that will be excluded from the query results by default.
696 * This exclusion will be overridden if this tag appears explicitly in
700 notmuch_query_add_tag_exclude (notmuch_query_t *query, const char *tag);
703 * Execute a query for threads, returning a notmuch_threads_t object
704 * which can be used to iterate over the results. The returned threads
705 * object is owned by the query and as such, will only be valid until
706 * notmuch_query_destroy.
708 * Typical usage might be:
710 * notmuch_query_t *query;
711 * notmuch_threads_t *threads;
712 * notmuch_thread_t *thread;
714 * query = notmuch_query_create (database, query_string);
716 * for (threads = notmuch_query_search_threads (query);
717 * notmuch_threads_valid (threads);
718 * notmuch_threads_move_to_next (threads))
720 * thread = notmuch_threads_get (threads);
722 * notmuch_thread_destroy (thread);
725 * notmuch_query_destroy (query);
727 * Note: If you are finished with a thread before its containing
728 * query, you can call notmuch_thread_destroy to clean up some memory
729 * sooner (as in the above example). Otherwise, if your thread objects
730 * are long-lived, then you don't need to call notmuch_thread_destroy
731 * and all the memory will still be reclaimed when the query is
734 * Note that there's no explicit destructor needed for the
735 * notmuch_threads_t object. (For consistency, we do provide a
736 * notmuch_threads_destroy function, but there's no good reason
737 * to call it if the query is about to be destroyed).
739 * If a Xapian exception occurs this function will return NULL.
742 notmuch_query_search_threads (notmuch_query_t *query);
745 * Execute a query for messages, returning a notmuch_messages_t object
746 * which can be used to iterate over the results. The returned
747 * messages object is owned by the query and as such, will only be
748 * valid until notmuch_query_destroy.
750 * Typical usage might be:
752 * notmuch_query_t *query;
753 * notmuch_messages_t *messages;
754 * notmuch_message_t *message;
756 * query = notmuch_query_create (database, query_string);
758 * for (messages = notmuch_query_search_messages (query);
759 * notmuch_messages_valid (messages);
760 * notmuch_messages_move_to_next (messages))
762 * message = notmuch_messages_get (messages);
764 * notmuch_message_destroy (message);
767 * notmuch_query_destroy (query);
769 * Note: If you are finished with a message before its containing
770 * query, you can call notmuch_message_destroy to clean up some memory
771 * sooner (as in the above example). Otherwise, if your message
772 * objects are long-lived, then you don't need to call
773 * notmuch_message_destroy and all the memory will still be reclaimed
774 * when the query is destroyed.
776 * Note that there's no explicit destructor needed for the
777 * notmuch_messages_t object. (For consistency, we do provide a
778 * notmuch_messages_destroy function, but there's no good
779 * reason to call it if the query is about to be destroyed).
781 * If a Xapian exception occurs this function will return NULL.
784 notmuch_query_search_messages (notmuch_query_t *query);
787 * Destroy a notmuch_query_t along with any associated resources.
789 * This will in turn destroy any notmuch_threads_t and
790 * notmuch_messages_t objects generated by this query, (and in
791 * turn any notmuch_thread_t and notmuch_message_t objects generated
792 * from those results, etc.), if such objects haven't already been
796 notmuch_query_destroy (notmuch_query_t *query);
799 * Is the given 'threads' iterator pointing at a valid thread.
801 * When this function returns TRUE, notmuch_threads_get will return a
802 * valid object. Whereas when this function returns FALSE,
803 * notmuch_threads_get will return NULL.
805 * See the documentation of notmuch_query_search_threads for example
806 * code showing how to iterate over a notmuch_threads_t object.
809 notmuch_threads_valid (notmuch_threads_t *threads);
812 * Get the current thread from 'threads' as a notmuch_thread_t.
814 * Note: The returned thread belongs to 'threads' and has a lifetime
815 * identical to it (and the query to which it belongs).
817 * See the documentation of notmuch_query_search_threads for example
818 * code showing how to iterate over a notmuch_threads_t object.
820 * If an out-of-memory situation occurs, this function will return
824 notmuch_threads_get (notmuch_threads_t *threads);
827 * Move the 'threads' iterator to the next thread.
829 * If 'threads' is already pointing at the last thread then the
830 * iterator will be moved to a point just beyond that last thread,
831 * (where notmuch_threads_valid will return FALSE and
832 * notmuch_threads_get will return NULL).
834 * See the documentation of notmuch_query_search_threads for example
835 * code showing how to iterate over a notmuch_threads_t object.
838 notmuch_threads_move_to_next (notmuch_threads_t *threads);
841 * Destroy a notmuch_threads_t object.
843 * It's not strictly necessary to call this function. All memory from
844 * the notmuch_threads_t object will be reclaimed when the
845 * containing query object is destroyed.
848 notmuch_threads_destroy (notmuch_threads_t *threads);
851 * Return an estimate of the number of messages matching a search.
853 * This function performs a search and returns Xapian's best
854 * guess as to number of matching messages.
856 * If a Xapian exception occurs, this function may return 0 (after
857 * printing a message).
860 notmuch_query_count_messages (notmuch_query_t *query);
863 * Return the number of threads matching a search.
865 * This function performs a search and returns the number of unique thread IDs
866 * in the matching messages. This is the same as number of threads matching a
869 * Note that this is a significantly heavier operation than
870 * notmuch_query_count_messages().
872 * If an error occurs, this function may return 0.
875 notmuch_query_count_threads (notmuch_query_t *query);
878 * Get the thread ID of 'thread'.
880 * The returned string belongs to 'thread' and as such, should not be
881 * modified by the caller and will only be valid for as long as the
882 * thread is valid, (which is until notmuch_thread_destroy or until
883 * the query from which it derived is destroyed).
886 notmuch_thread_get_thread_id (notmuch_thread_t *thread);
889 * Get the total number of messages in 'thread'.
891 * This count consists of all messages in the database belonging to
892 * this thread. Contrast with notmuch_thread_get_matched_messages() .
895 notmuch_thread_get_total_messages (notmuch_thread_t *thread);
898 * Get a notmuch_messages_t iterator for the top-level messages in
899 * 'thread' in oldest-first order.
901 * This iterator will not necessarily iterate over all of the messages
902 * in the thread. It will only iterate over the messages in the thread
903 * which are not replies to other messages in the thread.
905 * The returned list will be destroyed when the thread is destroyed.
908 notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread);
911 * Get a notmuch_thread_t iterator for all messages in 'thread' in
912 * oldest-first order.
914 * The returned list will be destroyed when the thread is destroyed.
917 notmuch_thread_get_messages (notmuch_thread_t *thread);
920 * Get the number of messages in 'thread' that matched the search.
922 * This count includes only the messages in this thread that were
923 * matched by the search from which the thread was created and were
924 * not excluded by any exclude tags passed in with the query (see
925 * notmuch_query_add_tag_exclude). Contrast with
926 * notmuch_thread_get_total_messages() .
929 notmuch_thread_get_matched_messages (notmuch_thread_t *thread);
932 * Get the authors of 'thread' as a UTF-8 string.
934 * The returned string is a comma-separated list of the names of the
935 * authors of mail messages in the query results that belong to this
938 * The returned string belongs to 'thread' and as such, should not be
939 * modified by the caller and will only be valid for as long as the
940 * thread is valid, (which is until notmuch_thread_destroy or until
941 * the query from which it derived is destroyed).
944 notmuch_thread_get_authors (notmuch_thread_t *thread);
947 * Get the subject of 'thread' as a UTF-8 string.
949 * The subject is taken from the first message (according to the query
950 * order---see notmuch_query_set_sort) in the query results that
951 * belongs to this thread.
953 * The returned string belongs to 'thread' and as such, should not be
954 * modified by the caller and will only be valid for as long as the
955 * thread is valid, (which is until notmuch_thread_destroy or until
956 * the query from which it derived is destroyed).
959 notmuch_thread_get_subject (notmuch_thread_t *thread);
962 * Get the date of the oldest message in 'thread' as a time_t value.
965 notmuch_thread_get_oldest_date (notmuch_thread_t *thread);
968 * Get the date of the newest message in 'thread' as a time_t value.
971 notmuch_thread_get_newest_date (notmuch_thread_t *thread);
974 * Get the tags for 'thread', returning a notmuch_tags_t object which
975 * can be used to iterate over all tags.
977 * Note: In the Notmuch database, tags are stored on individual
978 * messages, not on threads. So the tags returned here will be all
979 * tags of the messages which matched the search and which belong to
982 * The tags object is owned by the thread and as such, will only be
983 * valid for as long as the thread is valid, (for example, until
984 * notmuch_thread_destroy or until the query from which it derived is
987 * Typical usage might be:
989 * notmuch_thread_t *thread;
990 * notmuch_tags_t *tags;
993 * thread = notmuch_threads_get (threads);
995 * for (tags = notmuch_thread_get_tags (thread);
996 * notmuch_tags_valid (tags);
997 * notmuch_result_move_to_next (tags))
999 * tag = notmuch_tags_get (tags);
1003 * notmuch_thread_destroy (thread);
1005 * Note that there's no explicit destructor needed for the
1006 * notmuch_tags_t object. (For consistency, we do provide a
1007 * notmuch_tags_destroy function, but there's no good reason to call
1008 * it if the message is about to be destroyed).
1011 notmuch_thread_get_tags (notmuch_thread_t *thread);
1014 * Destroy a notmuch_thread_t object.
1017 notmuch_thread_destroy (notmuch_thread_t *thread);
1020 * Is the given 'messages' iterator pointing at a valid message.
1022 * When this function returns TRUE, notmuch_messages_get will return a
1023 * valid object. Whereas when this function returns FALSE,
1024 * notmuch_messages_get will return NULL.
1026 * See the documentation of notmuch_query_search_messages for example
1027 * code showing how to iterate over a notmuch_messages_t object.
1030 notmuch_messages_valid (notmuch_messages_t *messages);
1033 * Get the current message from 'messages' as a notmuch_message_t.
1035 * Note: The returned message belongs to 'messages' and has a lifetime
1036 * identical to it (and the query to which it belongs).
1038 * See the documentation of notmuch_query_search_messages for example
1039 * code showing how to iterate over a notmuch_messages_t object.
1041 * If an out-of-memory situation occurs, this function will return
1045 notmuch_messages_get (notmuch_messages_t *messages);
1048 * Move the 'messages' iterator to the next message.
1050 * If 'messages' is already pointing at the last message then the
1051 * iterator will be moved to a point just beyond that last message,
1052 * (where notmuch_messages_valid will return FALSE and
1053 * notmuch_messages_get will return NULL).
1055 * See the documentation of notmuch_query_search_messages for example
1056 * code showing how to iterate over a notmuch_messages_t object.
1059 notmuch_messages_move_to_next (notmuch_messages_t *messages);
1062 * Destroy a notmuch_messages_t object.
1064 * It's not strictly necessary to call this function. All memory from
1065 * the notmuch_messages_t object will be reclaimed when the containing
1066 * query object is destroyed.
1069 notmuch_messages_destroy (notmuch_messages_t *messages);
1072 * Return a list of tags from all messages.
1074 * The resulting list is guaranteed not to contain duplicated tags.
1076 * WARNING: You can no longer iterate over messages after calling this
1077 * function, because the iterator will point at the end of the list.
1078 * We do not have a function to reset the iterator yet and the only
1079 * way how you can iterate over the list again is to recreate the
1082 * The function returns NULL on error.
1085 notmuch_messages_collect_tags (notmuch_messages_t *messages);
1088 * Get the message ID of 'message'.
1090 * The returned string belongs to 'message' and as such, should not be
1091 * modified by the caller and will only be valid for as long as the
1092 * message is valid, (which is until the query from which it derived
1095 * This function will not return NULL since Notmuch ensures that every
1096 * message has a unique message ID, (Notmuch will generate an ID for a
1097 * message if the original file does not contain one).
1100 notmuch_message_get_message_id (notmuch_message_t *message);
1103 * Get the thread ID of 'message'.
1105 * The returned string belongs to 'message' and as such, should not be
1106 * modified by the caller and will only be valid for as long as the
1107 * message is valid, (for example, until the user calls
1108 * notmuch_message_destroy on 'message' or until a query from which it
1109 * derived is destroyed).
1111 * This function will not return NULL since Notmuch ensures that every
1112 * message belongs to a single thread.
1115 notmuch_message_get_thread_id (notmuch_message_t *message);
1118 * Get a notmuch_messages_t iterator for all of the replies to
1121 * Note: This call only makes sense if 'message' was ultimately
1122 * obtained from a notmuch_thread_t object, (such as by coming
1123 * directly from the result of calling notmuch_thread_get_
1124 * toplevel_messages or by any number of subsequent
1125 * calls to notmuch_message_get_replies).
1127 * If 'message' was obtained through some non-thread means, (such as
1128 * by a call to notmuch_query_search_messages), then this function
1131 * If there are no replies to 'message', this function will return
1132 * NULL. (Note that notmuch_messages_valid will accept that NULL
1133 * value as legitimate, and simply return FALSE for it.)
1135 notmuch_messages_t *
1136 notmuch_message_get_replies (notmuch_message_t *message);
1139 * Get a filename for the email corresponding to 'message'.
1141 * The returned filename is an absolute filename, (the initial
1142 * component will match notmuch_database_get_path() ).
1144 * The returned string belongs to the message so should not be
1145 * modified or freed by the caller (nor should it be referenced after
1146 * the message is destroyed).
1148 * Note: If this message corresponds to multiple files in the mail
1149 * store, (that is, multiple files contain identical message IDs),
1150 * this function will arbitrarily return a single one of those
1151 * filenames. See notmuch_message_get_filenames for returning the
1152 * complete list of filenames.
1155 notmuch_message_get_filename (notmuch_message_t *message);
1158 * Get all filenames for the email corresponding to 'message'.
1160 * Returns a notmuch_filenames_t iterator listing all the filenames
1161 * associated with 'message'. These files may not have identical
1162 * content, but each will have the identical Message-ID.
1164 * Each filename in the iterator is an absolute filename, (the initial
1165 * component will match notmuch_database_get_path() ).
1167 notmuch_filenames_t *
1168 notmuch_message_get_filenames (notmuch_message_t *message);
1173 typedef enum _notmuch_message_flag {
1174 NOTMUCH_MESSAGE_FLAG_MATCH,
1175 NOTMUCH_MESSAGE_FLAG_EXCLUDED
1176 } notmuch_message_flag_t;
1179 * Get a value of a flag for the email corresponding to 'message'.
1182 notmuch_message_get_flag (notmuch_message_t *message,
1183 notmuch_message_flag_t flag);
1186 * Set a value of a flag for the email corresponding to 'message'.
1189 notmuch_message_set_flag (notmuch_message_t *message,
1190 notmuch_message_flag_t flag, notmuch_bool_t value);
1193 * Get the date of 'message' as a time_t value.
1195 * For the original textual representation of the Date header from the
1196 * message call notmuch_message_get_header() with a header value of
1200 notmuch_message_get_date (notmuch_message_t *message);
1203 * Get the value of the specified header from 'message' as a UTF-8 string.
1205 * Common headers are stored in the database when the message is
1206 * indexed and will be returned from the database. Other headers will
1207 * be read from the actual message file.
1209 * The header name is case insensitive.
1211 * The returned string belongs to the message so should not be
1212 * modified or freed by the caller (nor should it be referenced after
1213 * the message is destroyed).
1215 * Returns an empty string ("") if the message does not contain a
1216 * header line matching 'header'. Returns NULL if any error occurs.
1219 notmuch_message_get_header (notmuch_message_t *message, const char *header);
1222 * Get the tags for 'message', returning a notmuch_tags_t object which
1223 * can be used to iterate over all tags.
1225 * The tags object is owned by the message and as such, will only be
1226 * valid for as long as the message is valid, (which is until the
1227 * query from which it derived is destroyed).
1229 * Typical usage might be:
1231 * notmuch_message_t *message;
1232 * notmuch_tags_t *tags;
1235 * message = notmuch_database_find_message (database, message_id);
1237 * for (tags = notmuch_message_get_tags (message);
1238 * notmuch_tags_valid (tags);
1239 * notmuch_result_move_to_next (tags))
1241 * tag = notmuch_tags_get (tags);
1245 * notmuch_message_destroy (message);
1247 * Note that there's no explicit destructor needed for the
1248 * notmuch_tags_t object. (For consistency, we do provide a
1249 * notmuch_tags_destroy function, but there's no good reason to call
1250 * it if the message is about to be destroyed).
1253 notmuch_message_get_tags (notmuch_message_t *message);
1256 * The longest possible tag value.
1258 #define NOTMUCH_TAG_MAX 200
1261 * Add a tag to the given message.
1265 * NOTMUCH_STATUS_SUCCESS: Tag successfully added to message
1267 * NOTMUCH_STATUS_NULL_POINTER: The 'tag' argument is NULL
1269 * NOTMUCH_STATUS_TAG_TOO_LONG: The length of 'tag' is too long
1270 * (exceeds NOTMUCH_TAG_MAX)
1272 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
1273 * mode so message cannot be modified.
1276 notmuch_message_add_tag (notmuch_message_t *message, const char *tag);
1279 * Remove a tag from the given message.
1283 * NOTMUCH_STATUS_SUCCESS: Tag successfully removed from message
1285 * NOTMUCH_STATUS_NULL_POINTER: The 'tag' argument is NULL
1287 * NOTMUCH_STATUS_TAG_TOO_LONG: The length of 'tag' is too long
1288 * (exceeds NOTMUCH_TAG_MAX)
1290 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
1291 * mode so message cannot be modified.
1294 notmuch_message_remove_tag (notmuch_message_t *message, const char *tag);
1297 * Remove all tags from the given message.
1299 * See notmuch_message_freeze for an example showing how to safely
1300 * replace tag values.
1302 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
1303 * mode so message cannot be modified.
1306 notmuch_message_remove_all_tags (notmuch_message_t *message);
1309 * Add/remove tags according to maildir flags in the message filename(s).
1311 * This function examines the filenames of 'message' for maildir
1312 * flags, and adds or removes tags on 'message' as follows when these
1313 * flags are present:
1315 * Flag Action if present
1316 * ---- -----------------
1317 * 'D' Adds the "draft" tag to the message
1318 * 'F' Adds the "flagged" tag to the message
1319 * 'P' Adds the "passed" tag to the message
1320 * 'R' Adds the "replied" tag to the message
1321 * 'S' Removes the "unread" tag from the message
1323 * For each flag that is not present, the opposite action (add/remove)
1324 * is performed for the corresponding tags.
1326 * Flags are identified as trailing components of the filename after a
1327 * sequence of ":2,".
1329 * If there are multiple filenames associated with this message, the
1330 * flag is considered present if it appears in one or more
1331 * filenames. (That is, the flags from the multiple filenames are
1332 * combined with the logical OR operator.)
1334 * A client can ensure that notmuch database tags remain synchronized
1335 * with maildir flags by calling this function after each call to
1336 * notmuch_database_add_message. See also
1337 * notmuch_message_tags_to_maildir_flags for synchronizing tag changes
1338 * back to maildir flags.
1341 notmuch_message_maildir_flags_to_tags (notmuch_message_t *message);
1344 * Rename message filename(s) to encode tags as maildir flags.
1346 * Specifically, for each filename corresponding to this message:
1348 * If the filename is not in a maildir directory, do nothing. (A
1349 * maildir directory is determined as a directory named "new" or
1350 * "cur".) Similarly, if the filename has invalid maildir info,
1351 * (repeated or outof-ASCII-order flag characters after ":2,"), then
1354 * If the filename is in a maildir directory, rename the file so that
1355 * its filename ends with the sequence ":2," followed by zero or more
1356 * of the following single-character flags (in ASCII order):
1358 * 'D' iff the message has the "draft" tag
1359 * 'F' iff the message has the "flagged" tag
1360 * 'P' iff the message has the "passed" tag
1361 * 'R' iff the message has the "replied" tag
1362 * 'S' iff the message does not have the "unread" tag
1364 * Any existing flags unmentioned in the list above will be preserved
1367 * Also, if this filename is in a directory named "new", rename it to
1368 * be within the neighboring directory named "cur".
1370 * A client can ensure that maildir filename flags remain synchronized
1371 * with notmuch database tags by calling this function after changing
1372 * tags, (after calls to notmuch_message_add_tag,
1373 * notmuch_message_remove_tag, or notmuch_message_freeze/
1374 * notmuch_message_thaw). See also notmuch_message_maildir_flags_to_tags
1375 * for synchronizing maildir flag changes back to tags.
1378 notmuch_message_tags_to_maildir_flags (notmuch_message_t *message);
1381 * Freeze the current state of 'message' within the database.
1383 * This means that changes to the message state, (via
1384 * notmuch_message_add_tag, notmuch_message_remove_tag, and
1385 * notmuch_message_remove_all_tags), will not be committed to the
1386 * database until the message is thawed with notmuch_message_thaw.
1388 * Multiple calls to freeze/thaw are valid and these calls will
1389 * "stack". That is there must be as many calls to thaw as to freeze
1390 * before a message is actually thawed.
1392 * The ability to do freeze/thaw allows for safe transactions to
1393 * change tag values. For example, explicitly setting a message to
1394 * have a given set of tags might look like this:
1396 * notmuch_message_freeze (message);
1398 * notmuch_message_remove_all_tags (message);
1400 * for (i = 0; i < NUM_TAGS; i++)
1401 * notmuch_message_add_tag (message, tags[i]);
1403 * notmuch_message_thaw (message);
1405 * With freeze/thaw used like this, the message in the database is
1406 * guaranteed to have either the full set of original tag values, or
1407 * the full set of new tag values, but nothing in between.
1409 * Imagine the example above without freeze/thaw and the operation
1410 * somehow getting interrupted. This could result in the message being
1411 * left with no tags if the interruption happened after
1412 * notmuch_message_remove_all_tags but before notmuch_message_add_tag.
1416 * NOTMUCH_STATUS_SUCCESS: Message successfully frozen.
1418 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
1419 * mode so message cannot be modified.
1422 notmuch_message_freeze (notmuch_message_t *message);
1425 * Thaw the current 'message', synchronizing any changes that may have
1426 * occurred while 'message' was frozen into the notmuch database.
1428 * See notmuch_message_freeze for an example of how to use this
1429 * function to safely provide tag changes.
1431 * Multiple calls to freeze/thaw are valid and these calls with
1432 * "stack". That is there must be as many calls to thaw as to freeze
1433 * before a message is actually thawed.
1437 * NOTMUCH_STATUS_SUCCESS: Message successfully thawed, (or at least
1438 * its frozen count has successfully been reduced by 1).
1440 * NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: An attempt was made to thaw
1441 * an unfrozen message. That is, there have been an unbalanced
1442 * number of calls to notmuch_message_freeze and
1443 * notmuch_message_thaw.
1446 notmuch_message_thaw (notmuch_message_t *message);
1449 * Destroy a notmuch_message_t object.
1451 * It can be useful to call this function in the case of a single
1452 * query object with many messages in the result, (such as iterating
1453 * over the entire database). Otherwise, it's fine to never call this
1454 * function and there will still be no memory leaks. (The memory from
1455 * the messages get reclaimed when the containing query is destroyed.)
1458 notmuch_message_destroy (notmuch_message_t *message);
1461 * Is the given 'tags' iterator pointing at a valid tag.
1463 * When this function returns TRUE, notmuch_tags_get will return a
1464 * valid string. Whereas when this function returns FALSE,
1465 * notmuch_tags_get will return NULL.
1467 * See the documentation of notmuch_message_get_tags for example code
1468 * showing how to iterate over a notmuch_tags_t object.
1471 notmuch_tags_valid (notmuch_tags_t *tags);
1474 * Get the current tag from 'tags' as a string.
1476 * Note: The returned string belongs to 'tags' and has a lifetime
1477 * identical to it (and the query to which it ultimately belongs).
1479 * See the documentation of notmuch_message_get_tags for example code
1480 * showing how to iterate over a notmuch_tags_t object.
1483 notmuch_tags_get (notmuch_tags_t *tags);
1486 * Move the 'tags' iterator to the next tag.
1488 * If 'tags' is already pointing at the last tag then the iterator
1489 * will be moved to a point just beyond that last tag, (where
1490 * notmuch_tags_valid will return FALSE and notmuch_tags_get will
1493 * See the documentation of notmuch_message_get_tags for example code
1494 * showing how to iterate over a notmuch_tags_t object.
1497 notmuch_tags_move_to_next (notmuch_tags_t *tags);
1500 * Destroy a notmuch_tags_t object.
1502 * It's not strictly necessary to call this function. All memory from
1503 * the notmuch_tags_t object will be reclaimed when the containing
1504 * message or query objects are destroyed.
1507 notmuch_tags_destroy (notmuch_tags_t *tags);
1510 * Store an mtime within the database for 'directory'.
1512 * The 'directory' should be an object retrieved from the database
1513 * with notmuch_database_get_directory for a particular path.
1515 * The intention is for the caller to use the mtime to allow efficient
1516 * identification of new messages to be added to the database. The
1517 * recommended usage is as follows:
1519 * o Read the mtime of a directory from the filesystem
1521 * o Call add_message for all mail files in the directory
1523 * o Call notmuch_directory_set_mtime with the mtime read from the
1526 * Then, when wanting to check for updates to the directory in the
1527 * future, the client can call notmuch_directory_get_mtime and know
1528 * that it only needs to add files if the mtime of the directory and
1529 * files are newer than the stored timestamp.
1531 * Note: The notmuch_directory_get_mtime function does not allow the
1532 * caller to distinguish a timestamp of 0 from a non-existent
1533 * timestamp. So don't store a timestamp of 0 unless you are
1534 * comfortable with that.
1538 * NOTMUCH_STATUS_SUCCESS: mtime successfully stored in database.
1540 * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception
1541 * occurred, mtime not stored.
1543 * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only
1544 * mode so directory mtime cannot be modified.
1547 notmuch_directory_set_mtime (notmuch_directory_t *directory,
1551 * Get the mtime of a directory, (as previously stored with
1552 * notmuch_directory_set_mtime).
1554 * Returns 0 if no mtime has previously been stored for this
1558 notmuch_directory_get_mtime (notmuch_directory_t *directory);
1561 * Get a notmuch_filenames_t iterator listing all the filenames of
1562 * messages in the database within the given directory.
1564 * The returned filenames will be the basename-entries only (not
1567 notmuch_filenames_t *
1568 notmuch_directory_get_child_files (notmuch_directory_t *directory);
1571 * Get a notmuch_filenams_t iterator listing all the filenames of
1572 * sub-directories in the database within the given directory.
1574 * The returned filenames will be the basename-entries only (not
1577 notmuch_filenames_t *
1578 notmuch_directory_get_child_directories (notmuch_directory_t *directory);
1581 * Destroy a notmuch_directory_t object.
1584 notmuch_directory_destroy (notmuch_directory_t *directory);
1587 * Is the given 'filenames' iterator pointing at a valid filename.
1589 * When this function returns TRUE, notmuch_filenames_get will return
1590 * a valid string. Whereas when this function returns FALSE,
1591 * notmuch_filenames_get will return NULL.
1593 * It is acceptable to pass NULL for 'filenames', in which case this
1594 * function will always return FALSE.
1597 notmuch_filenames_valid (notmuch_filenames_t *filenames);
1600 * Get the current filename from 'filenames' as a string.
1602 * Note: The returned string belongs to 'filenames' and has a lifetime
1603 * identical to it (and the directory to which it ultimately belongs).
1605 * It is acceptable to pass NULL for 'filenames', in which case this
1606 * function will always return NULL.
1609 notmuch_filenames_get (notmuch_filenames_t *filenames);
1612 * Move the 'filenames' iterator to the next filename.
1614 * If 'filenames' is already pointing at the last filename then the
1615 * iterator will be moved to a point just beyond that last filename,
1616 * (where notmuch_filenames_valid will return FALSE and
1617 * notmuch_filenames_get will return NULL).
1619 * It is acceptable to pass NULL for 'filenames', in which case this
1620 * function will do nothing.
1623 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
1626 * Destroy a notmuch_filenames_t object.
1628 * It's not strictly necessary to call this function. All memory from
1629 * the notmuch_filenames_t object will be reclaimed when the
1630 * containing directory object is destroyed.
1632 * It is acceptable to pass NULL for 'filenames', in which case this
1633 * function will do nothing.
1636 notmuch_filenames_destroy (notmuch_filenames_t *filenames);