1 Return-Path: <ll-notmuchmail@lange.nom.fr>
\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 5601F431FC3
\r
6 for <notmuch@notmuchmail.org>; Sun, 16 Nov 2014 12:36:18 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id wdeNssfuSH4N for <notmuch@notmuchmail.org>;
\r
16 Sun, 16 Nov 2014 12:36:10 -0800 (PST)
\r
17 X-Greylist: delayed 1205 seconds by postgrey-1.32 at olra;
\r
18 Sun, 16 Nov 2014 12:36:10 PST
\r
19 Received: from mo68.mail-out.ovh.net (4.mo68.mail-out.ovh.net [46.105.59.63])
\r
20 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 7D9CA431FCB
\r
23 for <notmuch@notmuchmail.org>; Sun, 16 Nov 2014 12:36:10 -0800 (PST)
\r
24 Received: from mail432.ha.ovh.net (b6.ovh.net [213.186.33.56])
\r
25 by mo68.mail-out.ovh.net (Postfix) with SMTP id 5F9E1FFB07F
\r
26 for <notmuch@notmuchmail.org>; Sun, 16 Nov 2014 20:58:15 +0100 (CET)
\r
27 Received: from b0.ovh.net (HELO queueout) (213.186.33.50)
\r
28 by b0.ovh.net with SMTP; 16 Nov 2014 21:58:15 +0200
\r
29 Received: from 112.248.broadband7.iol.cz (HELO snek)
\r
30 (llange@agisvoyages.com@88.102.248.112)
\r
31 by ns0.ovh.net with SMTP; 16 Nov 2014 21:58:14 +0200
\r
32 From: Ludovic LANGE <ll-notmuchmail@lange.nom.fr>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH] ruby: add bindings for `notmuch_database_get_all_tags`
\r
35 Date: Sun, 16 Nov 2014 20:58:12 +0100
\r
36 Message-Id: <1416167892-15686-1-git-send-email-ll-notmuchmail@lange.nom.fr>
\r
37 X-Mailer: git-send-email 1.8.0
\r
38 X-Ovh-Tracer-Id: 132293241084504854
\r
39 X-Ovh-Remote: 88.102.248.112 (112.248.broadband7.iol.cz)
\r
40 X-Ovh-Local: 213.186.33.20 (ns0.ovh.net)
\r
43 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeejhedrjeekucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu
\r
46 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeejhedrjeekucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu
\r
47 X-Mailman-Approved-At: Mon, 17 Nov 2014 01:37:28 -0800
\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: Sun, 16 Nov 2014 20:36:18 -0000
\r
62 The Ruby bindings were missing a way to get all the tags of the
\r
63 database. Now you should be able to access this with the public
\r
64 instance method `all_tags` of your database object.
\r
67 notmuchdb = Notmuch::Database.new path, { :create => false,
\r
68 :mode => Notmuch::MODE_READ_ONLY }
\r
70 my_tags = notmuchdb.all_tags
\r
72 my_tags.each { |tag|
\r
79 bindings/ruby/database.c | 20 ++++++++++++++++++++
\r
80 bindings/ruby/defs.h | 3 +++
\r
81 bindings/ruby/init.c | 1 +
\r
82 4 files changed, 33 insertions(+)
\r
84 diff --git a/NEWS b/NEWS
\r
85 index 44e8d05..bcd368f 100644
\r
89 +Notmuch X.XX (201X-XX-XX)
\r
90 +=========================
\r
95 +Add support for `notmuch_database_get_all_tags`
\r
98 Notmuch 0.19 (2014-11-14)
\r
99 =========================
\r
101 diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
\r
102 index c03d701..dd36ca8 100644
\r
103 --- a/bindings/ruby/database.c
\r
104 +++ b/bindings/ruby/database.c
\r
105 @@ -375,6 +375,26 @@ notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv)
\r
109 + * call-seq: DB.get_all_tags() => TAGS
\r
111 + * Returns a list of all tags found in the database.
\r
114 +notmuch_rb_database_get_all_tags (VALUE self)
\r
116 + notmuch_database_t *db;
\r
117 + notmuch_tags_t *tags;
\r
119 + Data_Get_Notmuch_Database (self, db);
\r
121 + tags = notmuch_database_get_all_tags (db);
\r
123 + rb_raise (notmuch_rb_eMemoryError, "Out of memory");
\r
125 + return Data_Wrap_Struct (notmuch_rb_cTags, NULL, NULL, tags);
\r
129 * call-seq: DB.query(query) => QUERY
\r
131 * Retrieve a query object for the query string 'query'
\r
132 diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
133 index f4901a0..167250e 100644
\r
134 --- a/bindings/ruby/defs.h
\r
135 +++ b/bindings/ruby/defs.h
\r
136 @@ -178,6 +178,9 @@ VALUE
\r
137 notmuch_rb_database_find_message_by_filename (VALUE self, VALUE pathv);
\r
140 +notmuch_rb_database_get_all_tags (VALUE self);
\r
143 notmuch_rb_database_query_create (VALUE self, VALUE qstrv);
\r
146 diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
\r
147 index ab3f22d..865d6bf 100644
\r
148 --- a/bindings/ruby/init.c
\r
149 +++ b/bindings/ruby/init.c
\r
150 @@ -229,6 +229,7 @@ Init_notmuch (void)
\r
151 notmuch_rb_database_find_message, 1); /* in database.c */
\r
152 rb_define_method (notmuch_rb_cDatabase, "find_message_by_filename",
\r
153 notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
\r
154 + rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */
\r
155 rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, 1); /* in database.c */
\r