[WIP 2/3] cli/insert: move several file/directory manipulation routines into a new...
[notmuch-archives.git] / 08 / 4c135d7932d8c9e9c0be74aad34ff0e8b70b68
1 Return-Path: <amthrax@drake.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 1D83D429E3B\r
6         for <notmuch@notmuchmail.org>; Sat, 11 Jun 2011 13:06:54 -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 f4e4Exica7AP for <notmuch@notmuchmail.org>;\r
16         Sat, 11 Jun 2011 13:06:53 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id 6EA74429E26\r
20         for <notmuch@notmuchmail.org>; Sat, 11 Jun 2011 13:06:53 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7c65ae00000117c-a2-4df3cae43456\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id BB.71.04476.4EAC3FD4; Sat, 11 Jun 2011 16:07:00 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id p5BK6qrD013147; \r
27         Sat, 11 Jun 2011 16:06:52 -0400\r
28 Received: from drake.mit.edu\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 p5BK6pBU006021\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 11 Jun 2011 16:06:52 -0400 (EDT)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.76)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1QVUSJ-0000IF-NZ; Sat, 11 Jun 2011 16:06:51 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 09/17] lib: Indicate if there are more filenames after\r
41  removal.\r
42 Date: Sat, 11 Jun 2011 16:04:35 -0400\r
43 Message-Id: <1307822683-848-10-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.5.1\r
45 In-Reply-To: <1307822683-848-1-git-send-email-amdragon@mit.edu>\r
46 References: <87ei34rnc5.fsf@yoom.home.cworth.org>\r
47         <1307822683-848-1-git-send-email-amdragon@mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsUixCmqrfvk1Gdfg92rZC2u35zJ7MDo8WzV\r
50         LeYAxigum5TUnMyy1CJ9uwSujM7NX5kK9vJULFj0mrGBsYmri5GTQ0LARGLT0mksELaYxIV7\r
51         69m6GLk4hAT2MUq8fdLBBOFsYJSYdn4ClHOfSWL6um4oZz6jRHvzTiaQfjYBDYlt+5czgtgi\r
52         AtISO+/OZu1i5OBgFlCT+NOlAhIWFvCX+L3uPTOIzSKgKrF6+Q5WEJtXwF5iad8NJogzFCSu\r
53         XJkHdhInUHzewatgtpBAmsSSW7vZJzDyL2BkWMUom5JbpZubmJlTnJqsW5ycmJeXWqRrqJeb\r
54         WaKXmlK6iREcNpI8OxjfHFQ6xCjAwajEw6u49rOvEGtiWXFl7iFGSQ4mJVFenRNAIb6k/JTK\r
55         jMTijPii0pzU4kOMEhzMSiK869s/+QrxpiRWVqUW5cOkpDlYlMR5Z0iq+woJpCeWpGanphak\r
56         FsFkZTg4lCR4JYHxISRYlJqeWpGWmVOCkGbi4AQZzgM0/OhJoBre4oLE3OLMdIj8KUZdjscb\r
57         Nh1iFGLJy89LlRLnVQcZJABSlFGaBzcHFu+vGMWB3hLm/QEyigeYKuAmvQJawgS0RKAUbElJ\r
58         IkJKqoEx9KiUrFJj60rBPos05j7elcme58qrbEMdNedt0dbb/W1y6KXzh4Ml1zSvWKcTcKH7\r
59         t3JKp5vvotyThamlbuvfC8yZNe92ceu8a9uzMmZ7e/062/JI6foJvo/T/zx7KG9zRsHJN0pS\r
60         9+2/35sWPt090eTmsqhFD55ds70mYniDy33q63lJta4vlFiKMxINtZiLihMBpl8IqtICAAA=\r
61 Cc: Austin Clements <amdragon@mit.edu>\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.13\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66         <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Sat, 11 Jun 2011 20:06:54 -0000\r
75 \r
76 Make _notmuch_message_remove_filename return\r
77 NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames\r
78 and fix callers to handle this.\r
79 ---\r
80  lib/message.cc |    9 ++++++++-\r
81  1 files changed, 8 insertions(+), 1 deletions(-)\r
82 \r
83 diff --git a/lib/message.cc b/lib/message.cc\r
84 index afb1d80..5120b3a 100644\r
85 --- a/lib/message.cc\r
86 +++ b/lib/message.cc\r
87 @@ -501,6 +501,9 @@ _notmuch_message_add_filename (notmuch_message_t *message,\r
88   * This change will not be reflected in the database until the next\r
89   * call to _notmuch_message_sync.\r
90   *\r
91 + * If this message still has other filenames, returns\r
92 + * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID.\r
93 + *\r
94   * Note: This function does not remove a document from the database,\r
95   * even if the specified filename is the only filename for this\r
96   * message. For that functionality, see\r
97 @@ -565,6 +568,9 @@ _notmuch_message_remove_filename (notmuch_message_t *message,\r
98         if (strncmp ((*i).c_str (), direntry_prefix, direntry_prefix_len))\r
99             break;\r
100  \r
101 +       /* Indicate that there are filenames remaining. */\r
102 +       status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;\r
103 +\r
104         direntry = (*i).c_str ();\r
105         direntry += direntry_prefix_len;\r
106  \r
107 @@ -1257,7 +1263,8 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message)\r
108             new_status = _notmuch_message_remove_filename (message,\r
109                                                            filename);\r
110             /* Hold on to only the first error. */\r
111 -           if (! status && new_status) {\r
112 +           if (! status && new_status\r
113 +               && new_status != NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {\r
114                 status = new_status;\r
115                 continue;\r
116             }\r
117 -- \r
118 1.7.5.1\r
119 \r