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 3F24D431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 9 Jun 2012 12:14:58 -0700 (PDT)
\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 WRM8j-tTIMj8 for <notmuch@notmuchmail.org>;
\r
16 Sat, 9 Jun 2012 12:14:57 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 521F8431FB6
\r
20 for <notmuch@notmuchmail.org>; Sat, 9 Jun 2012 12:14:55 -0700 (PDT)
\r
21 X-AuditID: 1209190e-b7fb56d0000008b2-8b-4fd3a0aea1a9
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 77.43.02226.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-1.mit.edu (8.13.8/8.9.2) with ESMTP id q59JErUa015441;
\r
27 Sat, 9 Jun 2012 15:14:53 -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 q59JEqkw026105
\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-0000wp-MN; 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 2/5] lib: Move _filename_is_in_maildir
\r
41 Date: Sat, 9 Jun 2012 15:14:15 -0400
\r
42 Message-Id: <1339269258-3542-3-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10
\r
44 In-Reply-To: <1339269258-3542-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1338742656-11640-1-git-send-email-amdragon@mit.edu>
\r
46 <1339269258-3542-1-git-send-email-amdragon@mit.edu>
\r
47 X-Brightmail-Tracker:
\r
48 H4sIAAAAAAAAA+NgFjrBIsWRmVeSWpSXmKPExsUixCmqrLtuwWV/g1/XDSyapjtbXL85k9mB
\r
49 yePW/dfsHs9W3WIOYIrisklJzcksSy3St0vgyljyeAlrwWOJio3vp7M1MP4U6mLk5JAQMJF4
\r
50 fHQxI4QtJnHh3nq2LkYuDiGBfYwSk3Z8ZoFw1jNKdDbNZ4ZwHjJJbDv2nxXCmcso0bJ0JTNI
\r
51 P5uAhsS2/cvBZokISEvsvDsbqIiDg1nAXOJmSxxIWFjAUuL6uoPsIDaLgKpE/6oHbCA2r4C9
\r
52 xJQzzewQZ8hLPL3fBxbnFHCQePZ9OthIIYEyiWenZ7NNYORfwMiwilE2JbdKNzcxM6c4NVm3
\r
53 ODkxLy+1SNdYLzezRC81pXQTIziQJPl2MH49qHSIUYCDUYmHV1f+kr8Qa2JZcWXuIUZJDiYl
\r
54 Ud762Zf9hfiS8lMqMxKLM+KLSnNSiw8xSnAwK4nwbmUCKudNSaysSi3Kh0lJc7AoifMmcp31
\r
55 FxJITyxJzU5NLUgtgsnKcHAoSfDumg80VLAoNT21Ii0zpwQhzcTBCTKcB2j4G5Aa3uKCxNzi
\r
56 zHSI/ClGXY55h85dZxRiycvPS5UShxgkAFKUUZoHNweWAF4xigO9Jcy7H6SKB5g84Ca9AlrC
\r
57 BLSkNeoCyJKSRISUVANjYbiN53b+vVPCnxTvCzgz52+CZOSp2fZbFkX83JDr3Xlze7H0PDm5
\r
58 mfMjH6eZ7G708D7Vuespn8SFW2eeRHHO2vTx86VzX+ZmcGsw2SU6RTXmRAr8D99p5dWoVW/M
\r
59 cmPD475XGk/LwuLk18cvTCtrLVrbabv+lsuU4P0hD3OfvzeZuqRN8USUEktxRqKhFnNRcSIA
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\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:58 -0000
\r
75 This way notmuch_message_maildir_flags_to_tags can call it. It makes
\r
76 more sense for this to be just above all of the maildir
\r
77 synchronization code rather than mixed in the middle.
\r
79 lib/message.cc | 82 ++++++++++++++++++++++++++++----------------------------
\r
80 1 file changed, 41 insertions(+), 41 deletions(-)
\r
82 diff --git a/lib/message.cc b/lib/message.cc
\r
83 index 6787506..ed96477 100644
\r
84 --- a/lib/message.cc
\r
85 +++ b/lib/message.cc
\r
86 @@ -1027,6 +1027,47 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag)
\r
87 return NOTMUCH_STATUS_SUCCESS;
\r
90 +/* Is the given filename within a maildir directory?
\r
92 + * Specifically, is the final directory component of 'filename' either
\r
93 + * "cur" or "new". If so, return a pointer to that final directory
\r
94 + * component within 'filename'. If not, return NULL.
\r
96 + * A non-NULL return value is guaranteed to be a valid string pointer
\r
97 + * pointing to the characters "new/" or "cur/", (but not
\r
98 + * NUL-terminated).
\r
100 +static const char *
\r
101 +_filename_is_in_maildir (const char *filename)
\r
103 + const char *slash, *dir = NULL;
\r
105 + /* Find the last '/' separating directory from filename. */
\r
106 + slash = strrchr (filename, '/');
\r
107 + if (slash == NULL)
\r
110 + /* Jump back 4 characters to where the previous '/' will be if the
\r
111 + * directory is named "cur" or "new". */
\r
112 + if (slash - filename < 4)
\r
117 + if (*slash != '/')
\r
122 + if (STRNCMP_LITERAL (dir, "cur/") == 0 ||
\r
123 + STRNCMP_LITERAL (dir, "new/") == 0)
\r
132 notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
\r
134 @@ -1083,47 +1124,6 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
\r
138 -/* Is the given filename within a maildir directory?
\r
140 - * Specifically, is the final directory component of 'filename' either
\r
141 - * "cur" or "new". If so, return a pointer to that final directory
\r
142 - * component within 'filename'. If not, return NULL.
\r
144 - * A non-NULL return value is guaranteed to be a valid string pointer
\r
145 - * pointing to the characters "new/" or "cur/", (but not
\r
146 - * NUL-terminated).
\r
148 -static const char *
\r
149 -_filename_is_in_maildir (const char *filename)
\r
151 - const char *slash, *dir = NULL;
\r
153 - /* Find the last '/' separating directory from filename. */
\r
154 - slash = strrchr (filename, '/');
\r
155 - if (slash == NULL)
\r
158 - /* Jump back 4 characters to where the previous '/' will be if the
\r
159 - * directory is named "cur" or "new". */
\r
160 - if (slash - filename < 4)
\r
165 - if (*slash != '/')
\r
170 - if (STRNCMP_LITERAL (dir, "cur/") == 0 ||
\r
171 - STRNCMP_LITERAL (dir, "new/") == 0)
\r
179 /* From the set of tags on 'message' and the flag2tag table, compute a
\r
180 * set of maildir-flag actions to be taken, (flags that should be
\r
181 * either set or cleared).
\r