Re: [PATCH] cli: crypto: tell gmime to use gpg-agent
[notmuch-archives.git] / ca / eb3b72c4088571d151bf0ac89b628632cd3309
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 5D0DB431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:49 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \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 tRfMWJ6rQTAQ for <notmuch@notmuchmail.org>;\r
18         Sun, 17 Jun 2012 00:27:48 -0700 (PDT)\r
19 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
20         [209.85.212.173]) (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 0AEFD431FAE\r
23         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:47 -0700 (PDT)\r
24 Received: by wibhj6 with SMTP id hj6so672804wib.2\r
25         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:46 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=GFImdg3Uo0rxjluXp4e7/UoPoP8xfWiN9AlZGQfP8mU=;\r
29         b=003X5o5n8oF/EFiHOAN5i8oHBo1g31tLZEE4LHizfGI9oqMC09FmyjTB5/KKI9pL3S\r
30         js8dsIPnsacrkJDzHvH1EUAMDQnMIlEV8zl5Z2drX2OuIJb3AJDPouL8z1driE4aWv4Z\r
31         Iuj2Dg1Zj7W4ipSCTEm7aYsFsVwUsVO0VceHRq2eQVDqYSS607oLWzlVM1qtqjQhgs1+\r
32         zU866v3y6APCJ0pHweCaotqoaQ8VI3H90RNxTbwH9m2ErwvOgjcnVFUs17bdSlB2/IZb\r
33         FJRCHw1WCoGSm4bZj3NIcKju/vn4uII0s+TzZGstgpQ7BkmaSTZ6Utu3mKl0Feh0B2hU\r
34         lmCg==\r
35 Received: by 10.216.209.95 with SMTP id r73mr6462539weo.157.1339918066272;\r
36         Sun, 17 Jun 2012 00:27:46 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  f7sm28394936wiv.2.2012.06.17.00.27.44  (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sun, 17 Jun 2012 00:27:45 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org,\r
43         novalazy@gmail.com\r
44 Subject: [WIP 1/2] lib: add --exclude=all option\r
45 Date: Sun, 17 Jun 2012 08:27:25 +0100\r
46 Message-Id: <1339918046-3448-1-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <87zk82l7wp.fsf@qmul.ac.uk>\r
49 References: <87zk82l7wp.fsf@qmul.ac.uk>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sun, 17 Jun 2012 07:27:49 -0000\r
63 \r
64 Adds a exclude all option to the lib which means that excluded\r
65 messages are completely ignored (as if they had actually been\r
66 deleted).\r
67 \r
68 ---\r
69  lib/notmuch-private.h |    3 ++-\r
70  lib/notmuch.h         |   10 +++++++++-\r
71  lib/query.cc          |   11 ++++++-----\r
72  lib/thread.cc         |   41 +++++++++++++++++++++++++++++------------\r
73  4 files changed, 46 insertions(+), 19 deletions(-)\r
74 \r
75 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
76 index bfb4111..3b92ac2 100644\r
77 --- a/lib/notmuch-private.h\r
78 +++ b/lib/notmuch-private.h\r
79 @@ -232,7 +232,8 @@ _notmuch_thread_create (void *ctx,\r
80                         unsigned int seed_doc_id,\r
81                         notmuch_doc_id_set_t *match_set,\r
82                         notmuch_string_list_t *excluded_terms,\r
83 -                       notmuch_sort_t sort);\r
84 +                       notmuch_sort_t sort,\r
85 +                       notmuch_exclude_t omit_exclude);\r
86  \r
87  /* message.cc */\r
88  \r
89 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
90 index 3633bed..57cc700 100644\r
91 --- a/lib/notmuch.h\r
92 +++ b/lib/notmuch.h\r
93 @@ -500,6 +500,14 @@ typedef enum {\r
94  const char *\r
95  notmuch_query_get_query_string (notmuch_query_t *query);\r
96  \r
97 +/* Exclude values for notmuch_query_set_omit_excluded */\r
98 +typedef enum {\r
99 +    NOTMUCH_EXCLUDE_FALSE,\r
100 +    NOTMUCH_EXCLUDE_TRUE,\r
101 +    NOTMUCH_EXCLUDE_ALL\r
102 +} notmuch_exclude_t;\r
103 +\r
104 +\r
105  /* Specify whether to omit excluded results or simply flag them.  By\r
106   * default, this is set to TRUE.\r
107   *\r
108 @@ -518,7 +526,7 @@ notmuch_query_get_query_string (notmuch_query_t *query);\r
109   */\r
110  \r
111  void\r
112 -notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded);\r
113 +notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_exclude_t omit_excluded);\r
114  \r
115  /* Specify the sorting desired for this query. */\r
116  void\r
117 diff --git a/lib/query.cc b/lib/query.cc\r
118 index e9c1a2d..fea76f8 100644\r
119 --- a/lib/query.cc\r
120 +++ b/lib/query.cc\r
121 @@ -28,7 +28,7 @@ struct _notmuch_query {\r
122      const char *query_string;\r
123      notmuch_sort_t sort;\r
124      notmuch_string_list_t *exclude_terms;\r
125 -    notmuch_bool_t omit_excluded;\r
126 +    notmuch_exclude_t omit_excluded;\r
127  };\r
128  \r
129  typedef struct _notmuch_mset_messages {\r
130 @@ -92,7 +92,7 @@ notmuch_query_create (notmuch_database_t *notmuch,\r
131  \r
132      query->exclude_terms = _notmuch_string_list_create (query);\r
133  \r
134 -    query->omit_excluded = TRUE;\r
135 +    query->omit_excluded = NOTMUCH_EXCLUDE_TRUE;\r
136  \r
137      return query;\r
138  }\r
139 @@ -104,7 +104,7 @@ notmuch_query_get_query_string (notmuch_query_t *query)\r
140  }\r
141  \r
142  void\r
143 -notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_bool_t omit_excluded)\r
144 +notmuch_query_set_omit_excluded (notmuch_query_t *query, notmuch_exclude_t omit_excluded)\r
145  {\r
146      query->omit_excluded = omit_excluded;\r
147  }\r
148 @@ -220,7 +220,7 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
149         if (query->exclude_terms) {\r
150             exclude_query = _notmuch_exclude_tags (query, final_query);\r
151  \r
152 -           if (query->omit_excluded)\r
153 +           if (query->omit_excluded != NOTMUCH_EXCLUDE_FALSE)\r
154                 final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,\r
155                                              final_query, exclude_query);\r
156             else {\r
157 @@ -486,7 +486,8 @@ notmuch_threads_get (notmuch_threads_t *threads)\r
158                                    doc_id,\r
159                                    &threads->match_set,\r
160                                    threads->query->exclude_terms,\r
161 -                                  threads->query->sort);\r
162 +                                  threads->query->sort,\r
163 +                                  threads->query->omit_excluded);\r
164  }\r
165  \r
166  void\r
167 diff --git a/lib/thread.cc b/lib/thread.cc\r
168 index e976d64..6b52792 100644\r
169 --- a/lib/thread.cc\r
170 +++ b/lib/thread.cc\r
171 @@ -215,7 +215,8 @@ _thread_cleanup_author (notmuch_thread_t *thread,\r
172  static void\r
173  _thread_add_message (notmuch_thread_t *thread,\r
174                      notmuch_message_t *message,\r
175 -                    notmuch_string_list_t *exclude_terms)\r
176 +                    notmuch_string_list_t *exclude_terms,\r
177 +                    notmuch_exclude_t omit_exclude)\r
178  {\r
179      notmuch_tags_t *tags;\r
180      const char *tag;\r
181 @@ -223,6 +224,26 @@ _thread_add_message (notmuch_thread_t *thread,\r
182      InternetAddress *address;\r
183      const char *from, *author;\r
184      char *clean_author;\r
185 +    notmuch_bool_t message_excluded = FALSE;\r
186 +\r
187 +    for (tags = notmuch_message_get_tags (message);\r
188 +        notmuch_tags_valid (tags);\r
189 +        notmuch_tags_move_to_next (tags))\r
190 +    {\r
191 +       tag = notmuch_tags_get (tags);\r
192 +       /* Is message excluded. */\r
193 +       for (notmuch_string_node_t *term = exclude_terms->head; term;\r
194 +            term = term->next) {\r
195 +           /* We ignore initial 'K'. */\r
196 +           if (strcmp(tag, (term->string + 1)) == 0) {\r
197 +               message_excluded = TRUE;\r
198 +               break;\r
199 +           }\r
200 +       }\r
201 +    }\r
202 +\r
203 +    if (message_excluded && omit_exclude == NOTMUCH_EXCLUDE_ALL)\r
204 +       return;\r
205  \r
206      _notmuch_message_list_add_message (thread->message_list,\r
207                                        talloc_steal (thread, message));\r
208 @@ -263,17 +284,12 @@ _thread_add_message (notmuch_thread_t *thread,\r
209          notmuch_tags_move_to_next (tags))\r
210      {\r
211         tag = notmuch_tags_get (tags);\r
212 -       /* Mark excluded messages. */\r
213 -       for (notmuch_string_node_t *term = exclude_terms->head; term;\r
214 -            term = term->next) {\r
215 -           /* We ignore initial 'K'. */\r
216 -           if (strcmp(tag, (term->string + 1)) == 0) {\r
217 -               notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);\r
218 -               break;\r
219 -           }\r
220 -       }\r
221         g_hash_table_insert (thread->tags, xstrdup (tag), NULL);\r
222      }\r
223 +\r
224 +    /* Mark excluded messages. */\r
225 +    if (message_excluded)\r
226 +       notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);\r
227  }\r
228  \r
229  static void\r
230 @@ -404,7 +420,8 @@ _notmuch_thread_create (void *ctx,\r
231                         unsigned int seed_doc_id,\r
232                         notmuch_doc_id_set_t *match_set,\r
233                         notmuch_string_list_t *exclude_terms,\r
234 -                       notmuch_sort_t sort)\r
235 +                       notmuch_sort_t sort,\r
236 +                       notmuch_exclude_t omit_excluded)\r
237  {\r
238      notmuch_thread_t *thread;\r
239      notmuch_message_t *seed_message;\r
240 @@ -479,7 +496,7 @@ _notmuch_thread_create (void *ctx,\r
241         if (doc_id == seed_doc_id)\r
242             message = seed_message;\r
243  \r
244 -       _thread_add_message (thread, message, exclude_terms);\r
245 +       _thread_add_message (thread, message, exclude_terms, omit_excluded);\r
246  \r
247         if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {\r
248             _notmuch_doc_id_set_remove (match_set, doc_id);\r
249 -- \r
250 1.7.9.1\r
251 \r