Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 97 / 3b8c9e065a2eaf8f64732ce7b53dd48cf892d4
1 Return-Path: <aneesh.kumar@linux.vnet.ibm.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 4F8FF431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 07:55:35 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id N50h8iyRuDGV for <notmuch@notmuchmail.org>;\r
11         Wed, 18 Nov 2009 07:55:34 -0800 (PST)\r
12 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146])\r
13         by olra.theworths.org (Postfix) with ESMTP id EEE52431FAE\r
14         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 07:55:33 -0800 (PST)\r
15 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
16         by e23smtp04.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAIFqMx7015553\r
17         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:52:22 +1100\r
18 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139])\r
19         by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
20         nAIFqDHn1667326\r
21         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:52:13 +1100\r
22 Received: from d23av04.au.ibm.com (loopback [127.0.0.1])\r
23         by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
24         nAIFtVNl024406\r
25         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:55:31 +1100\r
26 Received: from skywalker.linux.vnet.ibm.com ([9.77.125.7])\r
27         by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
28         nAIFtT4s024387\r
29         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:55:30 +1100\r
30 From: aneesh.kumar@linux.vnet.ibm.com (Aneesh Kumar K.V)\r
31 To: notmuch <notmuch@notmuchmail.org>\r
32 Date: Wed, 18 Nov 2009 21:25:28 +0530\r
33 Message-ID: <87fx8bygi7.fsf@linux.vnet.ibm.com>\r
34 MIME-Version: 1.0\r
35 Content-Type: text/plain; charset=us-ascii\r
36 Subject: [notmuch] [PATCH] notmuch: Add Maildir directory name as tag name\r
37         for messages\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.12\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Wed, 18 Nov 2009 15:55:35 -0000\r
51 \r
52 \r
53 >From 24711481dfe770417aa0a13308a9bb842dfb03f4 Mon Sep 17 00:00:00 2001\r
54 From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
55 Date: Wed, 18 Nov 2009 21:20:12 +0530\r
56 Subject: [PATCH] notmuch: Add Maildir directory name as tag name for messages\r
57 \r
58 This patch adds maildir directory name as the tag name for\r
59 messages. This helps in adding tags using filtering already\r
60 provided by procmail.\r
61 \r
62 \r
63 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
64 ---\r
65  notmuch-new.c |   12 ++++++++++--\r
66  1 files changed, 10 insertions(+), 2 deletions(-)\r
67 \r
68 diff --git a/notmuch-new.c b/notmuch-new.c\r
69 index 5405a9f..50d0a5a 100644\r
70 --- a/notmuch-new.c\r
71 +++ b/notmuch-new.c\r
72 @@ -96,6 +96,7 @@ add_files_print_progress (add_files_state_t *state)\r
73  static notmuch_status_t\r
74  add_files_recursive (notmuch_database_t *notmuch,\r
75                      const char *path,\r
76 +                    const char *tag,\r
77                      struct stat *st,\r
78                      add_files_state_t *state)\r
79  {\r
80 @@ -186,6 +187,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
81                     case NOTMUCH_STATUS_SUCCESS:\r
82                         state->added_messages++;\r
83                         tag_inbox_and_unread (message);\r
84 +                       notmuch_message_add_tag (message, tag);\r
85                         break;\r
86                     /* Non-fatal issues (go on to next file) */\r
87                     case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
88 @@ -223,7 +225,13 @@ add_files_recursive (notmuch_database_t *notmuch,\r
89                 }\r
90             }\r
91         } else if (S_ISDIR (st->st_mode)) {\r
92 -           status = add_files_recursive (notmuch, next, st, state);\r
93 +               if ((strcmp (entry->d_name, "cur") == 0) ||\r
94 +                       (strcmp (entry->d_name, "new") == 0) ||\r
95 +                       (strcmp (entry->d_name, "tmp") == 0)) {\r
96 +                       status = add_files_recursive (notmuch, next, tag, st, state);\r
97 +               } else {\r
98 +                       status = add_files_recursive (notmuch, next, entry->d_name, st, state);\r
99 +               }\r
100             if (status && ret == NOTMUCH_STATUS_SUCCESS)\r
101                 ret = status;\r
102         }\r
103 @@ -285,7 +293,7 @@ add_files (notmuch_database_t *notmuch,\r
104      timerval.it_value.tv_usec = 0;\r
105      setitimer (ITIMER_REAL, &timerval, NULL);\r
106  \r
107 -    status = add_files_recursive (notmuch, path, &st, state);\r
108 +    status = add_files_recursive (notmuch, path, basename(path), &st, state);\r
109  \r
110      /* Now stop the timer. */\r
111      timerval.it_interval.tv_sec = 0;\r
112 -- \r
113 1.6.5.2.74.g610f9\r
114 \r