[Patch v5 6/8] lib: add private function to extract the database for a message.
[notmuch-archives.git] / 8b / a7a870fbff020cd8812167d603d8ddf445794f
1 Return-Path: <bremner@tethera.net>\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 BFB54431FC0\r
6         for <notmuch@notmuchmail.org>; Wed, 14 Nov 2012 17:33:43 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 OV2uaaXOdSAC for <notmuch@notmuchmail.org>;\r
16         Wed, 14 Nov 2012 17:33:41 -0800 (PST)\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
18         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id C1695431FD8\r
21         for <notmuch@notmuchmail.org>; Wed, 14 Nov 2012 17:33:41 -0800 (PST)\r
22 Received: from fctnnbsc30w-156034089108.dhcp-dynamic.fibreop.nb.bellaliant.net\r
23         ([156.34.89.108] helo=zancas.localnet)\r
24         by tesseract.cs.unb.ca with esmtpsa\r
25         (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
26         (envelope-from <bremner@tethera.net>)\r
27         id 1TYoKr-0007Yb-10; Wed, 14 Nov 2012 21:33:41 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1TYoKl-0000U9-G8; Wed, 14 Nov 2012 21:33:35 -0400\r
31 From: david@tethera.net\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH 2/3] notmuch-restore: tidy formatting\r
34 Date: Wed, 14 Nov 2012 21:33:21 -0400\r
35 Message-Id: <1352943202-1431-3-git-send-email-david@tethera.net>\r
36 X-Mailer: git-send-email 1.7.10.4\r
37 In-Reply-To: <1352943202-1431-1-git-send-email-david@tethera.net>\r
38 References: <1352943202-1431-1-git-send-email-david@tethera.net>\r
39 X-Spam_bar: -\r
40 Cc: David Bremner <bremner@debian.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Thu, 15 Nov 2012 01:33:44 -0000\r
54 \r
55 From: David Bremner <bremner@debian.org>\r
56 \r
57 This is again the work of uncrustify.\r
58 \r
59 I remember there is some controversy about "! foo" versus "!foo", but\r
60 in context I think "! foo" looks OK. Also, for functions "! foo\r
61 (blah)" seems better than "!foo (blah)".\r
62 ---\r
63  notmuch-restore.c |   15 +++++++--------\r
64  1 file changed, 7 insertions(+), 8 deletions(-)\r
65 \r
66 diff --git a/notmuch-restore.c b/notmuch-restore.c\r
67 index 7d8f44c..f03dcac 100644\r
68 --- a/notmuch-restore.c\r
69 +++ b/notmuch-restore.c\r
70 @@ -38,13 +38,13 @@ tag_message (notmuch_database_t *notmuch, const char *message_id,\r
71         fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n",\r
72                  message ? "" : "missing ", message_id);\r
73         if (status)\r
74 -           fprintf (stderr, "%s\n", notmuch_status_to_string(status));\r
75 +           fprintf (stderr, "%s\n", notmuch_status_to_string (status));\r
76         return 1;\r
77      }\r
78  \r
79      /* In order to detect missing messages, this check/optimization is\r
80       * intentionally done *after* first finding the message. */\r
81 -    if (!remove_all && (file_tags == NULL || *file_tags == '\0'))\r
82 +    if (! remove_all && (file_tags == NULL || *file_tags == '\0'))\r
83         goto DONE;\r
84  \r
85      db_tags_str = NULL;\r
86 @@ -88,7 +88,7 @@ tag_message (notmuch_database_t *notmuch, const char *message_id,\r
87      if (synchronize_flags)\r
88         notmuch_message_tags_to_maildir_flags (message);\r
89  \r
90 -DONE:\r
91 +  DONE:\r
92      if (message)\r
93         notmuch_message_destroy (message);\r
94  \r
95 @@ -145,7 +145,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
96  \r
97      if (opt_index < argc) {\r
98         fprintf (stderr,\r
99 -        "Unused positional parameter: %s\n",\r
100 +                "Unused positional parameter: %s\n",\r
101                  argv[opt_index]);\r
102         return 1;\r
103      }\r
104 @@ -157,7 +157,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
105      if ( xregcomp (&regex,\r
106                    "^([^ ]+) \\(([^)]*)\\)$",\r
107                    REG_EXTENDED) )\r
108 -       INTERNAL_ERROR("compile time constant regex failed.");\r
109 +       INTERNAL_ERROR ("compile time constant regex failed.");\r
110  \r
111      while ((line_len = getline (&line, &line_size, input)) != -1) {\r
112         regmatch_t match[3];\r
113 @@ -166,8 +166,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
114         chomp_newline (line);\r
115  \r
116         rerr = xregexec (&regex, line, 3, match, 0);\r
117 -       if (rerr == REG_NOMATCH)\r
118 -       {\r
119 +       if (rerr == REG_NOMATCH) {\r
120             fprintf (stderr, "Warning: Ignoring invalid input line: %s\n",\r
121                      line);\r
122             continue;\r
123 @@ -178,7 +177,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])\r
124         file_tags = xstrndup (line + match[2].rm_so,\r
125                               match[2].rm_eo - match[2].rm_so);\r
126  \r
127 -       tag_message (notmuch, message_id, file_tags, !accumulate,\r
128 +       tag_message (notmuch, message_id, file_tags, ! accumulate,\r
129                      synchronize_flags);\r
130  \r
131         free (message_id);\r
132 -- \r
133 1.7.10.4\r
134 \r