Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2A19840DDC2 for ; Sat, 20 Nov 2010 15:28:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fy9O07VicXNe for ; Sat, 20 Nov 2010 15:27:53 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 51FE640DEEC for ; Sat, 20 Nov 2010 15:27:53 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id A9ADD19F3356; Sun, 21 Nov 2010 00:27:52 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id b86LBBIQJ7FU; Sun, 21 Nov 2010 00:27:51 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id EFE3E19F3363; Sun, 21 Nov 2010 00:27:50 +0100 (CET) Received: from wsheee.2x.cz (unknown [213.29.198.144]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id ECD29FA003; Sun, 21 Nov 2010 00:27:50 +0100 (CET) Received: from wsh by wsheee.2x.cz with local (Exim 4.72) (envelope-from ) id 1PJwqU-0000Ox-Gx; Sun, 21 Nov 2010 00:27:50 +0100 From: Michal Sojka To: notmuch@notmuchmail.org Subject: [PATCH 2/2] Include 'unread' tag only to mails in new Date: Sun, 21 Nov 2010 00:27:40 +0100 Message-Id: <1290295660-1508-2-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.1.90.g94d6d4 In-Reply-To: <87pqtzk254.fsf@wsheee.2x.cz> References: <87pqtzk254.fsf@wsheee.2x.cz> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Nov 2010 23:28:07 -0000 Ruben's previous patch fixed the problem that he experienced, but it also caused the test "Removing info from filename leaves tags unchanged" to fail. This is an attempt to make all tests to pass. The Ruben's change is restricted to be only effective in 'new' directory. --- lib/message.cc | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 996c1df..e769bf5 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -905,6 +905,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message) char *combined_flags = talloc_strdup (message, ""); unsigned i; int seen_maildir_info = 0; + const char *dir; for (filenames = notmuch_message_get_filenames (message); notmuch_filenames_valid (filenames); @@ -912,13 +913,17 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message) { filename = notmuch_filenames_get (filenames); - if (! _filename_is_in_maildir(filename)) + dir = _filename_is_in_maildir(filename); + if (! dir) continue; - seen_maildir_info = 1; + + if (STRNCMP_LITERAL (dir, "new/") == 0) + seen_maildir_info = 1; flags = strstr (filename, ":2,"); if (! flags) continue; + seen_maildir_info = 1; flags += 3; -- 1.7.1.90.g94d6d4