/* Sort values for notmuch_query_set_sort */
typedef enum {
- NOTMUCH_SORT_DATE_OLDEST_FIRST,
- NOTMUCH_SORT_DATE_NEWEST_FIRST,
+ NOTMUCH_SORT_DATE,
+ NOTMUCH_SORT_DATE_REVERSE,
NOTMUCH_SORT_MESSAGE_ID
} notmuch_sort_t;
* 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;
* to call it if the query is about to be destroyed).
*/
notmuch_threads_t *
-notmuch_query_search_threads (notmuch_query_t *query);
+notmuch_query_search_threads (notmuch_query_t *query,
+ int first, int max_threads);
/* 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;
* reason to call it if the query is about to be destroyed).
*/
notmuch_messages_t *
-notmuch_query_search_messages (notmuch_query_t *query);
+notmuch_query_search_messages (notmuch_query_t *query,
+ int first, int max_messages);
/* Destroy a notmuch_query_t along with any associated resources.
*
const char *
notmuch_thread_get_thread_id (notmuch_thread_t *thread);
+/* Get the total number of messages in 'thread'.
+ *
+ * This count consists of all messages in the database belonging to
+ * this thread. Contrast with notmuch_thread_get_matched_messages() .
+ */
+int
+notmuch_thread_get_total_messages (notmuch_thread_t *thread);
+
+/* Get a notmuch_messages_t iterator for the top-level messages in
+ * 'thread'.
+ *
+ * This iterator will not necessarily iterate over all of the messages
+ * in the thread. It will only iterate over the messages in the thread
+ * which are not replies to other messages in the thread.
+ *
+ * To iterate over all messages in the thread, the caller will need to
+ * iterate over the result of notmuch_message_get_replies for each
+ * top-level message (and do that recursively for the resulting
+ * messages, etc.).
+ */
+notmuch_messages_t *
+notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread);
+
+/* Get the number of messages in 'thread' that matched the search.
+ *
+ * This count includes only the messages in this thread that were
+ * matched by the search from which the thread was created. Contrast
+ * with notmuch_thread_get_total_messages() .
+ */
+int
+notmuch_thread_get_matched_messages (notmuch_thread_t *thread);
+
+/* Get the authors of 'thread'
+ *
+ * The returned string is a comma-separated list of the names of the
+ * authors of mail messages in the query results that belong to this
+ * thread.
+ *
+ * The returned string belongs to 'thread' and as such, should not be
+ * modified by the caller and will only be valid for as long as the
+ * thread is valid, (which is until notmuch_thread_destroy or until
+ * the query from which it derived is destroyed).
+ */
+const char *
+notmuch_thread_get_authors (notmuch_thread_t *thread);
+
/* Get the subject of 'thread'
*
* The subject is taken from the first message (according to the query
const char *
notmuch_message_get_thread_id (notmuch_message_t *message);
+/* Get a notmuch_messages_t iterator for all of the replies to
+ * 'message'.
+ *
+ * Note: This call only makes sense if 'message' was ultimately
+ * obtained from a notmuch_thread_t object, (such as by coming
+ * directly from the result of calling notmuch_thread_get_
+ * toplevel_messages or by any number of subsequent
+ * calls to notmuch_message_get_replies).
+ *
+ * If 'message' was obtained through some non-thread means, (such as
+ * by a call to notmuch_query_search_messages), then this function
+ * will return NULL.
+ *
+ * If there are no replies to 'message', this function will return
+ * NULL. (Note that notmuch_messages_has_more will accept that NULL
+ * value as legitimate, and simply return FALSE for it.)
+ */
+notmuch_messages_t *
+notmuch_message_get_replies (notmuch_message_t *message);
+
/* Get the filename for the email corresponding to 'message'.
*
* The returned filename is an absolute filename, (the initial