X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fruby%2Fthread.c;h=56616d9fcf1446c954cdc6608b6d1d8a9ab2e9a2;hb=cca05ac10e908c2a8d7fdb3beac59bc085de9702;hp=efe5aaf7c56a8946325bd71161d14325e834aaa5;hpb=05dddf883dd762420bb8e6b86790e68d734fd568;p=notmuch diff --git a/bindings/ruby/thread.c b/bindings/ruby/thread.c index efe5aaf7..56616d9f 100644 --- a/bindings/ruby/thread.c +++ b/bindings/ruby/thread.c @@ -91,6 +91,26 @@ notmuch_rb_thread_get_toplevel_messages (VALUE self) return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages); } +/* + * call-seq: THREAD.messages => MESSAGES + * + * Get a Notmuch::Messages iterator for the all messages in thread. + */ +VALUE +notmuch_rb_thread_get_messages (VALUE self) +{ + notmuch_messages_t *messages; + notmuch_thread_t *thread; + + Data_Get_Notmuch_Thread (self, thread); + + messages = notmuch_thread_get_messages (thread); + if (!messages) + rb_raise (notmuch_rb_eMemoryError, "Out of memory"); + + return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages); +} + /* * call-seq: THREAD.matched_messages => fixnum *