#include "defs.h"
/*
- * call-seq: MESSAGE.destroy => nil
+ * call-seq: MESSAGE.destroy! => nil
*
* Destroys the message, freeing all resources allocated for it.
*/
{
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
notmuch_message_destroy(message);
+ DATA_PTR(self) = NULL;
return Qnil;
}
const char *msgid;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
msgid = notmuch_message_get_message_id(message);
const char *tid;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
tid = notmuch_message_get_thread_id(message);
notmuch_messages_t *messages;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
messages = notmuch_message_get_replies(message);
const char *fname;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
fname = notmuch_message_get_filename(message);
return rb_str_new2(fname);
}
+/*
+ * call-seq: MESSAGE.filanames => FILENAMES
+ *
+ * Get all filenames for the email corresponding to MESSAGE.
+ */
+VALUE
+notmuch_rb_message_get_filenames(VALUE self)
+{
+ notmuch_filenames_t *fnames;
+ notmuch_message_t *message;
+
+ Data_Get_Notmuch_Message(self, message);
+
+ fnames = notmuch_message_get_filenames(message);
+
+ return Data_Wrap_Struct(notmuch_rb_cFileNames, NULL, NULL, fnames);
+}
+
/*
* call-seq: MESSAGE.get_flag(flag) => true or false
*
{
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
if (!FIXNUM_P(flagv))
rb_raise(rb_eTypeError, "Flag not a Fixnum");
{
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
if (!FIXNUM_P(flagv))
rb_raise(rb_eTypeError, "Flag not a Fixnum");
{
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
return UINT2NUM(notmuch_message_get_date(message));
}
const char *header, *value;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
#if !defined(RSTRING_PTR)
#define RSTRING_PTR(v) (RSTRING((v))->ptr)
notmuch_message_t *message;
notmuch_tags_t *tags;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
tags = notmuch_message_get_tags(message);
if (!tags)
notmuch_status_t ret;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
#if !defined(RSTRING_PTR)
#define RSTRING_PTR(v) (RSTRING((v))->ptr)
notmuch_status_t ret;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
#if !defined(RSTRING_PTR)
#define RSTRING_PTR(v) (RSTRING((v))->ptr)
notmuch_status_t ret;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
ret = notmuch_message_remove_all_tags(message);
notmuch_rb_status_raise(ret);
return Qtrue;
}
+/*
+ * call-seq: MESSAGE.maildir_flags_to_tags => true
+ *
+ * Add/remove tags according to maildir flags in the message filename(s)
+ */
+VALUE
+notmuch_rb_message_maildir_flags_to_tags(VALUE self)
+{
+ notmuch_status_t ret;
+ notmuch_message_t *message;
+
+ Data_Get_Notmuch_Message(self, message);
+
+ ret = notmuch_message_maildir_flags_to_tags(message);
+ notmuch_rb_status_raise(ret);
+
+ return Qtrue;
+}
+
+/*
+ * call-seq: MESSAGE.tags_to_maildir_flags => true
+ *
+ * Rename message filename(s) to encode tags as maildir flags
+ */
+VALUE
+notmuch_rb_message_tags_to_maildir_flags(VALUE self)
+{
+ notmuch_status_t ret;
+ notmuch_message_t *message;
+
+ Data_Get_Notmuch_Message(self, message);
+
+ ret = notmuch_message_tags_to_maildir_flags(message);
+ notmuch_rb_status_raise(ret);
+
+ return Qtrue;
+}
+
/*
* call-seq: MESSAGE.freeze => true
*
notmuch_status_t ret;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
ret = notmuch_message_freeze(message);
notmuch_rb_status_raise(ret);
notmuch_status_t ret;
notmuch_message_t *message;
- Data_Get_Struct(self, notmuch_message_t, message);
+ Data_Get_Notmuch_Message(self, message);
ret = notmuch_message_thaw(message);
notmuch_rb_status_raise(ret);