1 Return-Path: <markwalters1009@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 0F314429E5B
\r
6 for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 17:18:05 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=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 7W1WURL22POg for <notmuch@notmuchmail.org>;
\r
18 Mon, 23 Jan 2012 17:18:04 -0800 (PST)
\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
20 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 16865429E21
\r
23 for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 17:18:03 -0800 (PST)
\r
24 Received: by mail-we0-f181.google.com with SMTP id b10so3021166wer.26
\r
25 for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 17:18:03 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=b5Y71ehYOoKb21r8nlMS0pwVs0cFF3DGqhex70sZZTc=;
\r
29 b=syj9InI3ddjkpN7H+btzohd/NvenxlWsK+hek0eW8VDYSDGtQmp1ZZIBwTjLAJ1j1w
\r
30 LsmI3SKbub4kYMegHQDInn4fjZU3qgie4VY5jJWSZqoD8HzYbHAh/CPT/nQq48soMVV/
\r
31 5Etf5AhCXk/ghP+sgdPkjX0JeadT6TQbtE/i0=
\r
32 Received: by 10.216.138.101 with SMTP id z79mr31918wei.7.1327367883800;
\r
33 Mon, 23 Jan 2012 17:18:03 -0800 (PST)
\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
35 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
36 hc10sm12828949wib.8.2012.01.23.17.18.02 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Mon, 23 Jan 2012 17:18:02 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org,
\r
40 Austin Clements <amdragon@MIT.EDU>
\r
41 Subject: [RFC PATCH 3/4] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag
\r
42 Date: Tue, 24 Jan 2012 01:18:42 +0000
\r
43 Message-Id: <1327367923-18228-3-git-send-email-markwalters1009@gmail.com>
\r
44 X-Mailer: git-send-email 1.7.2.3
\r
45 In-Reply-To: <20120124011609.GX16740@mit.edu>
\r
46 References: <20120124011609.GX16740@mit.edu>
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Tue, 24 Jan 2012 01:18:05 -0000
\r
61 Add the actual NOTMUCH_MESSAGE_FLAG_EXCLUDED flag.
\r
64 lib/notmuch-private.h | 1 +
\r
65 lib/notmuch.h | 3 ++-
\r
66 lib/query.cc | 11 +++++++----
\r
67 lib/thread.cc | 14 ++++++++++----
\r
68 4 files changed, 20 insertions(+), 9 deletions(-)
\r
70 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
\r
71 index e791bb0..cb3eca6 100644
\r
72 --- a/lib/notmuch-private.h
\r
73 +++ b/lib/notmuch-private.h
\r
74 @@ -216,6 +216,7 @@ _notmuch_thread_create (void *ctx,
\r
75 notmuch_database_t *notmuch,
\r
76 unsigned int seed_doc_id,
\r
77 notmuch_doc_id_set_t *match_set,
\r
78 + notmuch_doc_id_set_t *excluded_doc_ids,
\r
79 notmuch_sort_t sort);
\r
82 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
83 index 7929fe7..cf0d45d 100644
\r
86 @@ -895,7 +895,8 @@ notmuch_message_get_filenames (notmuch_message_t *message);
\r
89 typedef enum _notmuch_message_flag {
\r
90 - NOTMUCH_MESSAGE_FLAG_MATCH
\r
91 + NOTMUCH_MESSAGE_FLAG_MATCH,
\r
92 + NOTMUCH_MESSAGE_FLAG_EXCLUDED
\r
93 } notmuch_message_flag_t;
\r
95 /* Get a value of a flag for the email corresponding to 'message'. */
\r
96 diff --git a/lib/query.cc b/lib/query.cc
\r
97 index 92fa834..69e32bd 100644
\r
100 @@ -55,6 +55,7 @@ struct visible _notmuch_threads {
\r
101 /* The set of matched docid's that have not been assigned to a
\r
102 * thread. Initially, this contains every docid in doc_ids. */
\r
103 notmuch_doc_id_set_t match_set;
\r
104 + notmuch_doc_id_set_t *excluded_doc_ids;
\r
107 static notmuch_bool_t
\r
108 @@ -302,6 +303,9 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
\r
109 INTERNAL_ERROR ("a messages iterator contains a non-existent document ID.\n");
\r
112 + if (_notmuch_doc_id_set_contains (messages->excluded_doc_ids, doc_id))
\r
113 + notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);
\r
118 @@ -314,10 +318,6 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
\r
120 mset_messages->iterator++;
\r
122 - while ((mset_messages->iterator != mset_messages->iterator_end) &&
\r
123 - (_notmuch_doc_id_set_contains (messages->excluded_doc_ids,
\r
124 - *mset_messages->iterator)))
\r
125 - mset_messages->iterator++;
\r
128 static notmuch_bool_t
\r
129 @@ -403,6 +403,8 @@ notmuch_query_search_threads (notmuch_query_t *query)
\r
130 notmuch_messages_move_to_next (messages);
\r
132 threads->doc_id_pos = 0;
\r
133 + /* the excluded messages are in query context so this should be ok */
\r
134 + threads->excluded_doc_ids = messages->excluded_doc_ids;
\r
136 talloc_free (messages);
\r
138 @@ -452,6 +454,7 @@ notmuch_threads_get (notmuch_threads_t *threads)
\r
139 threads->query->notmuch,
\r
141 &threads->match_set,
\r
142 + threads->excluded_doc_ids,
\r
143 threads->query->sort);
\r
146 diff --git a/lib/thread.cc b/lib/thread.cc
\r
147 index 0435ee6..6ea2a44 100644
\r
148 --- a/lib/thread.cc
\r
149 +++ b/lib/thread.cc
\r
150 @@ -302,7 +302,8 @@ _thread_set_subject_from_message (notmuch_thread_t *thread,
\r
152 _thread_add_matched_message (notmuch_thread_t *thread,
\r
153 notmuch_message_t *message,
\r
154 - notmuch_sort_t sort)
\r
155 + notmuch_sort_t sort,
\r
156 + notmuch_bool_t excluded)
\r
159 notmuch_message_t *hashed_message;
\r
160 @@ -321,7 +322,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,
\r
161 _thread_set_subject_from_message (thread, message);
\r
164 - thread->matched_messages++;
\r
166 + thread->matched_messages++;
\r
168 if (g_hash_table_lookup_extended (thread->message_hash,
\r
169 notmuch_message_get_message_id (message), NULL,
\r
170 @@ -392,6 +394,7 @@ _notmuch_thread_create (void *ctx,
\r
171 notmuch_database_t *notmuch,
\r
172 unsigned int seed_doc_id,
\r
173 notmuch_doc_id_set_t *match_set,
\r
174 + notmuch_doc_id_set_t *excluded_doc_ids,
\r
175 notmuch_sort_t sort)
\r
177 notmuch_thread_t *thread;
\r
178 @@ -456,7 +459,9 @@ _notmuch_thread_create (void *ctx,
\r
179 * oldest or newest subject is desired. */
\r
180 notmuch_query_set_sort (thread_id_query, NOTMUCH_SORT_OLDEST_FIRST);
\r
182 - for (messages = notmuch_query_search_messages (thread_id_query);
\r
183 + messages = notmuch_query_search_messages (thread_id_query);
\r
184 + messages->excluded_doc_ids = excluded_doc_ids;
\r
186 notmuch_messages_valid (messages);
\r
187 notmuch_messages_move_to_next (messages))
\r
189 @@ -471,7 +476,8 @@ _notmuch_thread_create (void *ctx,
\r
191 if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {
\r
192 _notmuch_doc_id_set_remove (match_set, doc_id);
\r
193 - _thread_add_matched_message (thread, message, sort);
\r
194 + _thread_add_matched_message (thread, message, sort,
\r
195 + _notmuch_doc_id_set_contains (excluded_doc_ids, doc_id));
\r
198 _notmuch_message_close (message);
\r