From c4f96d09312532d378c51b2a0e0128108fba4a2c Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 24 Nov 2012 23:57:07 -0500 Subject: ruby: Add bindings for notmuch_thread_get_messages --- bindings/ruby/thread.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bindings/ruby/thread.c') 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 * -- cgit v1.2.3