1 Return-Path: <tomi.ollila@iki.fi>
\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 1127C431FC0
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Jan 2014 08:30:51 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 0RBL7aHw0V9W for <notmuch@notmuchmail.org>;
\r
16 Wed, 1 Jan 2014 08:30:43 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 5DFA7431FAF
\r
19 for <notmuch@notmuchmail.org>; Wed, 1 Jan 2014 08:30:43 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id A63801000B2;
\r
22 Wed, 1 Jan 2014 18:30:35 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH 2/2] insert: respect maildir.synchronize_flags
\r
26 In-Reply-To: <1388589614-19671-2-git-send-email-jani@nikula.org>
\r
27 References: <1388589614-19671-1-git-send-email-jani@nikula.org>
\r
28 <1388589614-19671-2-git-send-email-jani@nikula.org>
\r
29 User-Agent: Notmuch/0.17+13~gdfcf116 (http://notmuchmail.org) Emacs/24.3.1
\r
30 (x86_64-unknown-linux-gnu)
\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
32 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
33 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
34 Date: Wed, 01 Jan 2014 18:30:35 +0200
\r
35 Message-ID: <m2k3ejfyvo.fsf@guru.guru-group.fi>
\r
37 Content-Type: text/plain
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Wed, 01 Jan 2014 16:30:51 -0000
\r
52 On Wed, Jan 01 2014, Jani Nikula <jani@nikula.org> wrote:
\r
54 > Don't synchronize maildir flags if the user doesn't want it.
\r
57 Looks good, tests pass.
\r
62 > notmuch-insert.c | 24 ++++++++++++++++--------
\r
64 > 2 files changed, 16 insertions(+), 9 deletions(-)
\r
66 > diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
67 > index 2207b1e..55384e3 100644
\r
68 > --- a/notmuch-insert.c
\r
69 > +++ b/notmuch-insert.c
\r
70 > @@ -295,7 +295,7 @@ copy_stdin (int fdin, int fdout)
\r
71 > * The file is renamed to encode notmuch tags as maildir flags. */
\r
73 > add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
74 > - tag_op_list_t *tag_ops)
\r
75 > + tag_op_list_t *tag_ops, notmuch_bool_t synchronize_flags)
\r
77 > notmuch_message_t *message;
\r
78 > notmuch_status_t status;
\r
79 > @@ -323,11 +323,15 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
81 > if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
\r
82 > /* Don't change tags of an existing message. */
\r
83 > - status = notmuch_message_tags_to_maildir_flags (message);
\r
84 > - if (status != NOTMUCH_STATUS_SUCCESS)
\r
85 > - fprintf (stderr, "Error: failed to sync tags to maildir flags\n");
\r
86 > + if (synchronize_flags) {
\r
87 > + status = notmuch_message_tags_to_maildir_flags (message);
\r
88 > + if (status != NOTMUCH_STATUS_SUCCESS)
\r
89 > + fprintf (stderr, "Error: failed to sync tags to maildir flags\n");
\r
92 > - tag_op_list_apply (message, tag_ops, TAG_FLAG_MAILDIR_SYNC);
\r
93 > + tag_op_flag_t flags = synchronize_flags ? TAG_FLAG_MAILDIR_SYNC : 0;
\r
95 > + tag_op_list_apply (message, tag_ops, flags);
\r
98 > notmuch_message_destroy (message);
\r
99 > @@ -335,7 +339,8 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
101 > static notmuch_bool_t
\r
102 > insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
103 > - const char *dir, tag_op_list_t *tag_ops)
\r
104 > + const char *dir, tag_op_list_t *tag_ops,
\r
105 > + notmuch_bool_t synchronize_flags)
\r
109 > @@ -377,7 +382,7 @@ insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
111 > /* Even if adding the message to the notmuch database fails,
\r
112 > * the message is on disk and we consider the delivery completed. */
\r
113 > - add_file_to_database (notmuch, newpath, tag_ops);
\r
114 > + add_file_to_database (notmuch, newpath, tag_ops, synchronize_flags);
\r
118 > @@ -400,6 +405,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
119 > char *query_string = NULL;
\r
120 > const char *folder = NULL;
\r
121 > notmuch_bool_t create_folder = FALSE;
\r
122 > + notmuch_bool_t synchronize_flags;
\r
123 > const char *maildir;
\r
126 > @@ -420,6 +426,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
128 > db_path = notmuch_config_get_database_path (config);
\r
129 > new_tags = notmuch_config_get_new_tags (config, &new_tags_length);
\r
130 > + synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
\r
132 > tag_ops = tag_op_list_create (config);
\r
133 > if (tag_ops == NULL) {
\r
134 > @@ -471,7 +478,8 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
135 > NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much))
\r
138 > - ret = insert_message (config, notmuch, STDIN_FILENO, maildir, tag_ops);
\r
139 > + ret = insert_message (config, notmuch, STDIN_FILENO, maildir, tag_ops,
\r
140 > + synchronize_flags);
\r
142 > notmuch_database_destroy (notmuch);
\r
144 > diff --git a/test/insert b/test/insert
\r
145 > index 9283e70..e8dc4c0 100755
\r
146 > --- a/test/insert
\r
147 > +++ b/test/insert
\r
148 > @@ -114,7 +114,6 @@ dirname=$(dirname "$output")
\r
149 > test_expect_equal "$dirname" "$MAIL_DIR/cur"
\r
151 > test_begin_subtest "Insert message with maildir sync off goes to new/"
\r
152 > -test_subtest_known_broken
\r
153 > OLDCONFIG=$(notmuch config get maildir.synchronize_flags)
\r
154 > notmuch config set maildir.synchronize_flags false
\r
159 > _______________________________________________
\r
160 > notmuch mailing list
\r
161 > notmuch@notmuchmail.org
\r
162 > http://notmuchmail.org/mailman/listinfo/notmuch
\r