Re: Hi all
[notmuch-archives.git] / 0f / 7c3be67dae195912e79fd9c7da9404600e61ca
1 Return-Path: <m.walters@qmul.ac.uk>\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 8CDD0431E64\r
6         for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 03:46:32 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 a-39DRcVJUfz for <notmuch@notmuchmail.org>;\r
17         Tue, 31 Jan 2012 03:46:31 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 92122429E34\r
22         for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 03:46:31 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1RsCAP-0004sm-OF; Tue, 31 Jan 2012 11:46:30 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1RsCAP-0006pT-Bo; Tue, 31 Jan 2012 11:46:29 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: Re: [PATCH 4/7] lib: Add the exclude flag to\r
35         notmuch_query_search_threads\r
36 In-Reply-To: <20120131045020.GA17991@mit.edu>\r
37 References: <8762fu4aqt.fsf@qmul.ac.uk>\r
38         <1327862394-14334-4-git-send-email-markwalters1009@gmail.com>\r
39         <20120131045020.GA17991@mit.edu>\r
40 User-Agent: Notmuch/0.11+137~g98adc3d (http://notmuchmail.org) Emacs/23.2.1\r
41         (i486-pc-linux-gnu)\r
42 Date: Tue, 31 Jan 2012 11:47:35 +0000\r
43 Message-ID: <87vcnsccvc.fsf@qmul.ac.uk>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 X-Sender-Host-Address: 94.192.233.223\r
47 X-QM-SPAM-Info: Sender has good ham record.  :)\r
48 X-QM-Body-MD5: a02fe2a1a8b3d601adbe665bd043bd79 (of first 20000 bytes)\r
49 X-SpamAssassin-Score: -1.8\r
50 X-SpamAssassin-SpamBar: -\r
51 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
52         determine if it is\r
53         spam. We require at least 5.0 points to mark a message as spam.\r
54         This message scored -1.8 points.\r
55         Summary of the scoring: \r
56         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
57         *      medium trust\r
58         *      [138.37.6.40 listed in list.dnswl.org]\r
59         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
60         provider *      (markwalters1009[at]gmail.com)\r
61         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
62         *      domain\r
63         *  0.5 AWL AWL: From: address is in the auto white-list\r
64 X-QM-Scan-Virus: ClamAV says the message is clean\r
65 Cc: notmuch@notmuchmail.org\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Tue, 31 Jan 2012 11:46:32 -0000\r
79 \r
80 On Mon, 30 Jan 2012 23:50:20 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
81 > Quoth Mark Walters on Jan 29 at  6:39 pm:\r
82 > > Add the NOTMUCH_MESSAGE_FLAG_EXCLUDED flag to\r
83 > > notmuch_query_search_threads. Implemented by inspecting the tags\r
84 > > directly in _notmuch_thread_create/_thread_add_message rather than as\r
85 > > a Xapian query for speed reasons.\r
86 > > ---\r
87 > >  lib/notmuch-private.h |   16 ++++++++++------\r
88 > >  lib/query.cc          |    1 +\r
89 > >  lib/thread.cc         |   18 +++++++++++++++---\r
90 > >  3 files changed, 26 insertions(+), 9 deletions(-)\r
91 > > \r
92 > > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
93 > > index e791bb0..56b87c6 100644\r
94 > > --- a/lib/notmuch-private.h\r
95 > > +++ b/lib/notmuch-private.h\r
96 > > @@ -211,12 +211,8 @@ _notmuch_directory_get_document_id (notmuch_directory_t *directory);\r
97 > >  \r
98 > >  /* thread.cc */\r
99 > >  \r
100 > > -notmuch_thread_t *\r
101 > > -_notmuch_thread_create (void *ctx,\r
102 > > -                   notmuch_database_t *notmuch,\r
103 > > -                   unsigned int seed_doc_id,\r
104 > > -                   notmuch_doc_id_set_t *match_set,\r
105 > > -                   notmuch_sort_t sort);\r
106 > > +/* Definition of _notmuch_thread_create moved later since now uses\r
107 > > + * string_list_t */\r
108\r
109 > Naw, leave the definition here along with the other things from\r
110 > thread.cc and just add a\r
111\r
112 >   typedef struct _notmuch_string_list notmuch_string_list_t;\r
113\r
114 > along with the typedef for notmuch_doc_id_set_t near the top.  (You\r
115 > might also have to tweak the typedef of notmuch_string_list_t later so\r
116 > it's just the struct definition.)\r
117 \r
118 Will do.\r
119 \r
120 > >  /* message.cc */\r
121 > >  \r
122 > > @@ -492,6 +488,14 @@ notmuch_filenames_t *\r
123 > >  _notmuch_filenames_create (const void *ctx,\r
124 > >                        notmuch_string_list_t *list);\r
125 > >  \r
126 > > +notmuch_thread_t *\r
127 > > +_notmuch_thread_create (void *ctx,\r
128 > > +                   notmuch_database_t *notmuch,\r
129 > > +                   unsigned int seed_doc_id,\r
130 > > +                   notmuch_doc_id_set_t *match_set,\r
131 > > +                   notmuch_string_list_t *excluded_terms,\r
132 > > +                   notmuch_sort_t sort);\r
133 > > +\r
134 > >  #pragma GCC visibility pop\r
135 > >  \r
136 > >  NOTMUCH_END_DECLS\r
137 > > diff --git a/lib/query.cc b/lib/query.cc\r
138 > > index 7d165d2..dee7ec0 100644\r
139 > > --- a/lib/query.cc\r
140 > > +++ b/lib/query.cc\r
141 > > @@ -472,6 +472,7 @@ notmuch_threads_get (notmuch_threads_t *threads)\r
142 > >                                threads->query->notmuch,\r
143 > >                                doc_id,\r
144 > >                                &threads->match_set,\r
145 > > +                              threads->query->exclude_terms,\r
146 > >                                threads->query->sort);\r
147 > >  }\r
148 > >  \r
149 > > diff --git a/lib/thread.cc b/lib/thread.cc\r
150 > > index 0435ee6..6d65d52 100644\r
151 > > --- a/lib/thread.cc\r
152 > > +++ b/lib/thread.cc\r
153 > > @@ -214,7 +214,8 @@ _thread_cleanup_author (notmuch_thread_t *thread,\r
154 > >   */\r
155 > >  static void\r
156 > >  _thread_add_message (notmuch_thread_t *thread,\r
157 > > -                notmuch_message_t *message)\r
158 > > +                notmuch_message_t *message,\r
159 > > +                notmuch_string_list_t *exclude_terms)\r
160 > >  {\r
161 > >      notmuch_tags_t *tags;\r
162 > >      const char *tag;\r
163 > > @@ -262,6 +263,15 @@ _thread_add_message (notmuch_thread_t *thread,\r
164 > >      notmuch_tags_move_to_next (tags))\r
165 > >      {\r
166 > >     tag = notmuch_tags_get (tags);\r
167 > > +   /* mark excluded messages */\r
168\r
169 > Capital and period.\r
170 \r
171 Will fix.\r
172 \r
173 > > +   for (notmuch_string_node_t *term = exclude_terms->head; term;\r
174 > > +        term = term->next) {\r
175 > > +       /* we ignore initial 'K' */\r
176\r
177 > Same.\r
178 \r
179 Will fix\r
180 \r
181 > > +       if (strcmp(tag, (term->string + 1)) == 0) {\r
182 > > +           notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);\r
183 > > +           break;\r
184 > > +       }\r
185 > > +   }\r
186 > >     g_hash_table_insert (thread->tags, xstrdup (tag), NULL);\r
187 > >      }\r
188 > >  }\r
189 > > @@ -321,7 +331,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
190 > >         _thread_set_subject_from_message (thread, message);\r
191 > >      }\r
192 > >  \r
193 > > -    thread->matched_messages++;\r
194 > > +    if (!notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED))\r
195 > > +   thread->matched_messages++;\r
196\r
197 > I'd still say this warrants a better API.\r
198 \r
199 I agree: I will think about that.\r
200 \r
201 > >      if (g_hash_table_lookup_extended (thread->message_hash,\r
202 > >                         notmuch_message_get_message_id (message), NULL,\r
203 > > @@ -392,6 +403,7 @@ _notmuch_thread_create (void *ctx,\r
204 > >                     notmuch_database_t *notmuch,\r
205 > >                     unsigned int seed_doc_id,\r
206 > >                     notmuch_doc_id_set_t *match_set,\r
207 > > +                   notmuch_string_list_t *exclude_terms,\r
208 > >                     notmuch_sort_t sort)\r
209 > >  {\r
210 > >      notmuch_thread_t *thread;\r
211 > > @@ -467,7 +479,7 @@ _notmuch_thread_create (void *ctx,\r
212 > >     if (doc_id == seed_doc_id)\r
213 > >         message = seed_message;\r
214 > >  \r
215 > > -   _thread_add_message (thread, message);\r
216 > > +   _thread_add_message (thread, message, exclude_terms);\r
217 > >  \r
218 > >     if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {\r
219 > >         _notmuch_doc_id_set_remove (match_set, doc_id);\r