mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
ruby: Add wrapper for notmuch_query_count_threads
This commit is contained in:
parent
c67587f003
commit
0629afeb26
3 changed files with 23 additions and 0 deletions
|
@ -231,6 +231,9 @@ notmuch_rb_query_search_messages (VALUE self);
|
|||
VALUE
|
||||
notmuch_rb_query_count_messages (VALUE self);
|
||||
|
||||
VALUE
|
||||
notmuch_rb_query_count_threads (VALUE self);
|
||||
|
||||
/* threads.c */
|
||||
VALUE
|
||||
notmuch_rb_threads_destroy (VALUE self);
|
||||
|
|
|
@ -271,6 +271,7 @@ Init_notmuch (void)
|
|||
rb_define_method (notmuch_rb_cQuery, "search_threads", notmuch_rb_query_search_threads, 0); /* in query.c */
|
||||
rb_define_method (notmuch_rb_cQuery, "search_messages", notmuch_rb_query_search_messages, 0); /* in query.c */
|
||||
rb_define_method (notmuch_rb_cQuery, "count_messages", notmuch_rb_query_count_messages, 0); /* in query.c */
|
||||
rb_define_method (notmuch_rb_cQuery, "count_threads", notmuch_rb_query_count_threads, 0); /* in query.c */
|
||||
|
||||
/*
|
||||
* Document-class: Notmuch::Threads
|
||||
|
|
|
@ -182,3 +182,22 @@ notmuch_rb_query_count_messages (VALUE self)
|
|||
*/
|
||||
return UINT2NUM(notmuch_query_count_messages(query));
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq: QUERY.count_threads => Fixnum
|
||||
*
|
||||
* Return an estimate of the number of threads matching a search
|
||||
*/
|
||||
VALUE
|
||||
notmuch_rb_query_count_threads (VALUE self)
|
||||
{
|
||||
notmuch_query_t *query;
|
||||
|
||||
Data_Get_Notmuch_Query (self, query);
|
||||
|
||||
/* Xapian exceptions are not handled properly.
|
||||
* (function may return 0 after printing a message)
|
||||
* Thus there is nothing we can do here...
|
||||
*/
|
||||
return UINT2NUM(notmuch_query_count_threads(query));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue