* 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_message_destroy (VALUE self)
{
- notmuch_message_t *message;
-
- Data_Get_Notmuch_Message (self, message);
-
- notmuch_message_destroy (message);
- DATA_PTR (self) = NULL;
+ notmuch_rb_object_destroy (self, ¬much_rb_message_type);
return Qnil;
}
messages = notmuch_message_get_replies (message);
- 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: MESSAGE.filanames => FILENAMES
+ * call-seq: MESSAGE.filenames => FILENAMES
*
* Get all filenames for the email corresponding to MESSAGE.
*/
fnames = notmuch_message_get_filenames (message);
- return Data_Wrap_Struct (notmuch_rb_cFileNames, NULL, NULL, fnames);
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, ¬much_rb_filenames_type, fnames);
}
/*
notmuch_rb_message_get_flag (VALUE self, VALUE flagv)
{
notmuch_message_t *message;
+ notmuch_bool_t is_set;
+ notmuch_status_t status;
Data_Get_Notmuch_Message (self, message);
if (!FIXNUM_P (flagv))
rb_raise (rb_eTypeError, "Flag not a Fixnum");
- return notmuch_message_get_flag (message, FIX2INT (flagv)) ? Qtrue : Qfalse;
+ status = notmuch_message_get_flag_st (message, FIX2INT (flagv), &is_set);
+ notmuch_rb_status_raise (status);
+
+ return is_set ? Qtrue : Qfalse;
}
/*
Data_Get_Notmuch_Message (self, message);
-#if !defined(RSTRING_PTR)
-#define RSTRING_PTR(v) (RSTRING((v))->ptr)
-#endif /* !defined(RSTRING_PTR) */
-
SafeStringValue (headerv);
header = RSTRING_PTR (headerv);
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);
}
/*
Data_Get_Notmuch_Message (self, message);
-#if !defined(RSTRING_PTR)
-#define RSTRING_PTR(v) (RSTRING((v))->ptr)
-#endif /* !defined(RSTRING_PTR) */
-
SafeStringValue (tagv);
tag = RSTRING_PTR (tagv);
Data_Get_Notmuch_Message (self, message);
-#if !defined(RSTRING_PTR)
-#define RSTRING_PTR(v) (RSTRING((v))->ptr)
-#endif /* !defined(RSTRING_PTR) */
-
SafeStringValue (tagv);
tag = RSTRING_PTR (tagv);