* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/ .
+ * along with this program. If not, see https://www.gnu.org/licenses/ .
*
* Author: Ali Polatel <alip@exherbo.org>
*/
VALUE
notmuch_rb_thread_destroy (VALUE self)
{
- notmuch_thread_t *thread;
-
- Data_Get_Notmuch_Thread (self, thread);
-
- notmuch_thread_destroy (thread);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_thread_type);
return Qnil;
}
if (!messages)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, 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_Notmuch_Object (notmuch_rb_cMessages, ¬much_rb_messages_type, messages);
}
/*
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
- return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, ¬much_rb_tags_type, tags);
}