aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ali Polatel <alip@exherbo.org>2011-01-10 16:03:31 +0200
committerGravatar Ali Polatel <alip@exherbo.org>2011-01-25 12:03:41 +0200
commit90a66779e1a6f8c98521925875fbb9a19aeaf68a (patch)
tree1873330dceb8057f2908c9cdea2fb3d5f8e4304a
parent02369d031c1499e015db1736bd259d314d39b8cf (diff)
ruby: Add wrapper for message_get_filenames
-rw-r--r--bindings/ruby/defs.h3
-rw-r--r--bindings/ruby/init.c1
-rw-r--r--bindings/ruby/message.c18
3 files changed, 22 insertions, 0 deletions
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 1f529883..f00afeff 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -269,6 +269,9 @@ 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);
VALUE
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index 4a63ba07..aa09c8db 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -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);
diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
index 1b2c01ef..49dbace3 100644
--- a/bindings/ruby/message.c
+++ b/bindings/ruby/message.c
@@ -111,6 +111,24 @@ notmuch_rb_message_get_filename(VALUE self)
}
/*
+ * 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
*
* Get a value of a flag for the email corresponding to 'message'