Re: Emacs: notmuch-mua-mail throws error if notmuch-fcc-dirs does not exist
[notmuch-archives.git] / de / c424a7ded5de2e4ecb5d0d1763f7d9c17c900a
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 DAA0D431FAF\r
6         for <notmuch@notmuchmail.org>; Sun,  3 Jun 2012 09:58:15 -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 v8UKkbHzkHPu for <notmuch@notmuchmail.org>;\r
16         Sun,  3 Jun 2012 09:58:15 -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 0CE0E431FC4\r
20         for <notmuch@notmuchmail.org>; Sun,  3 Jun 2012 09:58:14 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7fd56d000000933-f1-4fcb97a631eb\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 92.98.02355.6A79BCF4; Sun,  3 Jun 2012 12:58:14 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q53GwDSG012636; \r
27         Sun, 3 Jun 2012 12:58:13 -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 q53GwC1m004204\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sun, 3 Jun 2012 12:58:13 -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 1SbE7j-00037u-Oa; Sun, 03 Jun 2012 12:57:51 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 2/4] lib: Move _filename_is_in_maildir\r
41 Date: Sun,  3 Jun 2012 12:57:34 -0400\r
42 Message-Id: <1338742656-11640-3-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10\r
44 In-Reply-To: <1338742656-11640-1-git-send-email-amdragon@mit.edu>\r
45 References: <1338742656-11640-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrLts+ml/g4+3lS2u35zJ7MDo8WzV\r
48         LeYAxigum5TUnMyy1CJ9uwSujCWPl7AWPJao2Ph+OlsD40+hLkZODgkBE4nZ89oZIWwxiQv3\r
49         1rN1MXJxCAnsY5SY2vyPFcJZzyixu/kWlPOQSWJH8wooZy6jRPOJY6wg/WwCGhLb9i8HmyUi\r
50         IC2x8+5soDgHB7OAmsSfLhWQsLCAmcT1OxPBylkEVCXufD7EAlLCK+AgcfGRBMQV8hJP7/ex\r
51         gYQ5BRwleg+YgISFgCo+NFxhn8DIv4CRYRWjbEpulW5uYmZOcWqybnFyYl5eapGukV5uZole\r
52         akrpJkZwyEjy7mB8d1DpEKMAB6MSD+/nWaf8hVgTy4orcw8xSnIwKYnyTpt62l+ILyk/pTIj\r
53         sTgjvqg0J7X4EKMEB7OSCG+nHVCONyWxsiq1KB8mJc3BoiTOu0pzt7+QQHpiSWp2ampBahFM\r
54         VoaDQ0mClxUYG0KCRanpqRVpmTklCGkmDk6Q4TxAw7lAaniLCxJzizPTIfKnGHU55h06d51R\r
55         iCUvPy9VSpxXBKRIAKQoozQPbg4s1l8xigO9Jcz7chpQFQ8wTcBNegW0hAloicHhkyBLShIR\r
56         UlINjAb+t9S/Hl9beqc8eH//XCG9vxPmcD+akJDySWZflF76EalX6112GiUZeulsCwuO8Ta3\r
57         CZ9zvfDSziKFzQl5JirVjxks7Wzj9l6/t9j1xfbjrf7PpdTnVL2f4GK8/fUTw2/nZn58Xf1m\r
58         c/CH+k8iD4J1TT8f7glS6NVYcuJ5WcDnzOa7x9nvzVFiKc5INNRiLipOBABRtbX50AIAAA==\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Sun, 03 Jun 2012 16:58:16 -0000\r
72 \r
73 This way notmuch_message_maildir_flags_to_tags can call it.  It makes\r
74 more sense for this to be just above all of the maildir\r
75 synchronization code rather than mixed in the middle.\r
76 ---\r
77  lib/message.cc |   82 ++++++++++++++++++++++++++++----------------------------\r
78  1 file changed, 41 insertions(+), 41 deletions(-)\r
79 \r
80 diff --git a/lib/message.cc b/lib/message.cc\r
81 index 6787506..ed96477 100644\r
82 --- a/lib/message.cc\r
83 +++ b/lib/message.cc\r
84 @@ -1027,6 +1027,47 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag)\r
85      return NOTMUCH_STATUS_SUCCESS;\r
86  }\r
87  \r
88 +/* Is the given filename within a maildir directory?\r
89 + *\r
90 + * Specifically, is the final directory component of 'filename' either\r
91 + * "cur" or "new". If so, return a pointer to that final directory\r
92 + * component within 'filename'. If not, return NULL.\r
93 + *\r
94 + * A non-NULL return value is guaranteed to be a valid string pointer\r
95 + * pointing to the characters "new/" or "cur/", (but not\r
96 + * NUL-terminated).\r
97 + */\r
98 +static const char *\r
99 +_filename_is_in_maildir (const char *filename)\r
100 +{\r
101 +    const char *slash, *dir = NULL;\r
102 +\r
103 +    /* Find the last '/' separating directory from filename. */\r
104 +    slash = strrchr (filename, '/');\r
105 +    if (slash == NULL)\r
106 +       return NULL;\r
107 +\r
108 +    /* Jump back 4 characters to where the previous '/' will be if the\r
109 +     * directory is named "cur" or "new". */\r
110 +    if (slash - filename < 4)\r
111 +       return NULL;\r
112 +\r
113 +    slash -= 4;\r
114 +\r
115 +    if (*slash != '/')\r
116 +       return NULL;\r
117 +\r
118 +    dir = slash + 1;\r
119 +\r
120 +    if (STRNCMP_LITERAL (dir, "cur/") == 0 ||\r
121 +       STRNCMP_LITERAL (dir, "new/") == 0)\r
122 +    {\r
123 +       return dir;\r
124 +    }\r
125 +\r
126 +    return NULL;\r
127 +}\r
128 +\r
129  notmuch_status_t\r
130  notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)\r
131  {\r
132 @@ -1083,47 +1124,6 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)\r
133      return status;\r
134  }\r
135  \r
136 -/* Is the given filename within a maildir directory?\r
137 - *\r
138 - * Specifically, is the final directory component of 'filename' either\r
139 - * "cur" or "new". If so, return a pointer to that final directory\r
140 - * component within 'filename'. If not, return NULL.\r
141 - *\r
142 - * A non-NULL return value is guaranteed to be a valid string pointer\r
143 - * pointing to the characters "new/" or "cur/", (but not\r
144 - * NUL-terminated).\r
145 - */\r
146 -static const char *\r
147 -_filename_is_in_maildir (const char *filename)\r
148 -{\r
149 -    const char *slash, *dir = NULL;\r
150 -\r
151 -    /* Find the last '/' separating directory from filename. */\r
152 -    slash = strrchr (filename, '/');\r
153 -    if (slash == NULL)\r
154 -       return NULL;\r
155 -\r
156 -    /* Jump back 4 characters to where the previous '/' will be if the\r
157 -     * directory is named "cur" or "new". */\r
158 -    if (slash - filename < 4)\r
159 -       return NULL;\r
160 -\r
161 -    slash -= 4;\r
162 -\r
163 -    if (*slash != '/')\r
164 -       return NULL;\r
165 -\r
166 -    dir = slash + 1;\r
167 -\r
168 -    if (STRNCMP_LITERAL (dir, "cur/") == 0 ||\r
169 -       STRNCMP_LITERAL (dir, "new/") == 0)\r
170 -    {\r
171 -       return dir;\r
172 -    }\r
173 -\r
174 -    return NULL;\r
175 -}\r
176 -\r
177  /* From the set of tags on 'message' and the flag2tag table, compute a\r
178   * set of maildir-flag actions to be taken, (flags that should be\r
179   * either set or cleared).\r
180 -- \r
181 1.7.10\r
182 \r