1 Return-Path: <lists@informa.tiker.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 625D0431FBD
\r
6 for <notmuch@notmuchmail.org>; Mon, 14 Dec 2009 11:28:07 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id oOr2qMlFOKTu for <notmuch@notmuchmail.org>;
\r
11 Mon, 14 Dec 2009 11:28:06 -0800 (PST)
\r
12 X-Greylist: delayed 399 seconds by postgrey-1.32 at olra;
\r
13 Mon, 14 Dec 2009 11:28:06 PST
\r
14 Received: from outbound-mail-13.bluehost.com (outbound-mail-13.bluehost.com
\r
16 by olra.theworths.org (Postfix) with SMTP id 4318A431FAE
\r
17 for <notmuch@notmuchmail.org>; Mon, 14 Dec 2009 11:28:06 -0800 (PST)
\r
18 Received: (qmail 5184 invoked by uid 0); 14 Dec 2009 19:21:26 -0000
\r
19 Received: from unknown (HELO host304.hostmonster.com) (74.220.215.104)
\r
20 by outboundproxy1.bluehost.com with SMTP; 14 Dec 2009 19:21:26 -0000
\r
21 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default;
\r
22 d=informa.tiker.net;
\r
23 h=Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:X-Identified-User;
\r
24 b=Vz72pF1VkS4iE6Y8Wik61cuUXzFLq6VGDO+N8oSn6WplA9tsgh7bDpky0HpbSfU/stLbcqwAMy3SA3eyF0J9vFy7djl8lJqW4lOWxAVgUqAAn8AoQWeA7dAANFMmNRcG;
\r
25 Received: from ip72-221-120-106.ri.ri.cox.net ([72.221.120.106]
\r
26 helo=grizzly.localnet)
\r
27 by host304.hostmonster.com with esmtpsa (TLSv1:AES256-SHA:256)
\r
28 (Exim 4.69) (envelope-from <lists@informa.tiker.net>)
\r
30 for notmuch@notmuchmail.org; Mon, 14 Dec 2009 12:21:26 -0700
\r
31 From: Andreas =?iso-8859-1?q?Kl=F6ckner?= <lists@informa.tiker.net>
\r
32 To: notmuch@notmuchmail.org
\r
33 Date: Mon, 14 Dec 2009 14:21:50 -0500
\r
34 User-Agent: KMail/1.12.2 (Linux/2.6.31-trunk-686; KDE/4.3.2; i686; ; )
\r
36 Content-Type: multipart/signed; boundary="nextPart1983344.e7oaIR2PZV";
\r
37 protocol="application/pgp-signature"; micalg=pgp-sha1
\r
38 Content-Transfer-Encoding: 7bit
\r
39 Message-Id: <200912141421.52561.lists@informa.tiker.net>
\r
40 X-Identified-User: {11749:host304.hostmonster.com:tikernet:tiker.net}
\r
41 {sentby:smtp auth 72.221.120.106 authed with
\r
42 andreas-store+tiker.net}
\r
43 X-Mailman-Approved-At: Mon, 14 Dec 2009 14:44:28 -0800
\r
44 Subject: [notmuch] [patch] store folder information
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.12
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Mon, 14 Dec 2009 19:28:07 -0000
\r
59 --nextPart1983344.e7oaIR2PZV
\r
60 Content-Type: multipart/mixed;
\r
61 boundary="Boundary-01=_OBpJLuJNt54jnVC"
\r
62 Content-Transfer-Encoding: 7bit
\r
65 --Boundary-01=_OBpJLuJNt54jnVC
\r
66 Content-Type: Text/Plain;
\r
68 Content-Transfer-Encoding: quoted-printable
\r
69 Content-Disposition: inline
\r
73 I've patched notmuch to retain information on which folder emails are store=
\r
75 in. This makes the transition from a folders-and-procmail model somewhat=20
\r
76 easier. The resulting changes are attached.
\r
80 --Boundary-01=_OBpJLuJNt54jnVC
\r
81 Content-Type: text/x-patch;
\r
83 name="0001-Preseve-folder-information-when-indexing.patch"
\r
84 Content-Transfer-Encoding: quoted-printable
\r
85 Content-Disposition: attachment;
\r
86 filename="0001-Preseve-folder-information-when-indexing.patch"
\r
88 =46rom 179af7f436d8c21bad90e7eb88fc17c56f83c26c Mon Sep 17 00:00:00 2001
\r
89 =46rom: Andreas Kloeckner <inform@tiker.net>
\r
90 Date: Mon, 14 Dec 2009 14:16:20 -0500
\r
91 Subject: [PATCH] Preseve folder information when indexing.
\r
94 lib/database.cc | 14 +++++++++-----
\r
97 notmuch-new.c | 35 ++++++++++++++++++++++++++++++++++-
\r
98 4 files changed, 46 insertions(+), 6 deletions(-)
\r
100 diff --git a/lib/database.cc b/lib/database.cc
\r
101 index b6c4d07..e6b4272 100644
\r
102 =2D-- a/lib/database.cc
\r
103 +++ b/lib/database.cc
\r
104 @@ -70,10 +70,9 @@ typedef struct {
\r
106 * MESSAGE_ID: The unique ID of the mail mess (see "id" above)
\r
108 =2D * In addition, terms from the content of the message are added with
\r
109 =2D * "from", "to", "attachment", and "subject" prefixes for use by the
\r
110 =2D * user in searching. But the database doesn't really care itself
\r
111 =2D * about any of these.
\r
112 + * In addition, terms from the content of the message are added with "from=
\r
114 + * "to", "attachment", "subject", and "folder" prefixes for use by the use=
\r
116 + * searching. But the database doesn't really care itself about any of the=
\r
119 * Timestamp document
\r
120 * ------------------
\r
121 @@ -124,7 +123,8 @@ prefix_t PROBABILISTIC_PREFIX[]=3D {
\r
122 { "from", "XFROM" },
\r
124 { "attachment", "XATTACHMENT" },
\r
125 =2D { "subject", "XSUBJECT"}
\r
126 + { "subject", "XSUBJECT"},
\r
127 + { "folder", "XFOLDER"}
\r
131 @@ -889,6 +889,7 @@ _notmuch_database_link_message (notmuch_database_t *not=
\r
134 notmuch_database_add_message (notmuch_database_t *notmuch,
\r
135 const char *filename,
\r
136 + const char *folder_name,
\r
137 notmuch_message_t **message_ret)
\r
139 notmuch_message_file_t *message_file;
\r
140 @@ -1006,6 +1007,9 @@ notmuch_database_add_message (notmuch_database_t *not=
\r
143 _notmuch_message_index_file (message, filename);
\r
145 + if (folder_name !=3D NULL)
\r
146 + _notmuch_message_gen_terms (message, "folder", folder_name);
\r
148 _notmuch_message_sync (message);
\r
149 } catch (const Xapian::Error &error) {
\r
150 fprintf (stderr, "A Xapian exception occurred adding message: %s.\n",
\r
151 diff --git a/lib/index.cc b/lib/index.cc
\r
152 index 125fa6c..55f3fbc 100644
\r
153 =2D-- a/lib/index.cc
\r
155 @@ -116,6 +116,8 @@ skip_re_in_subject (const char *subject)
\r
157 if (strncasecmp (s, "re:", 3) =3D=3D 0)
\r
159 + else if (strncasecmp (s, "aw:", 3) =3D=3D 0)
\r
164 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
165 index 60834fb..5d3b3c6 100644
\r
166 =2D-- a/lib/notmuch.h
\r
167 +++ b/lib/notmuch.h
\r
168 @@ -265,6 +265,7 @@ notmuch_database_get_timestamp (notmuch_database_t *dat=
\r
171 notmuch_database_add_message (notmuch_database_t *database,
\r
172 const char *filename,
\r
173 + const char *folder_name,
\r
174 notmuch_message_t **message);
\r
176 /* Find a message with the given message_id.
\r
177 diff --git a/notmuch-new.c b/notmuch-new.c
\r
178 index 9d20616..bc8adc8 100644
\r
179 =2D-- a/notmuch-new.c
\r
180 +++ b/notmuch-new.c
\r
182 #include "notmuch-client.h"
\r
184 #include <unistd.h>
\r
187 static volatile sig_atomic_t do_add_files_print_progress =3D 0;
\r
189 @@ -144,6 +145,34 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
190 struct dirent **namelist =3D NULL;
\r
193 + gchar *full_folder_name =3D NULL;
\r
194 + gchar *folder_base_name =3D NULL;
\r
196 + /* Find name of "folder" containing the email. */
\r
197 + full_folder_name =3D g_strdup(path);
\r
200 + folder_base_name =3D g_path_get_basename(full_folder_name);
\r
202 + if (strcmp(folder_base_name, "cur") =3D=3D 0
\r
203 + || strcmp(folder_base_name, "new") =3D=3D 0)
\r
205 + gchar *parent_name =3D g_path_get_dirname(full_folder_name);
\r
206 + g_free(full_folder_name);
\r
207 + full_folder_name =3D parent_name;
\r
213 + g_free(full_folder_name);
\r
215 + if (strcmp(folder_base_name, ".") =3D=3D 0)
\r
217 + g_free(folder_base_name);
\r
218 + folder_base_name =3D NULL;
\r
221 /* If we're told to, we bail out on encountering a read-only
\r
222 * directory, (with this being a clear clue from the user to
\r
223 * Notmuch that new mail won't be arriving there and we need not
\r
224 @@ -235,7 +264,9 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
228 =2D status =3D notmuch_database_add_message (notmuch, next, &message);
\r
229 + status =3D notmuch_database_add_message (notmuch, next,=20
\r
230 + folder_base_name,=20
\r
234 case NOTMUCH_STATUS_SUCCESS:
\r
235 @@ -301,6 +332,8 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
239 + if (folder_base_name)
\r
240 + g_free(folder_base_name);
\r
248 --Boundary-01=_OBpJLuJNt54jnVC--
\r
250 --nextPart1983344.e7oaIR2PZV
\r
251 Content-Type: application/pgp-signature; name=signature.asc
\r
252 Content-Description: This is a digitally signed message part.
\r
254 -----BEGIN PGP SIGNATURE-----
\r
255 Version: GnuPG v1.4.10 (GNU/Linux)
\r
257 iD8DBQBLJpBOJZ7T4Hn4+FIRAv5IAJ9Yd+fs8bxZiQ05CTfh8ZEQYo2yLQCgg+pP
\r
258 sPs3672uLyTZNkcIZlj0zR8=
\r
260 -----END PGP SIGNATURE-----
\r
262 --nextPart1983344.e7oaIR2PZV--
\r