Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / a6 / bc5f2a953e3254376132b889474e9cd49734c9
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 33B81431FC3\r
6         for <notmuch@notmuchmail.org>; Sat,  9 Jun 2012 12:14:57 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 wGiO8uc-tsxG for <notmuch@notmuchmail.org>;\r
16         Sat,  9 Jun 2012 12:14:55 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id 13A55431FAF\r
20         for <notmuch@notmuchmail.org>; Sat,  9 Jun 2012 12:14:55 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7fd56d000000933-f8-4fd3a0aef381\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id E1.8E.02355.EA0A3DF4; Sat,  9 Jun 2012 15:14:54 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q59JEsqq017467; \r
27         Sat, 9 Jun 2012 15:14:54 -0400\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q59JEqVV026108\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 9 Jun 2012 15:14:53 -0400 (EDT)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1SdR75-0000wv-PS; Sat, 09 Jun 2012 15:14:19 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 4/5] lib: Treat messages in new/ as maildir messages with\r
41         no flags set\r
42 Date: Sat,  9 Jun 2012 15:14:17 -0400\r
43 Message-Id: <1339269258-3542-5-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.10\r
45 In-Reply-To: <1339269258-3542-1-git-send-email-amdragon@mit.edu>\r
46 References: <1338742656-11640-1-git-send-email-amdragon@mit.edu>\r
47         <1339269258-3542-1-git-send-email-amdragon@mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsUixG6nrrtuwWV/g8OtihZN050trt+cyezA\r
50         5HHr/mt2j2erbjEHMEVx2aSk5mSWpRbp2yVwZfy48JWt4I5gxZZ/d5kaGGfydTFyckgImEh8\r
51         OXSWFcIWk7hwbz1bFyMXh5DAPkaJx737WEASQgLrGSWuvBSASDxkkthxdgc7hDOXUeLe6bVs\r
52         IFVsAhoS2/YvZwSxRQSkJXbenQ00loODWcBc4mZLHEhYWCBSYtvFhUwgNouAqkRT/3d2kBJe\r
53         AXuJJd8FIY6Ql3h6vw9sIqeAg8Sz79MZIW4ok3h2ejbbBEb+BYwMqxhlU3KrdHMTM3OKU5N1\r
54         i5MT8/JSi3SN9HIzS/RSU0o3MYKCiFOSdwfju4NKhxgFOBiVeHi15C/5C7EmlhVX5h5ilORg\r
55         UhLl/TL/sr8QX1J+SmVGYnFGfFFpTmrxIUYJDmYlEd6tTEDlvCmJlVWpRfkwKWkOFiVx3gSu\r
56         s/5CAumJJanZqakFqUUwWRkODiUJ3jxgtAgJFqWmp1akZeaUIKSZODhBhvMADX8Dspi3uCAx\r
57         tzgzHSJ/ilFRSpzXFKRZACSRUZoH1wuL8leM4kCvCPNag1TxABMEXPcroMFMQINboy6ADC5J\r
58         REhJNTDKzzkrWN+j7KGyan3lZ6tUL77zh0u3LasQNUk+KnNwq6JHaMEUPva04IvVWw7mLInP\r
59         r5F/4FT7WnRDxBLvfOscC47SufefPjsuf55h/ss9LWeylJRLRMItUh57yt1a9fhEbgHPypY3\r
60         Wu0umj7Lbx5q5RLrfPRTimXlqVvrf09flP/8v2V63n0lluKMREMt5qLiRACDHwiDzQIAAA==\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Sat, 09 Jun 2012 19:14:57 -0000\r
74 \r
75 Previously, notmuch new only synchronized maildir flags to tags for\r
76 files with a maildir "info" part.  Since messages in new/ don't have\r
77 an info part, notmuch would ignore them for flag-to-tag\r
78 synchronization.\r
79 \r
80 This patch makes notmuch consider messages in new/ to be legitimate\r
81 maildir messages that simply have no maildir flags set.  The most\r
82 visible effect of this is that such messages now automatically get the\r
83 unread tag.\r
84 ---\r
85  lib/message.cc    |   20 +++++++++++++-------\r
86  test/maildir-sync |    1 -\r
87  2 files changed, 13 insertions(+), 8 deletions(-)\r
88 \r
89 diff --git a/lib/message.cc b/lib/message.cc\r
90 index bbac2ff..978de06 100644\r
91 --- a/lib/message.cc\r
92 +++ b/lib/message.cc\r
93 @@ -1090,13 +1090,19 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)\r
94             continue;\r
95  \r
96         flags = strstr (filename, ":2,");\r
97 -       if (! flags)\r
98 -           continue;\r
99 -\r
100 -       seen_maildir_info = 1;\r
101 -       flags += 3;\r
102 -\r
103 -       combined_flags = talloc_strdup_append (combined_flags, flags);\r
104 +       if (flags) {\r
105 +           seen_maildir_info = 1;\r
106 +           flags += 3;\r
107 +           combined_flags = talloc_strdup_append (combined_flags, flags);\r
108 +       } else if (STRNCMP_LITERAL (dir, "new/") == 0) {\r
109 +           /* Messages are delivered to new/ with no "info" part, but\r
110 +            * they effectively have default maildir flags.  According\r
111 +            * to the spec, we should ignore the info part for\r
112 +            * messages in new/, but some MUAs (mutt) can set maildir\r
113 +            * flags on messages in new/, so we're liberal in what we\r
114 +            * accept. */\r
115 +           seen_maildir_info = 1;\r
116 +       }\r
117      }\r
118  \r
119      /* If none of the filenames have any maildir info field (not even\r
120 diff --git a/test/maildir-sync b/test/maildir-sync\r
121 index 6360fd2..01348d3 100755\r
122 --- a/test/maildir-sync\r
123 +++ b/test/maildir-sync\r
124 @@ -167,7 +167,6 @@ notmuch tag +unread +draft -flagged subject:"Non-compliant maildir info"\r
125  test_expect_equal "$(cd $MAIL_DIR/cur/; ls non-compliant*)" "non-compliant-maildir-info:2,These-are-not-flags-in-ASCII-order-donottouch"\r
126  \r
127  test_begin_subtest "Files in new/ get default synchronized tags"\r
128 -test_subtest_known_broken\r
129  OLDCONFIG=$(notmuch config get new.tags)\r
130  notmuch config set new.tags test\r
131  add_message [subject]='"File in new/"' [dir]=new [filename]='file-in-new'\r
132 -- \r
133 1.7.10\r
134 \r