[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 3c / cd3152c73236b84e3ec13972d0a53a10906c40
1 Return-Path: <jani@nikula.org>\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 2AC4E431FDC\r
6         for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:55:05 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 4XMGJ5MzuX95 for <notmuch@notmuchmail.org>;\r
17         Mon, 22 Sep 2014 02:55:00 -0700 (PDT)\r
18 Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com\r
19         [209.85.212.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id A1318431FC0\r
22         for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:54:52 -0700 (PDT)\r
23 Received: by mail-wi0-f171.google.com with SMTP id ho1so2552447wib.16\r
24         for <notmuch@notmuchmail.org>; Mon, 22 Sep 2014 02:54:51 -0700 (PDT)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
28         :references:in-reply-to:references;\r
29         bh=fz9Hb+n6ma8fvn9E4RKit/ex3/v5mYWMnz/lwYDVULc=;\r
30         b=KLwX3OTt1hk+6hckGH86s33f+2NBUF7pCMcbqGNOzKK3tcvs2eHz0vczy6V9Pfc432\r
31         2Vty8n0FVz/4OGLZpLaFX0lIvqQ6j7sceT92qA1z0r1MkJW8z12XlOtowLejMooXDV/D\r
32         Gg45H9i0whsSJZ492XPp51PRBWiWj2oFjATjk/JAfNX4qxSKn7b8d9nLR6ca9y/Lg1pV\r
33         MBfpMwCTv8yT8QCWPZrQWavcb4pro7zW7zcDoA3QHB6oqnYdlXBS/U+Sw4Y+bM9ULByB\r
34         YkvYxohgQJOFRq8l7sQCuoQ5q04i0vyyl3FkWeyiSJ2NG2gAkcM8lNWtGWZiW9aCL0e4\r
35         UXYA==\r
36 X-Gm-Message-State:\r
37  ALoCoQktWBsZoP6/X4gstO10FzQEehfC43iL3m0Fgxf72Jxi0I2szN5wbNDNF5PUTkpDhXaxXk6w\r
38 X-Received: by 10.194.202.231 with SMTP id kl7mr1046611wjc.134.1411379691594; \r
39         Mon, 22 Sep 2014 02:54:51 -0700 (PDT)\r
40 Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
41         by mx.google.com with ESMTPSA id\r
42         ny6sm11466422wic.22.2014.09.22.02.54.50 for <multiple recipients>\r
43         (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
44         Mon, 22 Sep 2014 02:54:51 -0700 (PDT)\r
45 From: Jani Nikula <jani@nikula.org>\r
46 To: notmuch@notmuchmail.org\r
47 Subject: [PATCH 03/11] cli/insert: move add_file_to_database to a better place\r
48 Date: Mon, 22 Sep 2014 11:54:54 +0200\r
49 Message-Id:\r
50  <84d2fc033adbb5cbddb49a937b71ba1f74a701c0.1411379395.git.jani@nikula.org>\r
51 X-Mailer: git-send-email 1.7.2.5\r
52 In-Reply-To: <cover.1411379395.git.jani@nikula.org>\r
53 References: <cover.1411379395.git.jani@nikula.org>\r
54 In-Reply-To: <cover.1411379395.git.jani@nikula.org>\r
55 References: <cover.1411379395.git.jani@nikula.org>\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Mon, 22 Sep 2014 09:55:05 -0000\r
69 \r
70 Move add_file_to_database around to keep the filesystem related\r
71 functions grouped together, improving readability. No functional\r
72 changes.\r
73 ---\r
74  notmuch-insert.c |   92 +++++++++++++++++++++++++++---------------------------\r
75  1 files changed, 46 insertions(+), 46 deletions(-)\r
76 \r
77 diff --git a/notmuch-insert.c b/notmuch-insert.c\r
78 index 770275b..ccb091a 100644\r
79 --- a/notmuch-insert.c\r
80 +++ b/notmuch-insert.c\r
81 @@ -294,52 +294,6 @@ copy_stdin (int fdin, int fdout)\r
82      return (!interrupted && !empty);\r
83  }\r
84  \r
85 -/* Add the specified message file to the notmuch database, applying tags.\r
86 - * The file is renamed to encode notmuch tags as maildir flags. */\r
87 -static void\r
88 -add_file_to_database (notmuch_database_t *notmuch, const char *path,\r
89 -                     tag_op_list_t *tag_ops, notmuch_bool_t synchronize_flags)\r
90 -{\r
91 -    notmuch_message_t *message;\r
92 -    notmuch_status_t status;\r
93 -\r
94 -    status = notmuch_database_add_message (notmuch, path, &message);\r
95 -    switch (status) {\r
96 -    case NOTMUCH_STATUS_SUCCESS:\r
97 -    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
98 -       break;\r
99 -    default:\r
100 -    case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
101 -    case NOTMUCH_STATUS_READ_ONLY_DATABASE:\r
102 -    case NOTMUCH_STATUS_XAPIAN_EXCEPTION:\r
103 -    case NOTMUCH_STATUS_OUT_OF_MEMORY:\r
104 -    case NOTMUCH_STATUS_FILE_ERROR:\r
105 -    case NOTMUCH_STATUS_NULL_POINTER:\r
106 -    case NOTMUCH_STATUS_TAG_TOO_LONG:\r
107 -    case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:\r
108 -    case NOTMUCH_STATUS_UNBALANCED_ATOMIC:\r
109 -    case NOTMUCH_STATUS_LAST_STATUS:\r
110 -       fprintf (stderr, "Error: failed to add `%s' to notmuch database: %s\n",\r
111 -                path, notmuch_status_to_string (status));\r
112 -       return;\r
113 -    }\r
114 -\r
115 -    if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {\r
116 -       /* Don't change tags of an existing message. */\r
117 -       if (synchronize_flags) {\r
118 -           status = notmuch_message_tags_to_maildir_flags (message);\r
119 -           if (status != NOTMUCH_STATUS_SUCCESS)\r
120 -               fprintf (stderr, "Error: failed to sync tags to maildir flags\n");\r
121 -       }\r
122 -    } else {\r
123 -       tag_op_flag_t flags = synchronize_flags ? TAG_FLAG_MAILDIR_SYNC : 0;\r
124 -\r
125 -       tag_op_list_apply (message, tag_ops, flags);\r
126 -    }\r
127 -\r
128 -    notmuch_message_destroy (message);\r
129 -}\r
130 -\r
131  static notmuch_bool_t\r
132  write_message (void *ctx, int fdin, const char *dir, char **newpath)\r
133  {\r
134 @@ -389,6 +343,52 @@ write_message (void *ctx, int fdin, const char *dir, char **newpath)\r
135      return FALSE;\r
136  }\r
137  \r
138 +/* Add the specified message file to the notmuch database, applying tags.\r
139 + * The file is renamed to encode notmuch tags as maildir flags. */\r
140 +static void\r
141 +add_file_to_database (notmuch_database_t *notmuch, const char *path,\r
142 +                     tag_op_list_t *tag_ops, notmuch_bool_t synchronize_flags)\r
143 +{\r
144 +    notmuch_message_t *message;\r
145 +    notmuch_status_t status;\r
146 +\r
147 +    status = notmuch_database_add_message (notmuch, path, &message);\r
148 +    switch (status) {\r
149 +    case NOTMUCH_STATUS_SUCCESS:\r
150 +    case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
151 +       break;\r
152 +    default:\r
153 +    case NOTMUCH_STATUS_FILE_NOT_EMAIL:\r
154 +    case NOTMUCH_STATUS_READ_ONLY_DATABASE:\r
155 +    case NOTMUCH_STATUS_XAPIAN_EXCEPTION:\r
156 +    case NOTMUCH_STATUS_OUT_OF_MEMORY:\r
157 +    case NOTMUCH_STATUS_FILE_ERROR:\r
158 +    case NOTMUCH_STATUS_NULL_POINTER:\r
159 +    case NOTMUCH_STATUS_TAG_TOO_LONG:\r
160 +    case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:\r
161 +    case NOTMUCH_STATUS_UNBALANCED_ATOMIC:\r
162 +    case NOTMUCH_STATUS_LAST_STATUS:\r
163 +       fprintf (stderr, "Error: failed to add `%s' to notmuch database: %s\n",\r
164 +                path, notmuch_status_to_string (status));\r
165 +       return;\r
166 +    }\r
167 +\r
168 +    if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {\r
169 +       /* Don't change tags of an existing message. */\r
170 +       if (synchronize_flags) {\r
171 +           status = notmuch_message_tags_to_maildir_flags (message);\r
172 +           if (status != NOTMUCH_STATUS_SUCCESS)\r
173 +               fprintf (stderr, "Error: failed to sync tags to maildir flags\n");\r
174 +       }\r
175 +    } else {\r
176 +       tag_op_flag_t flags = synchronize_flags ? TAG_FLAG_MAILDIR_SYNC : 0;\r
177 +\r
178 +       tag_op_list_apply (message, tag_ops, flags);\r
179 +    }\r
180 +\r
181 +    notmuch_message_destroy (message);\r
182 +}\r
183 +\r
184  int\r
185  notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])\r
186  {\r
187 -- \r
188 1.7.2.5\r
189 \r