Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 6a / f9b394e6aca8a9ca201add727f1241b0948027
1 Return-Path: <novalazy@gmail.com>\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 BF6DC431FCB\r
6         for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:51:20 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, 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 3IRHTWOnGfM1 for <notmuch@notmuchmail.org>;\r
17         Sat, 19 Jan 2013 16:51:19 -0800 (PST)\r
18 Received: from mail-da0-f41.google.com (mail-da0-f41.google.com\r
19         [209.85.210.41]) (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 2164F431FD7\r
22         for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:51:13 -0800 (PST)\r
23 Received: by mail-da0-f41.google.com with SMTP id e20so2173786dak.0\r
24         for <notmuch@notmuchmail.org>; Sat, 19 Jan 2013 16:51:12 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
27         :references; bh=yYO3yXQ8teEYfIowhs5IPJMox5W3E3gv0TRKzrxCX70=;\r
28         b=kLWZfOfXhrxzPWs3R6sRigk7oIFwLI4KJeuM+Xs1Ub1hXDqTI3aGnmGRgaGJliZFiX\r
29         yoh/m7ShYpWyXHzZYGys/Mu/zaaT0s6hzywHsl52hByoNh4a9gZct9aHx6lKKDHVwSVW\r
30         yD79fGPy9edAW7rXC5JvGSiUBPrLii4+8xugCxfpC6I2RwH1Q/nTTCTtw/hQsYYnLXCj\r
31         8/cO5BF/0cXe8sOOUQvXMOiNwrjXtxd9i1BqnDfp8C3PR7F94CSkO1URoHHGQJNC6a3H\r
32         RcpJUGR3aVeoc97YKKyxg7B7mcqwqGmAL/FgQHwChvybidSmTV0U+G3ulRWCQEk8MTIy\r
33         tAmA==\r
34 X-Received: by 10.68.222.196 with SMTP id qo4mr18542791pbc.140.1358643072235; \r
35         Sat, 19 Jan 2013 16:51:12 -0800 (PST)\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.\r
37         [220.233.42.215])\r
38         by mx.google.com with ESMTPS id nm2sm5799967pbc.43.2013.01.19.16.51.10\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Sat, 19 Jan 2013 16:51:11 -0800 (PST)\r
41 From: Peter Wang <novalazy@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v3 08/20] tag-util: move out 'tag' command-line checks\r
44 Date: Sun, 20 Jan 2013 11:49:52 +1100\r
45 Message-Id: <1358643004-14522-9-git-send-email-novalazy@gmail.com>\r
46 X-Mailer: git-send-email 1.7.12.1\r
47 In-Reply-To: <1358643004-14522-1-git-send-email-novalazy@gmail.com>\r
48 References: <1358643004-14522-1-git-send-email-novalazy@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sun, 20 Jan 2013 00:51:21 -0000\r
62 \r
63 parse_tag_command_line checked for two error conditions which are\r
64 specific to the 'tag' command.  It can be reused for the notmuch\r
65 'insert' command if we move the checks out, into notmuch-tag.c.\r
66 ---\r
67  notmuch-tag.c | 10 ++++++++++\r
68  tag-util.c    | 10 ----------\r
69  2 files changed, 10 insertions(+), 10 deletions(-)\r
70 \r
71 diff --git a/notmuch-tag.c b/notmuch-tag.c\r
72 index d9daf8f..a901dad 100644\r
73 --- a/notmuch-tag.c\r
74 +++ b/notmuch-tag.c\r
75 @@ -234,6 +234,16 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
76         if (parse_tag_command_line (ctx, argc - opt_index, argv + opt_index,\r
77                                     &query_string, tag_ops))\r
78             return 1;\r
79 +\r
80 +       if (tag_op_list_size (tag_ops) == 0) {\r
81 +           fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");\r
82 +           return 1;\r
83 +       }\r
84 +\r
85 +       if (*query_string == '\0') {\r
86 +           fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");\r
87 +           return 1;\r
88 +       }\r
89      }\r
90  \r
91      config = notmuch_config_open (ctx, NULL, NULL);\r
92 diff --git a/tag-util.c b/tag-util.c\r
93 index 3f9da05..41f2c09 100644\r
94 --- a/tag-util.c\r
95 +++ b/tag-util.c\r
96 @@ -186,18 +186,8 @@ parse_tag_command_line (void *ctx, int argc, char **argv,\r
97         tag_op_list_append (tag_ops, argv[i] + 1, is_remove);\r
98      }\r
99  \r
100 -    if (tag_op_list_size (tag_ops) == 0) {\r
101 -       fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");\r
102 -       return TAG_PARSE_INVALID;\r
103 -    }\r
104 -\r
105      *query_str = query_string_from_args (ctx, argc - i, &argv[i]);\r
106  \r
107 -    if (*query_str == NULL || **query_str == '\0') {\r
108 -       fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");\r
109 -       return TAG_PARSE_INVALID;\r
110 -    }\r
111 -\r
112      return TAG_PARSE_SUCCESS;\r
113  }\r
114  \r
115 -- \r
116 1.7.12.1\r
117 \r