1 Return-Path: <amdragon@mit.edu>
\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 A345D429E25
\r
6 for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 17:04:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 axBW01qvmoDk for <notmuch@notmuchmail.org>;
\r
16 Mon, 11 Jul 2011 17:04:57 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id E6A70431FB6
\r
20 for <notmuch@notmuchmail.org>; Mon, 11 Jul 2011 17:04:56 -0700 (PDT)
\r
21 X-AuditID: 1209190d-b7bdeae0000004f8-53-4e1b8f4e8406
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 88.FC.01272.E4F8B1E4; Mon, 11 Jul 2011 20:03:26 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p6C04tEs025954;
\r
27 Mon, 11 Jul 2011 20:04:56 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p6C04spP000258
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 11 Jul 2011 20:04:55 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1QgQSy-0003JE-0Q; Mon, 11 Jul 2011 20:04:44 -0400
\r
37 Date: Mon, 11 Jul 2011 20:04:43 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Louis Rilling <l.rilling@av7.net>
\r
40 Subject: Re: [PATCH v2] tags_to_maildir_flags: Don't rename if no flags change
\r
41 Message-ID: <20110712000443.GE25558@mit.edu>
\r
42 References: <20110711223805.GC3583@localdomain>
\r
43 <1310424115-18850-1-git-send-email-l.rilling@av7.net>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 Content-Disposition: inline
\r
47 In-Reply-To: <1310424115-18850-1-git-send-email-l.rilling@av7.net>
\r
48 User-Agent: Mutt/1.5.20 (2009-06-14)
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42IRYrdT0fXrl/Yz2HvD1OLmzzlsFudbXrFY
\r
51 XL85k9mB2ePuunXsHrs3P2DxeLbqFnMAcxSXTUpqTmZZapG+XQJXxu/2HWwFf0QqrmzNamD8
\r
52 xN/FyMkhIWAicfnOXhYIW0ziwr31bCC2kMA+RonGt65djFxA9gZGiT2LnrJDOCeZJO6saGKE
\r
53 cJYwSpz+vpYZpIVFQFVi0f5brCA2m4CGxLb9yxlBbBGg+M72o+wgNrOAtcSunq9A9RwcwgIB
\r
54 ElvXGoGEeQV0JPb8u8UOsTldYuunk2wQcUGJkzOfsEC0aknc+PeSCaSVWUBaYvk/DpAwp4CT
\r
55 xIveDWAlogIqEtf2t7NNYBSahaR7FpLuWQjdCxiZVzHKpuRW6eYmZuYUpybrFicn5uWlFuka
\r
56 6eVmluilppRuYgSFOack7w7GdweVDjEKcDAq8fCulpb2E2JNLCuuzD3EKMnBpCTK+6sPKMSX
\r
57 lJ9SmZFYnBFfVJqTWnyIUYKDWUmEN6QWKMebklhZlVqUD5OS5mBREudV8/7vC/RvYklqdmpq
\r
58 QWoRTFaGg0NJgpcFGM9CgkWp6akVaZk5JQhpJg5OkOE8QMMtQWp4iwsSc4sz0yHypxgVpcR5
\r
59 L4JcJACSyCjNg+uFpaFXjOJArwjzeoO08wBTGFz3K6DBTECDX0tLggwuSURISTUw2h1XrDz/
\r
60 MPXU3sdK9SF9AWVPat4f9Xw884BIc57J1C/Tr6xdmlb7bskJnswvASnPszeUnv/lwHbUXHUR
\r
61 E/un5c/tZ6kFS94LvjjbLjfxNrvnenWOzBc1MpPfnHnAfc97iQxzyjMV1xgDJ6O5H1K21ks0
\r
62 ndCzerTpVJ6Q+8xur73PY/L6vaZuUmIpzkg01GIuKk4EAOOY1soeAwAA
\r
63 Cc: notmuch@notmuchmail.org
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Tue, 12 Jul 2011 00:04:57 -0000
\r
80 Quoth Louis Rilling on Jul 12 at 12:41 am:
\r
81 > notmuch_message_tags_to_maildir_flags() unconditionally moves messages from
\r
82 > maildir directory "new/" to maildir directory "cur/", which makes messages lose
\r
83 > their "new" status in the MUA. However some users want to keep this "new"
\r
84 > status after, for instance, an auto-tagging of new messages.
\r
86 > However, as Austin mentioned and according to the maildir specification,
\r
87 > messages living in "new/" are not allowed to have flags, even if mutt allows it
\r
88 > to happen. For this reason, this patch prevents moving messages from "new/" to
\r
89 > "cur/", only if no flags have to be changed. It's hopefully enough to satisfy
\r
90 > mutt (and maybe other MUAs showing the "new" status) users checking the "new"
\r
94 > * v2: Fix bool type as well as NULL returned despite having no errors (Austin
\r
97 > Signed-off-by: Louis Rilling <l.rilling@av7.net>
\r
99 > lib/message.cc | 12 +++++++++++-
\r
100 > 1 files changed, 11 insertions(+), 1 deletions(-)
\r
102 > diff --git a/lib/message.cc b/lib/message.cc
\r
103 > index 64b6cf8..3f8c4ba 100644
\r
104 > --- a/lib/message.cc
\r
105 > +++ b/lib/message.cc
\r
106 > @@ -1139,7 +1139,7 @@ _get_maildir_flag_actions (notmuch_message_t *message,
\r
107 > * compute the new maildir filename.
\r
109 > * If the existing filename is in the directory "new", the new
\r
110 > - * filename will be in the directory "cur".
\r
111 > + * filename will be in the directory "cur", unless no flags are changed.
\r
113 > * After a sequence of ":2," in the filename, any subsequent
\r
114 > * single-character flags will be added or removed according to the
\r
115 > @@ -1162,6 +1162,7 @@ _new_maildir_filename (void *ctx,
\r
116 > char *filename_new, *dir;
\r
117 > char flag_map[128];
\r
118 > int flags_in_map = 0;
\r
119 > + notmuch_bool_t flags_changed = FALSE;
\r
123 > @@ -1202,6 +1203,7 @@ _new_maildir_filename (void *ctx,
\r
124 > if (flag_map[flag] == 0) {
\r
125 > flag_map[flag] = 1;
\r
127 > + flags_changed = TRUE;
\r
131 > @@ -1210,9 +1212,17 @@ _new_maildir_filename (void *ctx,
\r
132 > if (flag_map[flag]) {
\r
133 > flag_map[flag] = 0;
\r
135 > + flags_changed = TRUE;
\r
139 > + /* No need to rename. Messages in new/ can be kept in new/.
\r
140 > + * Note: We don't even try to fix buggy messages having flags and living in
\r
141 > + * new/. It's not our business.
\r
143 > + if (!flags_changed)
\r
144 > + return talloc_strdup (ctx, filename);
\r
146 > filename_new = (char *) talloc_size (ctx,
\r
147 > info - filename +
\r
148 > strlen (":2,") + flags_in_map + 1);
\r