1 Return-Path: <peter.keen@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 2F9AC431FBD
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 07:36:51 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.698 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,
\r
13 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id 6fQfvPkki9Y7 for <notmuch@notmuchmail.org>;
\r
17 Mon, 9 Jul 2012 07:36:50 -0700 (PDT)
\r
18 Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com
\r
19 [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 4F3A4431FAE
\r
22 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 07:36:50 -0700 (PDT)
\r
23 Received: by vbbfc26 with SMTP id fc26so8658401vbb.26
\r
24 for <notmuch@notmuchmail.org>; Mon, 09 Jul 2012 07:36:48 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=mime-version:sender:date:x-google-sender-auth:message-id:subject
\r
27 :from:to:content-type;
\r
28 bh=1LnfHk8kfBSq7hDQKMyQtGYeYQhnsH3yc/Yk2gGLuEE=;
\r
29 b=C91oXa8e101b/uFQbDbyQmNjhNm90UV+9dfQj29bC+P7As5Pf17cLCI9Abl8sceA9c
\r
30 5zGHkAYeMV99aF8dkbQl9OdSzf7DaabSVGWHKz9moztf0kJ6bF8pwafznJ5FAGNT4eZ5
\r
31 HJchO7ZO4GL2ABFPA9KrwMhpQ49i9o0AiBL0VbI1YGKuFVA8PrksOtLaVTFZ05Dam12/
\r
32 kkg8v/nxI5XYvbHuDwSpQd97y5/H/Bw6GnKMeQc+NyUcEA7DdkNl/ZptWN9wlAD8BR6K
\r
33 XQmPnS46hbXW6M9QmeFXfjA+NO4+cMGKJ5p5EzoGGr8OkkXQTiLMCOw4hMZBqDB351Nw
\r
36 Received: by 10.52.67.134 with SMTP id n6mr16253903vdt.23.1341844608230; Mon,
\r
37 09 Jul 2012 07:36:48 -0700 (PDT)
\r
38 Sender: peter.keen@gmail.com
\r
39 Received: by 10.52.169.40 with HTTP; Mon, 9 Jul 2012 07:36:48 -0700 (PDT)
\r
40 Date: Mon, 9 Jul 2012 07:36:48 -0700
\r
41 X-Google-Sender-Auth: l_bqwIBvqIxkAzirus5IPYOnQ5U
\r
43 <CAFxm1PkBo2=Jje8OzUXdN6=gD=_Q6cNaNbB4V5eQh4wpd5Ap_Q@mail.gmail.com>
\r
44 Subject: [PATCH] ruby: add all_tags method to Notmuch::Database
\r
45 From: Peter Keen <peter.keen@bugsplat.info>
\r
46 To: notmuch@notmuchmail.org
\r
47 Content-Type: multipart/alternative; boundary=20cf307f334237a57404c4668b36
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Mon, 09 Jul 2012 14:36:51 -0000
\r
62 --20cf307f334237a57404c4668b36
\r
63 Content-Type: text/plain; charset=ISO-8859-1
\r
65 The python bindings define a binding for the all_tags method on the
\r
66 database, which is pretty handy. This commit adds the same binding to
\r
69 bindings/ruby/database.c | 20 ++++++++++++++++++++
\r
70 bindings/ruby/defs.h | 3 +++
\r
71 bindings/ruby/init.c | 1 +
\r
72 3 files changed, 24 insertions(+), 0 deletions(-)
\r
74 diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
\r
75 index e84f726..d5ba108 100644
\r
76 --- a/bindings/ruby/database.c
\r
77 +++ b/bindings/ruby/database.c
\r
78 @@ -395,3 +395,23 @@ notmuch_rb_database_query_create (VALUE self, VALUE qstrv)
\r
80 return Data_Wrap_Struct (notmuch_rb_cQuery, NULL, NULL, query);
\r
84 + * call-seq: DB.get_all_tags() => TAGS
\r
86 + * Retrieve all tags in the database.
\r
89 +notmuch_rb_database_get_all_tags (VALUE self)
\r
91 + notmuch_database_t *db;
\r
92 + notmuch_tags_t *tags;
\r
94 + Data_Get_Notmuch_Database (self, db);
\r
96 + tags = notmuch_database_get_all_tags (db);
\r
98 + rb_raise (notmuch_rb_eMemoryError, "Out of memory");
\r
100 + return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
\r
102 diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
103 index fe81b3f..f1f7502 100644
\r
104 --- a/bindings/ruby/defs.h
\r
105 +++ b/bindings/ruby/defs.h
\r
106 @@ -180,6 +180,9 @@ notmuch_rb_database_find_message_by_filename
\r
107 (VALUE self, VALUE pathv);
\r
109 notmuch_rb_database_query_create (VALUE self, VALUE qstrv);
\r
112 +notmuch_rb_database_get_all_tags (VALUE self);
\r
116 notmuch_rb_directory_destroy (VALUE self);
\r
117 diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
\r
118 index f4931d3..52561c7 100644
\r
119 --- a/bindings/ruby/init.c
\r
120 +++ b/bindings/ruby/init.c
\r
121 @@ -230,6 +230,7 @@ Init_notmuch (void)
\r
122 rb_define_method (notmuch_rb_cDatabase, "find_message_by_filename",
\r
123 notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
\r
124 rb_define_method (notmuch_rb_cDatabase, "query",
\r
125 notmuch_rb_database_query_create, 1); /* in database.c */
\r
126 + rb_define_method (notmuch_rb_cDatabase, "all_tags",
\r
127 notmuch_rb_database_get_all_tags, 0); /* in database.c */
\r
130 * Document-class: Notmuch::Directory
\r
132 1.7.7.5 (Apple Git-26)
\r
134 --20cf307f334237a57404c4668b36
\r
135 Content-Type: text/html; charset=ISO-8859-1
\r
137 <pre style="word-wrap:break-word;white-space:pre-wrap">The python bindings define a binding for the all_tags method on the
\r
138 database, which is pretty handy. This commit adds the same binding to
\r
141 bindings/ruby/database.c | 20 ++++++++++++++++++++
\r
142 bindings/ruby/defs.h | 3 +++
\r
143 bindings/ruby/init.c | 1 +
\r
144 3 files changed, 24 insertions(+), 0 deletions(-)
\r
146 diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
\r
147 index e84f726..d5ba108 100644
\r
148 --- a/bindings/ruby/database.c
\r
149 +++ b/bindings/ruby/database.c
\r
150 @@ -395,3 +395,23 @@ notmuch_rb_database_query_create (VALUE self, VALUE qstrv)
\r
152 return Data_Wrap_Struct (notmuch_rb_cQuery, NULL, NULL, query);
\r
156 + * call-seq: DB.get_all_tags() => TAGS
\r
158 + * Retrieve all tags in the database.
\r
161 +notmuch_rb_database_get_all_tags (VALUE self)
\r
163 + notmuch_database_t *db;
\r
164 + notmuch_tags_t *tags;
\r
166 + Data_Get_Notmuch_Database (self, db);
\r
168 + tags = notmuch_database_get_all_tags (db);
\r
170 + rb_raise (notmuch_rb_eMemoryError, "Out of memory");
\r
172 + return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
\r
174 diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
175 index fe81b3f..f1f7502 100644
\r
176 --- a/bindings/ruby/defs.h
\r
177 +++ b/bindings/ruby/defs.h
\r
178 @@ -180,6 +180,9 @@ notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv);
\r
180 notmuch_rb_database_query_create (VALUE self, VALUE qstrv);
\r
183 +notmuch_rb_database_get_all_tags (VALUE self);
\r
187 notmuch_rb_directory_destroy (VALUE self);
\r
188 diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
\r
189 index f4931d3..52561c7 100644
\r
190 --- a/bindings/ruby/init.c
\r
191 +++ b/bindings/ruby/init.c
\r
192 @@ -230,6 +230,7 @@ Init_notmuch (void)
\r
193 rb_define_method (notmuch_rb_cDatabase, "find_message_by_filename",
\r
194 notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
\r
195 rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, 1); /* in database.c */
\r
196 + rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */
\r
199 * Document-class: Notmuch::Directory
\r
201 1.7.7.5 (Apple Git-26)
\r
202 </pre><div><br></div>
\r
204 --20cf307f334237a57404c4668b36--
\r