ruby: Add wrapper for message_get_filenames
authorAli Polatel <alip@exherbo.org>
Mon, 10 Jan 2011 14:03:31 +0000 (16:03 +0200)
committerAli Polatel <alip@exherbo.org>
Tue, 25 Jan 2011 10:03:41 +0000 (12:03 +0200)
bindings/ruby/defs.h
bindings/ruby/init.c
bindings/ruby/message.c

index 1f5298838ac73df389d11043d9aac16249caf6ba..f00afeff736dc74be033b3427b54dbcb2dc1c4c5 100644 (file)
@@ -268,6 +268,9 @@ notmuch_rb_message_get_replies(VALUE self);
 VALUE
 notmuch_rb_message_get_filename(VALUE self);
 
+VALUE
+notmuch_rb_message_get_filenames(VALUE self);
+
 VALUE
 notmuch_rb_message_get_flag(VALUE self, VALUE flagv);
 
index 4a63ba07c7572f11e93a0e4002de8a885b33ea81..aa09c8dbc37e4781b0939deb55fb5c22402ae36a 100644 (file)
@@ -263,6 +263,7 @@ Init_notmuch(void)
     rb_define_method(notmuch_rb_cMessage, "thread_id", notmuch_rb_message_get_thread_id, 0);
     rb_define_method(notmuch_rb_cMessage, "replies", notmuch_rb_message_get_replies, 0);
     rb_define_method(notmuch_rb_cMessage, "filename", notmuch_rb_message_get_filename, 0);
+    rb_define_method(notmuch_rb_cMessage, "filenames", notmuch_rb_message_get_filenames, 0);
     rb_define_method(notmuch_rb_cMessage, "get_flag", notmuch_rb_message_get_flag, 1);
     rb_define_method(notmuch_rb_cMessage, "set_flag", notmuch_rb_message_set_flag, 2);
     rb_define_method(notmuch_rb_cMessage, "date", notmuch_rb_message_get_date, 0);
index 1b2c01ef4cbfb79cb02b1305e2397644159540f6..49dbace3afec546596fc15e117354f16b031689f 100644 (file)
@@ -110,6 +110,24 @@ notmuch_rb_message_get_filename(VALUE self)
     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
  *