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 B87DA431FD5
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:39 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 bMwLy+6nkyOi for <notmuch@notmuchmail.org>;
\r
17 Wed, 25 Jul 2012 06:44:38 -0700 (PDT)
\r
18 Received: from mail-gg0-f181.google.com (mail-gg0-f181.google.com
\r
19 [209.85.161.181]) (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 45951431FD9
\r
22 for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:16 -0700 (PDT)
\r
23 Received: by ggnv5 with SMTP id v5so883639ggn.26
\r
24 for <notmuch@notmuchmail.org>; Wed, 25 Jul 2012 06:44:15 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=j0lUFfrSEJ14+yeNmyCQqFdbH/kU+cbewfgsOnHhcZs=;
\r
28 b=YHDPlfqWDAxHwoTfs+pniq6ljfrXYtlKsphCMyEE7K7wBCRSEMMndzrwaw2gzcPk6o
\r
29 BcRB2lv3FS54VYsPabzn9QTuMfNl7d2NfqovbnrzBOLYSFppI3CUQretJ9aQEOuPvjOu
\r
30 xrfhUMswYG85QHFXJOENmrkdR15vRn72lSDn3L8Wdn3PGlmvxLSVT5o4JVYORFYYhE+M
\r
31 wBCJre1ocgceyQVPwQhHzRk7AambAudcCjoAqKKqT8QVWpI84wgZzrDmoerz0xvHZfz2
\r
32 qMoxf0l+luYPOqX1aBVKYkzRoC0yyX2TQLAWs5SBdPczUke+J0VwyjG2ATLJDCbmyzSc
\r
34 Received: by 10.66.73.5 with SMTP id h5mr12788745pav.79.1343223855447;
\r
35 Wed, 25 Jul 2012 06:44:15 -0700 (PDT)
\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
38 by mx.google.com with ESMTPS id wi6sm14414420pbc.35.2012.07.25.06.44.12
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Wed, 25 Jul 2012 06:44:14 -0700 (PDT)
\r
41 From: Peter Wang <novalazy@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 11/18] insert: apply command-line tag operations
\r
44 Date: Wed, 25 Jul 2012 23:42:40 +1000
\r
45 Message-Id: <1343223767-9812-11-git-send-email-novalazy@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.4.4
\r
47 In-Reply-To: <1343223767-9812-1-git-send-email-novalazy@gmail.com>
\r
48 References: <1343223767-9812-1-git-send-email-novalazy@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\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: Wed, 25 Jul 2012 13:44:40 -0000
\r
63 Apply the +tag and -tag operations which were specified on the
\r
66 notmuch-insert.c | 18 ++++++++++++++----
\r
67 1 files changed, 14 insertions(+), 4 deletions(-)
\r
69 diff --git a/notmuch-insert.c b/notmuch-insert.c
\r
70 index 6db03e3..5fd79be 100644
\r
71 --- a/notmuch-insert.c
\r
72 +++ b/notmuch-insert.c
\r
73 @@ -151,7 +151,7 @@ copy_fd_data (int fdin, int fdout)
\r
75 static notmuch_bool_t
\r
76 save_database (notmuch_database_t *notmuch, const char *path,
\r
77 - const char **new_tags)
\r
78 + const char **new_tags, const tag_operation_t *tag_ops)
\r
80 notmuch_message_t *message;
\r
81 notmuch_status_t status;
\r
82 @@ -186,6 +186,14 @@ save_database (notmuch_database_t *notmuch, const char *path,
\r
83 notmuch_message_add_tag (message, new_tags[i]);
\r
86 + for (i = 0; tag_ops[i].tag; i++) {
\r
87 + if (tag_ops[i].remove) {
\r
88 + notmuch_message_remove_tag (message, tag_ops[i].tag);
\r
90 + notmuch_message_add_tag (message, tag_ops[i].tag);
\r
94 notmuch_message_thaw (message);
\r
96 notmuch_message_tags_to_maildir_flags (message);
\r
97 @@ -197,7 +205,8 @@ save_database (notmuch_database_t *notmuch, const char *path,
\r
99 static notmuch_bool_t
\r
100 insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
101 - const char *dir, const char **new_tags)
\r
102 + const char *dir, const char **new_tags,
\r
103 + const tag_operation_t *tag_ops)
\r
107 @@ -222,7 +231,7 @@ insert_message (void *ctx, notmuch_database_t *notmuch, int fdin,
\r
111 - ret = save_database (notmuch, newpath, new_tags);
\r
112 + ret = save_database (notmuch, newpath, new_tags, tag_ops);
\r
115 /* XXX maybe there should be an option to keep the file in maildir? */
\r
116 @@ -324,7 +333,8 @@ notmuch_insert_command (void *ctx, int argc, char *argv[])
\r
117 NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much))
\r
120 - ret = insert_message (ctx, notmuch, STDIN_FILENO, maildir, new_tags);
\r
121 + ret = insert_message (ctx, notmuch, STDIN_FILENO, maildir, new_tags,
\r
124 notmuch_database_destroy (notmuch);
\r