X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fnotmuch.h;h=3974820c0d3573305f8b5a168e8a414fd357bdfa;hp=89ed7ad88b7eb91ead3d6cefe518f29b410cdfd2;hb=62878f71c2f2f1f8aabc6eeb3cab116bd38522db;hpb=f379aa52845f5594aa6cc2e7cf131d5f57202bbf diff --git a/lib/notmuch.h b/lib/notmuch.h index 89ed7ad8..3974820c 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -137,14 +137,14 @@ typedef struct _notmuch_tags notmuch_tags_t; notmuch_database_t * notmuch_database_create (const char *path); -/* XXX: I think I'd like this to take an extra argument of - * notmuch_status_t* for returning a status value on failure. */ - typedef enum { - NOTMUCH_DATABASE_MODE_READONLY = 0, - NOTMUCH_DATABASE_MODE_WRITABLE + NOTMUCH_DATABASE_MODE_READ_ONLY = 0, + NOTMUCH_DATABASE_MODE_READ_WRITE } notmuch_database_mode_t; +/* XXX: I think I'd like this to take an extra argument of + * notmuch_status_t* for returning a status value on failure. */ + /* Open an existing notmuch database located at 'path'. * * The database should have been created at some time in the past, @@ -322,14 +322,6 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); * object is owned by the query and as such, will only be valid until * notmuch_query_destroy. * - * The 'first' and 'max_threads' arguments can be used to obtain - * partial results from the search. For example, to get results 10 at - * a time, pass 'max_threads' as 10 and for 'first' pass the values 0, - * 10, 20, etc. As a special case, a value of -1 for 'max_threads' - * indicates that no limiting is to be performed. So a search with - * 'first' == 0 and 'max_threads' == -1 will return the complete - * results of the search. - * * Typical usage might be: * * notmuch_query_t *query; @@ -362,22 +354,13 @@ notmuch_query_set_sort (notmuch_query_t *query, notmuch_sort_t sort); * to call it if the query is about to be destroyed). */ notmuch_threads_t * -notmuch_query_search_threads (notmuch_query_t *query, - int first, int max_threads); +notmuch_query_search_threads (notmuch_query_t *query); /* Execute a query for messages, returning a notmuch_messages_t object * which can be used to iterate over the results. The returned * messages object is owned by the query and as such, will only be * valid until notmuch_query_destroy. * - * The 'first' and 'max_messages' arguments can be used to obtain - * partial results from the search. For example, to get results 10 at - * a time, pass 'max_messages' as 10 and for 'first' pass the values - * 0, 10, 20, etc. As a special case, a value of -1 for 'max_messages' - * indicates that no limiting is to be performed. So a search with - * 'first' == 0 and 'max_messages' == -1 will return the complete - * results of the search. - * * Typical usage might be: * * notmuch_query_t *query; @@ -410,8 +393,7 @@ notmuch_query_search_threads (notmuch_query_t *query, * reason to call it if the query is about to be destroyed). */ notmuch_messages_t * -notmuch_query_search_messages (notmuch_query_t *query, - int first, int max_messages); +notmuch_query_search_messages (notmuch_query_t *query); /* Destroy a notmuch_query_t along with any associated resources. * @@ -468,6 +450,14 @@ notmuch_threads_advance (notmuch_threads_t *threads); void notmuch_threads_destroy (notmuch_threads_t *threads); +/* Return an estimate of the number of messages matching a search + * + * This function performs a search and returns Xapian's best + * guess as to number of matching messages. + */ +unsigned +notmuch_query_count_messages (notmuch_query_t *query); + /* Get the thread ID of 'thread'. * * The returned string belongs to 'thread' and as such, should not be @@ -694,6 +684,21 @@ notmuch_message_get_replies (notmuch_message_t *message); const char * notmuch_message_get_filename (notmuch_message_t *message); +/* Message flags */ +typedef enum _notmuch_message_flag { + NOTMUCH_MSG_FLAG_MATCHING_SEARCH, +} notmuch_message_flag_t; + +/* Get a value of a flag for the email corresponding to 'message'. */ +notmuch_bool_t +notmuch_message_get_flag (notmuch_message_t *message, + notmuch_message_flag_t flag); + +/* Set a value of a flag for the email corresponding to 'message'. */ +void +notmuch_message_set_flag (notmuch_message_t *message, + notmuch_message_flag_t flag, notmuch_bool_t value); + /* Get the date of 'message' as a time_t value. * * For the original textual representation of the Date header from the