1 Return-Path: <polatel@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 5F785431FD5
\r
6 for <notmuch@notmuchmail.org>; Mon, 7 May 2012 08:03:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
10 X-Spam-Score: -0.699
\r
12 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5
\r
13 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id OcnfDaWL7hww for <notmuch@notmuchmail.org>;
\r
18 Mon, 7 May 2012 08:03:19 -0700 (PDT)
\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com
\r
20 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 C4019431FD4 for <notmuch@notmuchmail.org>; Mon, 7 May 2012 08:03:18 -0700
\r
24 Received: by wgbdt14 with SMTP id dt14so4053259wgb.2
\r
25 for <notmuch@notmuchmail.org>; Mon, 07 May 2012 08:03:17 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to
\r
28 :references:in-reply-to:references:organization:mime-version
\r
29 :content-type:content-transfer-encoding;
\r
30 bh=GBGUTmsRXL4o36c/DTspGhEa4itUxdnh6Y8rdphuK5g=;
\r
31 b=TeLhAm6oCTK9hmhpX1jz4Q8aa2P1PK+EzmROfJp5N8/fDaKNiNo5D8VTQMpJe4rmv1
\r
32 ZlYuOvKZP3lel12qWlGKgR+N9iiNtwvophma6trG6l18P32HHvHIg+rBQcIfxPUrPyP8
\r
33 8dyQuVcQuOMTCwsgg/bEVzi1WojpofWFTgdP9GXg4QDZs3znIPMiyz4Vj5gtGx/9Zuzw
\r
34 wB1QXZh+oT6bCFEx9NyLVix5+/b12ykBl5NovsGgTp4Pz+CLdnEwDi310+CbxVi+APET
\r
35 /O94ZBlZtZSUgbBj5IqIZpHQebdj4Z8wgyYNc17S5pK7N8QvexGY5x0jZfMezr4VjEcQ
\r
37 Received: by 10.180.81.166 with SMTP id b6mr36119775wiy.0.1336402997544;
\r
38 Mon, 07 May 2012 08:03:17 -0700 (PDT)
\r
39 Received: from hayalet.ev ([88.234.38.242])
\r
40 by mx.google.com with ESMTPS id ff2sm34852610wib.9.2012.05.07.08.03.16
\r
41 (version=TLSv1/SSLv3 cipher=OTHER);
\r
42 Mon, 07 May 2012 08:03:17 -0700 (PDT)
\r
43 Sender: Ali Polatel <polatel@gmail.com>
\r
44 From: Ali Polatel <alip@exherbo.org>
\r
45 To: David Bremner <bremner@unb.ca>
\r
46 Subject: [PATCH 1/4] ruby: Add wrapper for notmuch_query_count_messages
\r
47 Date: Mon, 7 May 2012 18:02:43 +0300
\r
49 <9c4448b3a5dc2b62663545ea8579e27a17a3bb99.1336402558.git.alip@exherbo.org>
\r
50 X-Mailer: git-send-email 1.7.10.1
\r
51 In-Reply-To: <cover.1336402558.git.alip@exherbo.org>
\r
52 References: <87txzsgs4g.fsf@zancas.localnet>
\r
53 <cover.1336402558.git.alip@exherbo.org>
\r
54 In-Reply-To: <cover.1336402558.git.alip@exherbo.org>
\r
55 References: <cover.1336402558.git.alip@exherbo.org>
\r
56 Organization: Pink Floyd
\r
58 Content-Type: text/plain; charset=UTF-8
\r
59 Content-Transfer-Encoding: 8bit
\r
60 Cc: Ali Polatel <alip@exherbo.org>, notmuch@notmuchmail.org
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Mon, 07 May 2012 15:03:20 -0000
\r
76 bindings/ruby/defs.h | 3 +++
\r
77 bindings/ruby/init.c | 3 ++-
\r
78 bindings/ruby/query.c | 21 ++++++++++++++++++++-
\r
79 3 files changed, 25 insertions(+), 2 deletions(-)
\r
81 diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
\r
82 index 81f652f..25222a6 100644
\r
83 --- a/bindings/ruby/defs.h
\r
84 +++ b/bindings/ruby/defs.h
\r
85 @@ -222,6 +222,9 @@ notmuch_rb_query_search_threads (VALUE self);
\r
87 notmuch_rb_query_search_messages (VALUE self);
\r
90 +notmuch_rb_query_count_messages (VALUE self);
\r
94 notmuch_rb_threads_destroy (VALUE self);
\r
95 diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
\r
96 index 4405f19..7ad0ecf 100644
\r
97 --- a/bindings/ruby/init.c
\r
98 +++ b/bindings/ruby/init.c
\r
100 /* The Ruby interface to the notmuch mail library
\r
102 - * Copyright © 2010, 2011 Ali Polatel
\r
103 + * Copyright © 2010, 2011, 2012 Ali Polatel
\r
105 * This program is free software: you can redistribute it and/or modify
\r
106 * it under the terms of the GNU General Public License as published by
\r
107 @@ -236,6 +236,7 @@ Init_notmuch (void)
\r
108 rb_define_method (notmuch_rb_cQuery, "to_s", notmuch_rb_query_get_string, 0); /* in query.c */
\r
109 rb_define_method (notmuch_rb_cQuery, "search_threads", notmuch_rb_query_search_threads, 0); /* in query.c */
\r
110 rb_define_method (notmuch_rb_cQuery, "search_messages", notmuch_rb_query_search_messages, 0); /* in query.c */
\r
111 + rb_define_method (notmuch_rb_cQuery, "count_messages", notmuch_rb_query_count_messages, 0); /* in query.c */
\r
114 * Document-class: Notmuch::Threads
\r
115 diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c
\r
116 index 74fd585..02b7819 100644
\r
117 --- a/bindings/ruby/query.c
\r
118 +++ b/bindings/ruby/query.c
\r
120 /* The Ruby interface to the notmuch mail library
\r
122 - * Copyright © 2010, 2011 Ali Polatel
\r
123 + * Copyright © 2010, 2011, 2012 Ali Polatel
\r
125 * This program is free software: you can redistribute it and/or modify
\r
126 * it under the terms of the GNU General Public License as published by
\r
127 @@ -127,3 +127,22 @@ notmuch_rb_query_search_messages (VALUE self)
\r
129 return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages);
\r
133 + * call-seq: QUERY.count_messages => Fixnum
\r
135 + * Return an estimate of the number of messages matching a search
\r
138 +notmuch_rb_query_count_messages (VALUE self)
\r
140 + notmuch_query_t *query;
\r
142 + Data_Get_Notmuch_Query (self, query);
\r
144 + /* Xapian exceptions are not handled properly.
\r
145 + * (function may return 0 after printing a message)
\r
146 + * Thus there is nothing we can do here...
\r
148 + return UINT2FIX(notmuch_query_count_messages(query));
\r