[notmuch] [PATCH] notmuch: Add Maildir directory name as tag name for messages
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Wed, 18 Nov 2009 15:55:28 +0000 (21:25 +0530)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:36 +0000 (09:35 -0800)
97/3b8c9e065a2eaf8f64732ce7b53dd48cf892d4 [new file with mode: 0644]

diff --git a/97/3b8c9e065a2eaf8f64732ce7b53dd48cf892d4 b/97/3b8c9e065a2eaf8f64732ce7b53dd48cf892d4
new file mode 100644 (file)
index 0000000..38b15dc
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <aneesh.kumar@linux.vnet.ibm.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4F8FF431FBC\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 07:55:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id N50h8iyRuDGV for <notmuch@notmuchmail.org>;\r
+       Wed, 18 Nov 2009 07:55:34 -0800 (PST)\r
+Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146])\r
+       by olra.theworths.org (Postfix) with ESMTP id EEE52431FAE\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 07:55:33 -0800 (PST)\r
+Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
+       by e23smtp04.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAIFqMx7015553\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:52:22 +1100\r
+Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139])\r
+       by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
+       nAIFqDHn1667326\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:52:13 +1100\r
+Received: from d23av04.au.ibm.com (loopback [127.0.0.1])\r
+       by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
+       nAIFtVNl024406\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:55:31 +1100\r
+Received: from skywalker.linux.vnet.ibm.com ([9.77.125.7])\r
+       by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
+       nAIFtT4s024387\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 02:55:30 +1100\r
+From: aneesh.kumar@linux.vnet.ibm.com (Aneesh Kumar K.V)\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Date: Wed, 18 Nov 2009 21:25:28 +0530\r
+Message-ID: <87fx8bygi7.fsf@linux.vnet.ibm.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Subject: [notmuch] [PATCH] notmuch: Add Maildir directory name as tag name\r
+       for messages\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 18 Nov 2009 15:55:35 -0000\r
+\r
+\r
+>From 24711481dfe770417aa0a13308a9bb842dfb03f4 Mon Sep 17 00:00:00 2001\r
+From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
+Date: Wed, 18 Nov 2009 21:20:12 +0530\r
+Subject: [PATCH] notmuch: Add Maildir directory name as tag name for messages\r
+\r
+This patch adds maildir directory name as the tag name for\r
+messages. This helps in adding tags using filtering already\r
+provided by procmail.\r
+\r
+\r
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
+---\r
+ notmuch-new.c |   12 ++++++++++--\r
+ 1 files changed, 10 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 5405a9f..50d0a5a 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -96,6 +96,7 @@ add_files_print_progress (add_files_state_t *state)\r
+ static notmuch_status_t\r
+ add_files_recursive (notmuch_database_t *notmuch,\r
+                    const char *path,\r
++                   const char *tag,\r
+                    struct stat *st,\r
+                    add_files_state_t *state)\r
+ {\r
+@@ -186,6 +187,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+                   case NOTMUCH_STATUS_SUCCESS:\r
+                       state->added_messages++;\r
+                       tag_inbox_and_unread (message);\r
++                      notmuch_message_add_tag (message, tag);\r
+                       break;\r
+                   /* Non-fatal issues (go on to next file) */\r
+                   case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:\r
+@@ -223,7 +225,13 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+               }\r
+           }\r
+       } else if (S_ISDIR (st->st_mode)) {\r
+-          status = add_files_recursive (notmuch, next, st, state);\r
++              if ((strcmp (entry->d_name, "cur") == 0) ||\r
++                      (strcmp (entry->d_name, "new") == 0) ||\r
++                      (strcmp (entry->d_name, "tmp") == 0)) {\r
++                      status = add_files_recursive (notmuch, next, tag, st, state);\r
++              } else {\r
++                      status = add_files_recursive (notmuch, next, entry->d_name, st, state);\r
++              }\r
+           if (status && ret == NOTMUCH_STATUS_SUCCESS)\r
+               ret = status;\r
+       }\r
+@@ -285,7 +293,7 @@ add_files (notmuch_database_t *notmuch,\r
+     timerval.it_value.tv_usec = 0;\r
+     setitimer (ITIMER_REAL, &timerval, NULL);\r
\r
+-    status = add_files_recursive (notmuch, path, &st, state);\r
++    status = add_files_recursive (notmuch, path, basename(path), &st, state);\r
\r
+     /* Now stop the timer. */\r
+     timerval.it_interval.tv_sec = 0;\r
+-- \r
+1.6.5.2.74.g610f9\r
+\r