1 Return-Path: <sojkam1@fel.cvut.cz>
\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 3932D431FBC
\r
6 for <notmuch@notmuchmail.org>; Tue, 16 Feb 2010 01:35:34 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.241 tagged_above=-999 required=5 tests=[AWL=0.358,
\r
12 BAYES_00=-2.599] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 8OGYnQmTiO3C for <notmuch@notmuchmail.org>;
\r
16 Tue, 16 Feb 2010 01:35:33 -0800 (PST)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id F07FB431FAE
\r
19 for <notmuch@notmuchmail.org>; Tue, 16 Feb 2010 01:35:32 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id E260119F3337;
\r
22 Tue, 16 Feb 2010 10:35:31 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
27 with ESMTP id cCmLeC2TiwUL; Tue, 16 Feb 2010 10:35:27 +0100 (CET)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id B51A719F3312;
\r
30 Tue, 16 Feb 2010 10:35:27 +0100 (CET)
\r
31 Received: from steelpick.localdomain (k335-30.felk.cvut.cz [147.32.86.30])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id 91236FA003;
\r
34 Tue, 16 Feb 2010 10:35:27 +0100 (CET)
\r
35 Received: from wsh by steelpick.localdomain with local (Exim 4.71)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>)
\r
37 id 1NhJq3-0000zD-F2; Tue, 16 Feb 2010 10:35:27 +0100
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: Stewart Smith <stewart@flamingspork.com>, Tim Stoakes
\r
40 <notmuch@stoakes.net>, notmuch@notmuchmail.org
\r
41 In-Reply-To: <20100216022128.GH22402@flamingspork.com>
\r
42 References: <87d43b2oif.fsf@yoom.home.cworth.org>
\r
43 <9bfdedddeab9c58cd45d8d448323d0fc@localhost>
\r
44 <87skc23327.fsf@yoom.home.cworth.org>
\r
45 <4b0eef22.JwxdgTGElffx149F%michiel@michielbuddingh.net>
\r
46 <87ws1bjpmm.fsf@yoom.home.cworth.org> <878wdfkhcl.fsf@aegir.org.uk>
\r
47 <20100210031339.GH16686@mail.rocksoft.com>
\r
48 <20100215081331.GD22402@flamingspork.com>
\r
49 <20100216015856.GG22402@flamingspork.com>
\r
50 <20100216021250.GB21780@lapse.rw.madduck.net>
\r
51 <20100216022128.GH22402@flamingspork.com>
\r
52 Date: Tue, 16 Feb 2010 10:35:27 +0100
\r
53 Message-ID: <87vddxikv4.fsf@steelpick.localdomain>
\r
55 Content-Type: text/plain; charset=us-ascii
\r
56 Subject: Re: [notmuch] [PATCH] notmuch: Respect maildir message flags
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Tue, 16 Feb 2010 09:35:34 -0000
\r
71 On Tue, 16 Feb 2010 13:21:28 +1100, Stewart Smith <stewart@flamingspork.com> wrote:
\r
72 > What about this patch (just with those few things fixed)?
\r
74 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
75 > index f25c71f..8303047 100644
\r
76 > --- a/notmuch-new.c
\r
77 > +++ b/notmuch-new.c
\r
78 > @@ -39,6 +39,7 @@ typedef struct {
\r
80 > int processed_files;
\r
81 > int added_messages;
\r
82 > + int tag_maildir;
\r
84 I think notmuch_bool_t will be better than int here.
\r
86 BTW what is the reason for using notmuch_bool_t instead of bool from
\r
89 > @@ -222,6 +277,7 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
90 > notmuch_filenames_t *db_subdirs = NULL;
\r
92 > notmuch_bool_t is_maildir, new_directory;
\r
93 > + int maildir_detected = -1;
\r
95 Again, notmuch_bool_t is IMHO better. You seem only to use values -1 and
\r
96 1 which is quite confusing.
\r
99 > if (stat (path, &st)) {
\r
100 > fprintf (stderr, "Error reading directory %s: %s\n",
\r
101 > @@ -301,6 +357,28 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
105 > + /* If this directory is a Maildir folder, we need to
\r
106 > + * ignore any subdirectories marked tmp/, and scan for
\r
107 > + * Maildir attributes on messages contained in the sub-
\r
108 > + * directories 'new' and 'cur'. */
\r
109 > + if (maildir_detected != 0 &&
\r
110 > + (entry->d_type == DT_DIR || entry->d_type == DT_UNKNOWN) &&
\r
111 > + ((strcmp (entry->d_name, "tmp") == 0) ||
\r
112 > + (strcmp (entry->d_name, "new") == 0) ||
\r
113 > + (strcmp (entry->d_name, "cur") == 0))) {
\r
115 > + if (maildir_detected == -1) {
\r
116 > + maildir_detected = _entries_resemble_maildir(fs_entries, num_fs_entries);
\r
118 > + if (maildir_detected == 1) {
\r
119 > + if (strcmp (entry->d_name, "tmp") == 0) {
\r
122 > + state->tag_maildir = TRUE;
\r
124 You might also want to set this to FALSE somewhere. It is very unlikely,
\r
125 but somebody can create non-maildir under maildir.
\r
127 > @@ -412,7 +490,12 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
129 > case NOTMUCH_STATUS_SUCCESS:
\r
130 > state->added_messages++;
\r
131 > - tag_inbox_and_unread (message);
\r
132 > + if (state->tag_maildir) {
\r
133 > + derive_tags_from_maildir_flags (message,
\r
134 > + entry->d_name);
\r
136 > + tag_inbox_and_unread (message);
\r
139 > /* Non-fatal issues (go on to next file) */
\r
140 > case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
\r
142 You add the tags only to newly discovered mails. If a file is renamed
\r
143 (e.g. because another mail reader removed the S flag), the tags will not
\r
144 be updated. It is a question, what is the proper behavior. I personally
\r
145 use something like what is in your patch and then use notmuchsync to
\r
146 handle renamed files. It has only one problem - notmuchsync is quite
\r
147 slow, so if this is solved in notmuch, I'd be happy.
\r