1 Return-Path: <jani@nikula.org>
\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 2D441431FCB
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Jan 2014 07:20:27 -0800 (PST)
\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 lgO83u2RzkDi for <notmuch@notmuchmail.org>;
\r
16 Wed, 1 Jan 2014 07:20:22 -0800 (PST)
\r
17 Received: from mail-ea0-f175.google.com (mail-ea0-f175.google.com
\r
18 [209.85.215.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 3E245431FC2
\r
21 for <notmuch@notmuchmail.org>; Wed, 1 Jan 2014 07:20:20 -0800 (PST)
\r
22 Received: by mail-ea0-f175.google.com with SMTP id z10so5862824ead.6
\r
23 for <notmuch@notmuchmail.org>; Wed, 01 Jan 2014 07:20:19 -0800 (PST)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 bh=MGz2lHZEQsnOpII6lA9P1bI3maRf6BCg2qvEQnVBWYk=;
\r
29 b=Moob3M+DjYPBDjEOTsvkuSQGNGNztwdc4JJBB3yBYee051LH9neH3SQDl8dgYtkhDY
\r
30 udaWyuq+T98U43ov6AaUGelF+McJYqg0gY6HEFSfktCOG8TXKRZOyI9m10F7+ZSJgJey
\r
31 6sTJZastCuXCV9zFd+Z3MXq7qH84+3HGIgm2Qs6DmPAZr+d7geVJcUTJSvmo4ygLWI+l
\r
32 D5IgrSkvOvRSEv7/hWOTmT3nAkz1QtITTVu/3wRxi+SY2Xl7FUwkWbswoitrm1bZyKfT
\r
33 08m0HaUxJKaHhtxPfvir0eBQoBMio5Vamx321qH9EbtfHAVntXGN6/VVbC8SEJCFrC59
\r
36 ALoCoQn+dZKHcCLaF+/Lcy53R7RET/qvP6tGIa+NsBCi5UG/J9kKGA3T2+NriDYldnzMDruvkNDj
\r
37 X-Received: by 10.14.205.201 with SMTP id j49mr11544528eeo.85.1388589619104;
\r
38 Wed, 01 Jan 2014 07:20:19 -0800 (PST)
\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
40 [88.195.111.91]) by mx.google.com with ESMTPSA id
\r
41 o1sm127844319eea.10.2014.01.01.07.20.17 for <multiple recipients>
\r
42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
43 Wed, 01 Jan 2014 07:20:18 -0800 (PST)
\r
44 From: Jani Nikula <jani@nikula.org>
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: [PATCH 2/2] insert: respect maildir.synchronize_flags
\r
47 Date: Wed, 1 Jan 2014 17:20:14 +0200
\r
48 Message-Id: <1388589614-19671-2-git-send-email-jani@nikula.org>
\r
49 X-Mailer: git-send-email 1.8.5.2
\r
50 In-Reply-To: <1388589614-19671-1-git-send-email-jani@nikula.org>
\r
51 References: <1388589614-19671-1-git-send-email-jani@nikula.org>
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Wed, 01 Jan 2014 15:20:27 -0000
\r
66 Don't synchronize maildir flags if the user doesn't want it.
\r
68 notmuch-insert.c | 24 ++++++++++++++++--------
\r
70 2 files changed, 16 insertions(+), 9 deletions(-)
\r
72 diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
73 index 2207b1e..55384e3 100644
\r
74 --- a/notmuch-insert.c
\r
75 +++ b/notmuch-insert.c
\r
76 @@ -295,7 +295,7 @@ copy_stdin (int fdin, int fdout)
\r
77 * The file is renamed to encode notmuch tags as maildir flags. */
\r
79 add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
80 - tag_op_list_t *tag_ops)
\r
81 + tag_op_list_t *tag_ops, notmuch_bool_t synchronize_flags)
\r
83 notmuch_message_t *message;
\r
84 notmuch_status_t status;
\r
85 @@ -323,11 +323,15 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
87 if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
\r
88 /* Don't change tags of an existing message. */
\r
89 - status = notmuch_message_tags_to_maildir_flags (message);
\r
90 - if (status != NOTMUCH_STATUS_SUCCESS)
\r
91 - fprintf (stderr, "Error: failed to sync tags to maildir flags\n");
\r
92 + if (synchronize_flags) {
\r
93 + status = notmuch_message_tags_to_maildir_flags (message);
\r
94 + if (status != NOTMUCH_STATUS_SUCCESS)
\r
95 + fprintf (stderr, "Error: failed to sync tags to maildir flags\n");
\r
98 - tag_op_list_apply (message, tag_ops, TAG_FLAG_MAILDIR_SYNC);
\r
99 + tag_op_flag_t flags = synchronize_flags ? TAG_FLAG_MAILDIR_SYNC : 0;
\r
101 + tag_op_list_apply (message, tag_ops, flags);
\r
104 notmuch_message_destroy (message);
\r
105 @@ -335,7 +339,8 @@ add_file_to_database (notmuch_database_t *notmuch, const char *path,
\r
107 static notmuch_bool_t
\r
108 insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
109 - const char *dir, tag_op_list_t *tag_ops)
\r
110 + const char *dir, tag_op_list_t *tag_ops,
\r
111 + notmuch_bool_t synchronize_flags)
\r
115 @@ -377,7 +382,7 @@ insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
117 /* Even if adding the message to the notmuch database fails,
\r
118 * the message is on disk and we consider the delivery completed. */
\r
119 - add_file_to_database (notmuch, newpath, tag_ops);
\r
120 + add_file_to_database (notmuch, newpath, tag_ops, synchronize_flags);
\r
124 @@ -400,6 +405,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
125 char *query_string = NULL;
\r
126 const char *folder = NULL;
\r
127 notmuch_bool_t create_folder = FALSE;
\r
128 + notmuch_bool_t synchronize_flags;
\r
129 const char *maildir;
\r
132 @@ -420,6 +426,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
134 db_path = notmuch_config_get_database_path (config);
\r
135 new_tags = notmuch_config_get_new_tags (config, &new_tags_length);
\r
136 + synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
\r
138 tag_ops = tag_op_list_create (config);
\r
139 if (tag_ops == NULL) {
\r
140 @@ -471,7 +478,8 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
\r
141 NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much))
\r
144 - ret = insert_message (config, notmuch, STDIN_FILENO, maildir, tag_ops);
\r
145 + ret = insert_message (config, notmuch, STDIN_FILENO, maildir, tag_ops,
\r
146 + synchronize_flags);
\r
148 notmuch_database_destroy (notmuch);
\r
150 diff --git a/test/insert b/test/insert
\r
151 index 9283e70..e8dc4c0 100755
\r
154 @@ -114,7 +114,6 @@ dirname=$(dirname "$output")
\r
155 test_expect_equal "$dirname" "$MAIL_DIR/cur"
\r
157 test_begin_subtest "Insert message with maildir sync off goes to new/"
\r
158 -test_subtest_known_broken
\r
159 OLDCONFIG=$(notmuch config get maildir.synchronize_flags)
\r
160 notmuch config set maildir.synchronize_flags false
\r