[PATCH 1/4] ruby: Add wrappers for query_get_s{ort,tring}
authorAli Polatel <alip@exherbo.org>
Mon, 10 Jan 2011 14:39:25 +0000 (16:39 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:41 +0000 (09:37 -0800)
20/7bbd0e2815d9035f990d7d26cf626021284d04 [new file with mode: 0644]

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