Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C4B8A42D281 for ; Mon, 10 Jan 2011 06:39:28 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D4sGvJf0zs1T for ; Mon, 10 Jan 2011 06:39:27 -0800 (PST) Received: from bach.exherbo.org (bach.exherbo.org [78.47.197.147]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 45F61431FB6 for ; Mon, 10 Jan 2011 06:39:27 -0800 (PST) Received: from localhost ([127.0.0.1] helo=karatren.karatren.ev ident=alip) by bach.exherbo.org with esmtpa (Exim 4.71) (envelope-from ) id 1PcIu0-0006iu-N4; Mon, 10 Jan 2011 14:39:21 +0000 Received: by karatren.karatren.ev (Postfix, from userid 1000) id 5E5101BA628; Mon, 10 Jan 2011 16:39:28 +0200 (EET) From: Ali Polatel To: notmuch@notmuchmail.org Subject: [PATCH 1/4] ruby: Add wrappers for query_get_s{ort,tring} Date: Mon, 10 Jan 2011 16:39:25 +0200 Message-Id: <5eeb10ab65e90dd09705c6d2f5dcd7a154601eb9.1294669955.git.alip@exherbo.org> X-Mailer: git-send-email 1.7.3.5 In-Reply-To: References: In-Reply-To: References: Organization: Pink Floyd X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2011 14:39:29 -0000 New wrappers: notmuch_query_get_sort(): QUERY.sort notmuch_query_get_query_string(): QUERY.to_s --- bindings/ruby/defs.h | 6 ++++++ bindings/ruby/init.c | 2 ++ bindings/ruby/query.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 0 deletions(-) diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index b1be5a3..db53096 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -190,9 +190,15 @@ VALUE notmuch_rb_query_destroy(VALUE self); VALUE +notmuch_rb_query_get_sort(VALUE self); + +VALUE notmuch_rb_query_set_sort(VALUE self, VALUE sortv); VALUE +notmuch_rb_query_get_string(VALUE self); + +VALUE notmuch_rb_query_search_threads(VALUE self); VALUE diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c index e19b035..63ab205 100644 --- a/bindings/ruby/init.c +++ b/bindings/ruby/init.c @@ -224,7 +224,9 @@ Init_notmuch(void) notmuch_rb_cQuery = rb_define_class_under(mod, "Query", rb_cData); rb_undef_method(notmuch_rb_cQuery, "initialize"); rb_define_method(notmuch_rb_cQuery, "destroy", notmuch_rb_query_destroy, 0); + rb_define_method(notmuch_rb_cQuery, "sort", notmuch_rb_query_get_sort, 0); rb_define_method(notmuch_rb_cQuery, "sort=", notmuch_rb_query_set_sort, 1); + rb_define_method(notmuch_rb_cQuery, "to_s", notmuch_rb_query_get_string, 0); rb_define_method(notmuch_rb_cQuery, "search_threads", notmuch_rb_query_search_threads, 0); rb_define_method(notmuch_rb_cQuery, "search_messages", notmuch_rb_query_search_messages, 0); diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c index c5b8a4c..ef9e1a0 100644 --- a/bindings/ruby/query.c +++ b/bindings/ruby/query.c @@ -39,6 +39,21 @@ notmuch_rb_query_destroy(VALUE self) } /* + * call-seq: QUERY.sort => fixnum + * + * Get sort type of the +QUERY+ + */ +VALUE +notmuch_rb_query_get_sort(VALUE self) +{ + notmuch_query_t *query; + + Data_Get_Notmuch_Query(self, query); + + return FIX2INT(notmuch_query_get_sort(query)); +} + +/* * call-seq: QUERY.sort=(fixnum) => nil * * Set sort type of the +QUERY+ @@ -59,6 +74,21 @@ notmuch_rb_query_set_sort(VALUE self, VALUE sortv) } /* + * call-seq: QUERY.to_s => string + * + * Get query string of the +QUERY+ + */ +VALUE +notmuch_rb_query_get_string(VALUE self) +{ + notmuch_query_t *query; + + Data_Get_Notmuch_Query(self, query); + + return rb_str_new2(notmuch_query_get_query_string(query)); +} + +/* * call-seq: QUERY.search_threads => THREADS * * Search for threads -- 1.7.3.5