1 Return-Path: <micah@riseup.net>
\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 250794196F0
\r
6 for <notmuch@notmuchmail.org>; Tue, 6 Apr 2010 22:15:17 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001]
\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 yNmeNZ5ly+Ix for <notmuch@notmuchmail.org>;
\r
17 Tue, 6 Apr 2010 22:15:15 -0700 (PDT)
\r
18 Received: from mx1.riseup.net (mx1.riseup.net [204.13.164.18])
\r
19 by olra.theworths.org (Postfix) with ESMTP id 8AA09431FC1
\r
20 for <notmuch@notmuchmail.org>; Tue, 6 Apr 2010 22:15:15 -0700 (PDT)
\r
21 Received: from [127.0.0.1] (localhost [127.0.0.1])
\r
22 (Authenticated sender: micah@mx1.riseup.net)
\r
23 with ESMTPSA id 8036A25E4D2
\r
24 Received: by algae (Postfix, from userid 1000)
\r
25 id A510A616F5; Wed, 7 Apr 2010 01:15:04 -0400 (EDT)
\r
26 From: micah anderson <micah@riseup.net>
\r
27 To: Sebastian Spaeth <Sebastian@SSpaeth.de>, Notmuch development list
\r
28 <notmuch@notmuchmail.org>
\r
29 Subject: Re: [notmuch] [Sebastian Spaeth] Pull requests
\r
30 In-Reply-To: <87bpe9qr5f.fsf@SSpaeth.de>
\r
31 References: <87iq9gi0z8.fsf@SSpaeth.de> <87hbo3vlrn.fsf@algae.riseup.net>
\r
32 <87bpe9qr5f.fsf@SSpaeth.de>
\r
33 Date: Wed, 07 Apr 2010 01:15:02 -0400
\r
34 Message-ID: <87d3yb6dyh.fsf@algae.riseup.net>
\r
36 Content-Type: multipart/mixed; boundary="=-=-="
\r
37 X-Virus-Scanned: clamav-milter 0.95.3 at mx1
\r
38 X-Virus-Status: Clean
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Wed, 07 Apr 2010 05:15:17 -0000
\r
54 Content-Type: multipart/signed; boundary="==-=-=";
\r
55 micalg=pgp-sha512; protocol="application/pgp-signature"
\r
58 Content-Transfer-Encoding: quoted-printable
\r
60 On 2010-03-27, micah anderson wrote:
\r
61 > On Thu, 25 Mar 2010 22:50:52 -0400, micah anderson <micah@riseup.net> wro=
\r
63 > > On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpae=
\r
66 > > > From git repository git://github.com/spaetz/notmuch-all-feature.git I
\r
67 > > > would like to advocate the following branches for quick pulling. Each
\r
68 > > > contains 1 or 2 patches. They have all been based on todays
\r
69 > > > cworth/master, so it should be really painless.
\r
71 > > Thanks for pulling these all together! All the ones that you propose I
\r
72 > > also use and would really like these to be merged as well.
\r
74 > > The only other patch that I find absolutely crucial, that you do not
\r
75 > > include, is the 'Preserve folder information when indexing' patch which,
\r
76 > > although not perfect, does significantly change my life.=20
\r
78 > Glad you find it useful. Yes, having the folder information would indeed
\r
79 > be nice. Is that patch working well for you? (Can you point me to the
\r
80 > mail ID of the patch you are using? There have been several versions
\r
83 The patch works really well for me. I also had difficulty figuring out
\r
84 which was the latest. The thread is
\r
85 thread:4ca0710d708e648c214ba3a67469f5bd, and the Message-ID is:
\r
86 1265122868-12133-1-git-send-email-sojkam1@fel.cvut.cz
\r
88 I had to rebase the patch to get it to apply with the other features
\r
89 that you have in your branch. I'm attaching that rebased patch to this
\r
97 Content-Type: application/pgp-signature
\r
99 -----BEGIN PGP SIGNATURE-----
\r
100 Version: GnuPG v1.4.10 (GNU/Linux)
\r
102 iQIcBAEBCgAGBQJLvBTXAAoJEIy/mjIoYaeQbScP/1J93bhk8J5IEDGue9h4bDiO
\r
103 /XC1Ot6gxha0m7MLTcXSURxsZ9WmgpkDA3WNCj00sJ7xe7FvJ1RAeT0D8HReIoOk
\r
104 vY8TM4Uba1s9Bp4MUBx+tn/R4uefodYfNjcabOui4EN9M3iBgo7ffO7KX7bvD7lg
\r
105 HqFIAbx0PuWZbkAcG/eSsttPhAD6HOiL2WFbKYT3SA07hSQcBvpuRyjf8JQBjlnH
\r
106 ShpstrgW3RweelVF0mZDKTacc+6GAes7ds48uqqNkIdURAxePAZS24d+fGsJnwQ4
\r
107 GXULZdBNKG6K8YaXR7uBFn8fkk8D8W4U52JX8gIeI58O+53YZ9GlI//JijYPZwpW
\r
108 RKOvF5qFLfpELXrlAJlRJvfiHzGTDKdrg9fz37odOyV4JcG5BR38jLOME3J7ue8D
\r
109 kQdVj5Ps18GZNuIO30w1Z8K9wR4GTrGIp5MdCEC8aTUOuNcT5U+y8VRH1wh05Ds4
\r
110 AXoinF7XsdzOUzWXZWPNUpUWd41PztK2FCshjvLlR9Tc5toq5FNtdAQa2VBEjKdJ
\r
111 wqefdU5JEsPn6v8lrxiu1fcjgw4PirPQNoCCGpScq0koCAgY2jFTZaZ+AJpzL3lG
\r
112 CUFvIXvSp4QhQMddkktus84PdgsVMGgrsVw3ZtVuDUGsnlK9htMldsNKiB+ya49z
\r
113 yEbnShhuPh0iMrW+YK0v
\r
115 -----END PGP SIGNATURE-----
\r
119 Content-Type: text/x-diff
\r
120 Content-Disposition: attachment; filename=folder.diff
\r
122 commit 91e11a2a406683f1f80e19334da8124a25ec89fe
\r
123 Author: Micah Anderson <micah@riseup.net>
\r
124 Date: Thu Mar 25 23:07:10 2010 -0400
\r
126 add folder patch, rebased
\r
128 diff --git a/lib/database.cc b/lib/database.cc
\r
129 index c91e97c..6364623 100644
\r
130 --- a/lib/database.cc
\r
131 +++ b/lib/database.cc
\r
132 @@ -84,9 +84,9 @@ typedef struct {
\r
133 * MESSAGE_ID: The unique ID of the mail mess (see "id" above)
\r
135 * In addition, terms from the content of the message are added with
\r
136 - * "from", "to", "attachment", and "subject" prefixes for use by the
\r
137 - * user in searching. But the database doesn't really care itself
\r
138 - * about any of these.
\r
139 + * "from", "to", "attachment", "subject" and "folder" prefixes for use
\r
140 + * by the user in searching. But the database doesn't really care
\r
141 + * itself about any of these.
\r
143 * The data portion of a mail document is empty.
\r
145 @@ -155,7 +155,8 @@ prefix_t PROBABILISTIC_PREFIX[]= {
\r
146 { "from", "XFROM" },
\r
148 { "attachment", "XATTACHMENT" },
\r
149 - { "subject", "XSUBJECT"}
\r
150 + { "subject", "XSUBJECT"},
\r
151 + { "folder", "XFOLDER"}
\r
155 @@ -1362,6 +1363,7 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,
\r
157 notmuch_database_add_message (notmuch_database_t *notmuch,
\r
158 const char *filename,
\r
159 + const char *folder_name,
\r
160 notmuch_message_t **message_ret)
\r
162 notmuch_message_file_t *message_file;
\r
163 @@ -1477,6 +1479,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
\r
164 date = notmuch_message_file_get_header (message_file, "date");
\r
165 _notmuch_message_set_date (message, date);
\r
167 + if (folder_name != NULL)
\r
168 + _notmuch_message_gen_terms (message, "folder", folder_name);
\r
170 _notmuch_message_index_file (message, filename);
\r
172 ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
\r
173 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
174 index 0d9cb0f..e475072 100644
\r
175 --- a/lib/notmuch.h
\r
176 +++ b/lib/notmuch.h
\r
177 @@ -263,6 +263,7 @@ notmuch_database_get_directory (notmuch_database_t *database,
\r
179 notmuch_database_add_message (notmuch_database_t *database,
\r
180 const char *filename,
\r
181 + const char *folder_name,
\r
182 notmuch_message_t **message);
\r
184 /* Remove a message from the given notmuch database.
\r
185 diff --git a/notmuch-new.c b/notmuch-new.c
\r
186 index 93da1d7..394d76c 100644
\r
187 --- a/notmuch-new.c
\r
188 +++ b/notmuch-new.c
\r
190 #include "notmuch-client.h"
\r
192 #include <unistd.h>
\r
195 typedef struct _filename_node {
\r
197 @@ -224,6 +225,35 @@ derive_tags_from_maildir_flags (notmuch_message_t *message,
\r
202 +_get_folder_base_name(const char *path)
\r
204 + gchar *full_folder_name = NULL;
\r
205 + gchar *folder_base_name = NULL;
\r
207 + /* Find name of "folder" containing the email. */
\r
208 + full_folder_name = g_strdup(path);
\r
210 + folder_base_name = g_path_get_basename(full_folder_name);
\r
212 + if (strcmp(folder_base_name, "cur") == 0
\r
213 + || strcmp(folder_base_name, "new") == 0) {
\r
214 + gchar *parent_name = g_path_get_dirname(full_folder_name);
\r
215 + g_free(full_folder_name);
\r
216 + full_folder_name = parent_name;
\r
221 + g_free(full_folder_name);
\r
223 + if (strcmp(folder_base_name, ".") == 0) {
\r
224 + g_free(folder_base_name);
\r
225 + folder_base_name = NULL;
\r
227 + return folder_base_name;
\r
230 /* Examine 'path' recursively as follows:
\r
232 * o Ask the filesystem for the mtime of 'path' (fs_mtime)
\r
233 @@ -277,6 +307,7 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
234 notmuch_filenames_t *db_subdirs = NULL;
\r
236 notmuch_bool_t is_maildir, new_directory;
\r
237 + char *folder_base_name = NULL;
\r
239 if (stat (path, &st)) {
\r
240 fprintf (stderr, "Error reading directory %s: %s\n",
\r
241 @@ -464,7 +495,10 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
245 - status = notmuch_database_add_message (notmuch, next, &message);
\r
246 + folder_base_name = _get_folder_base_name(path);
\r
247 + status = notmuch_database_add_message (notmuch, next,
\r
248 + folder_base_name,
\r
252 case NOTMUCH_STATUS_SUCCESS:
\r
253 @@ -561,6 +595,8 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
254 notmuch_filenames_destroy (db_files);
\r
256 notmuch_directory_destroy (directory);
\r
257 + if (folder_base_name)
\r
258 + g_free(folder_base_name);
\r