--- /dev/null
+Return-Path: <jani@nikula.org>\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 61B72431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 10:14:34 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+ tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 ZqzrwqcPbOGl for <notmuch@notmuchmail.org>;\r
+ Fri, 26 Oct 2012 10:14:33 -0700 (PDT)\r
+Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com\r
+ [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id F35FC431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 10:14:32 -0700 (PDT)\r
+Received: by mail-ob0-f181.google.com with SMTP id un3so3081399obb.26\r
+ for <notmuch@notmuchmail.org>; Fri, 26 Oct 2012 10:14:31 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
+ :cc:content-type:x-gm-message-state;\r
+ bh=VP7UzhUSvG9AYMn9UO4VwqLWX8Fm/t/v0hElru5OhM8=;\r
+ b=a/wOg+d3jHke03w4CqVgBHvz8K6aizQ7ZHosGwGxEW0Ff9DOFbgvc0ax9oTOnR2YIu\r
+ yMEKwdtxJWe1S8AxxRCw52YLSZPI7gLIznydSRthh2rtyVD9AuJu1s2e/Ny3lZgxlMqh\r
+ vs4kJ7bZcgm2axyc407oloIusR6/AGDU/c2+EblZLeOJJN+3IBHum1+gS013sf4G6D+l\r
+ cLSX3dNlsQGt130VP6xY3U+Ajdp7DZnZ2xXBKzQYpJ1ZDvLDWNwVs6UE0UwCmqzutlEV\r
+ yLPpoM5Zg+vLAQe9TqQviqo0++L17OQoFKuEiWkkP9HQxzNxXbuC84e4x+hWwQRFY8Tg\r
+ HWlA==\r
+MIME-Version: 1.0\r
+Received: by 10.182.31.50 with SMTP id x18mr18624613obh.56.1351271671492; Fri,\r
+ 26 Oct 2012 10:14:31 -0700 (PDT)\r
+Received: by 10.76.69.138 with HTTP; Fri, 26 Oct 2012 10:14:31 -0700 (PDT)\r
+Received: by 10.76.69.138 with HTTP; Fri, 26 Oct 2012 10:14:31 -0700 (PDT)\r
+In-Reply-To: <1351208039-32293-2-git-send-email-taesoo@mit.edu>\r
+References: <1351208039-32293-1-git-send-email-taesoo@mit.edu>\r
+ <1351208039-32293-2-git-send-email-taesoo@mit.edu>\r
+Date: Fri, 26 Oct 2012 20:14:31 +0300\r
+Message-ID:\r
+ <CAB+hUn8d9pOYHSw_r=7NJeFv-wGe-Bycom0d6TCod3R3DETAzg@mail.gmail.com>\r
+Subject: Re: [PATCH 1/2] Automatic tagging based on maildir\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Taesoo Kim <taesoo@mit.edu>\r
+Content-Type: multipart/alternative; boundary=14dae93b56d4f9726104ccf97331\r
+X-Gm-Message-State:\r
+ ALoCoQnH3kjb5Z1/tHGvBcpClbYFMXaziGQxpGRpiQ8uP/LiExwoJMoYoIQu1N20oaaQerc1jbOU\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Fri, 26 Oct 2012 17:14:34 -0000\r
+\r
+--14dae93b56d4f9726104ccf97331\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+On Oct 26, 2012 8:46 AM, "Taesoo Kim" <taesoo@mit.edu> wrote:\r
+>\r
+> Since gmail will provide labels as imap sub/folders, notmuch also can\r
+> take advantage of labels as tags, when maildir.add_as_tag_flags is\r
+> specified.\r
+\r
+Why not use the folder: prefix? What does your patch do that can't be\r
+achieved with that?\r
+\r
+BR,\r
+Jani.\r
+\r
+>\r
+> Signed-off-by: Taesoo Kim <taesoo@mit.edu>\r
+> ---\r
+> notmuch-client.h | 7 +++++++\r
+> notmuch-config.c | 42 ++++++++++++++++++++++++++++++++++++++----\r
+> notmuch-new.c | 32 ++++++++++++++++++++++++++++++++\r
+> 3 files changed, 77 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/notmuch-client.h b/notmuch-client.h\r
+> index ae9344b..ce05e52 100644\r
+> --- a/notmuch-client.h\r
+> +++ b/notmuch-client.h\r
+> @@ -265,6 +265,13 @@ void\r
+> notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,\r
+> notmuch_bool_t\r
+synchronize_flags);\r
+>\r
+> +notmuch_bool_t\r
+> +notmuch_config_get_maildir_add_as_tag_flags (notmuch_config_t *config);\r
+> +\r
+> +void\r
+> +notmuch_config_set_maildir_add_as_tag_flags (notmuch_config_t *config,\r
+> + notmuch_bool_t\r
+add_as_tag_flags);\r
+> +\r
+> const char **\r
+> notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t\r
+*length);\r
+>\r
+> diff --git a/notmuch-config.c b/notmuch-config.c\r
+> index 3e37a2d..c95f9dd 100644\r
+> --- a/notmuch-config.c\r
+> +++ b/notmuch-config.c\r
+> @@ -88,7 +88,16 @@ static const char maildir_config_comment[] =\r
+> "\n"\r
+> "\tThe \"notmuch new\" command will notice flag changes in\r
+filenames\n"\r
+> "\tand update tags, while the \"notmuch tag\" and \"notmuch\r
+restore\"\n"\r
+> - "\tcommands will notice tag changes and update flags in filenames\n";\r
+> + "\tcommands will notice tag changes and update flags in filenames\n"\r
+> + "\n"\r
+> + "\tadd_as_tag_flags Valid values are true and false.\n"\r
+> + "\n"\r
+> + "\nIf ture, then add the lower-cased name of maildirs"\r
+> + "\n(also deliminated by .) as tags"\r
+> + "\n"\r
+> + "\n\te.g. Life -> life"\r
+> + "\n\te.g. MIT.CSAIL -> mit, csail"\r
+> + "\n\te.g. Mailing.OSS.Linux -> mailing, oss, linux";\r
+>\r
+> static const char search_config_comment[] =\r
+> " Search configuration\n"\r
+> @@ -114,6 +123,7 @@ struct _notmuch_config {\r
+> const char **new_ignore;\r
+> size_t new_ignore_length;\r
+> notmuch_bool_t maildir_synchronize_flags;\r
+> + notmuch_bool_t maildir_add_as_tag_flags;\r
+> const char **search_exclude_tags;\r
+> size_t search_exclude_tags_length;\r
+> };\r
+> @@ -251,7 +261,7 @@ notmuch_config_open (void *ctx,\r
+> fprintf (stderr, "Out of memory.\n");\r
+> return NULL;\r
+> }\r
+> -\r
+> +\r
+> talloc_set_destructor (config, notmuch_config_destructor);\r
+>\r
+> if (filename) {\r
+> @@ -393,6 +403,14 @@ notmuch_config_open (void *ctx,\r
+> g_error_free (error);\r
+> }\r
+>\r
+> + config->maildir_add_as_tag_flags =\r
+> + g_key_file_get_boolean (config->key_file,\r
+> + "maildir", "add_as_tag_flags", &error);\r
+> + if (error) {\r
+> + notmuch_config_set_maildir_add_as_tag_flags (config, FALSE);\r
+> + g_error_free (error);\r
+> + }\r
+> +\r
+> /* Whenever we know of configuration sections that don't appear in\r
+> * the configuration file, we add some comments to help the user\r
+> * understand what can be done. */\r
+> @@ -438,7 +456,7 @@ notmuch_config_open (void *ctx,\r
+> }\r
+>\r
+> /* Close the given notmuch_config_t object, freeing all resources.\r
+> - *\r
+> + *\r
+> * Note: Any changes made to the configuration are *not* saved by this\r
+> * function. To save changes, call notmuch_config_save before\r
+> * notmuch_config_close.\r
+> @@ -720,7 +738,7 @@ notmuch_config_command_get (void *ctx, char *item)\r
+> } else if (strcmp(item, "user.other_email") == 0) {\r
+> const char **other_email;\r
+> size_t i, length;\r
+> -\r
+> +\r
+> other_email = notmuch_config_get_user_other_email (config,\r
+&length);\r
+> for (i = 0; i < length; i++)\r
+> printf ("%s\n", other_email[i]);\r
+> @@ -891,3 +909,19 @@ notmuch_config_set_maildir_synchronize_flags\r
+(notmuch_config_t *config,\r
+> "maildir", "synchronize_flags",\r
+synchronize_flags);\r
+> config->maildir_synchronize_flags = synchronize_flags;\r
+> }\r
+> +\r
+> +\r
+> +notmuch_bool_t\r
+> +notmuch_config_get_maildir_add_as_tag_flags (notmuch_config_t *config)\r
+> +{\r
+> + return config->maildir_add_as_tag_flags;\r
+> +}\r
+> +\r
+> +void\r
+> +notmuch_config_set_maildir_add_as_tag_flags (notmuch_config_t *config,\r
+> + notmuch_bool_t\r
+add_as_tag_flags)\r
+> +{\r
+> + g_key_file_set_boolean (config->key_file,\r
+> + "maildir", "add_as_tag_flags",\r
+add_as_tag_flags);\r
+> + config->maildir_add_as_tag_flags = add_as_tag_flags;\r
+> +}\r
+> diff --git a/notmuch-new.c b/notmuch-new.c\r
+> index 56c4a6f..9ec983f 100644\r
+> --- a/notmuch-new.c\r
+> +++ b/notmuch-new.c\r
+> @@ -20,6 +20,7 @@\r
+>\r
+> #include "notmuch-client.h"\r
+>\r
+> +#include <ctype.h>\r
+> #include <unistd.h>\r
+>\r
+> typedef struct _filename_node {\r
+> @@ -53,6 +54,7 @@ typedef struct {\r
+> _filename_list_t *directory_mtimes;\r
+>\r
+> notmuch_bool_t synchronize_flags;\r
+> + notmuch_bool_t add_as_tag_flags;\r
+> } add_files_state_t;\r
+>\r
+> static volatile sig_atomic_t do_print_progress = 0;\r
+> @@ -240,6 +242,32 @@ _entry_in_ignore_list (const char *entry,\r
+add_files_state_t *state)\r
+> return FALSE;\r
+> }\r
+>\r
+> +static void\r
+> +_add_maildir_as_tag(notmuch_database_t *notmuch,\r
+> + notmuch_message_t *msg, const char *path)\r
+> +{\r
+> + char *tok = talloc_strdup (notmuch, path);\r
+> + int len = strlen(tok);\r
+> +\r
+> + /* asserts path ends with /cur|/tmp|/new */\r
+> + if (len > 4 && tok[len - 4] == '/') {\r
+> + char *iter = tok + len - 4;\r
+> + *iter = '\0';\r
+> + while (-- iter && iter >= tok) {\r
+> + char c = *iter;\r
+> + if (c == '/' || c == '.') {\r
+> + *iter = '\0';\r
+> + notmuch_message_add_tag (msg, iter + 1);\r
+> + if (c == '/') {\r
+> + break;\r
+> + }\r
+> + }\r
+> + *iter = tolower(*iter);\r
+> + }\r
+> + }\r
+> + talloc_free (tok);\r
+> +}\r
+> +\r
+> /* Examine 'path' recursively as follows:\r
+> *\r
+> * o Ask the filesystem for the mtime of 'path' (fs_mtime)\r
+> @@ -508,6 +536,9 @@ add_files (notmuch_database_t *notmuch,\r
+> notmuch_message_freeze (message);\r
+> for (tag=state->new_tags; *tag != NULL; tag++)\r
+> notmuch_message_add_tag (message, *tag);\r
+> + if (state->add_as_tag_flags == TRUE) {\r
+> + _add_maildir_as_tag(notmuch, message, path);\r
+> + }\r
+> if (state->synchronize_flags == TRUE)\r
+> notmuch_message_maildir_flags_to_tags (message);\r
+> notmuch_message_thaw (message);\r
+> @@ -878,6 +909,7 @@ notmuch_new_command (void *ctx, int argc, char\r
+*argv[])\r
+> add_files_state.new_tags = notmuch_config_get_new_tags (config,\r
+&add_files_state.new_tags_length);\r
+> add_files_state.new_ignore = notmuch_config_get_new_ignore (config,\r
+&add_files_state.new_ignore_length);\r
+> add_files_state.synchronize_flags =\r
+notmuch_config_get_maildir_synchronize_flags (config);\r
+> + add_files_state.add_as_tag_flags =\r
+notmuch_config_get_maildir_add_as_tag_flags (config);\r
+> db_path = notmuch_config_get_database_path (config);\r
+>\r
+> if (run_hooks) {\r
+> --\r
+> 1.8.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--14dae93b56d4f9726104ccf97331\r
+Content-Type: text/html; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+<p><br>\r
+On Oct 26, 2012 8:46 AM, "Taesoo Kim" <<a href=3D"mailto:taeso=\r
+o@mit.edu">taesoo@mit.edu</a>> wrote:<br>\r
+><br>\r
+> Since gmail will provide labels as imap sub/folders, notmuch also can<=\r
+br>\r
+> take advantage of labels as tags, when maildir.add_as_tag_flags is<br>\r
+> specified.</p>\r
+<p>Why not use the folder: prefix? What does your patch do that can't b=\r
+e achieved with that?</p>\r
+<p>BR,<br>\r
+Jani.<br></p>\r
+<p>><br>\r
+> Signed-off-by: Taesoo Kim <<a href=3D"mailto:taesoo@mit.edu">taesoo=\r
+@mit.edu</a>><br>\r
+> ---<br>\r
+> =C2=A0notmuch-client.h | =C2=A07 +++++++<br>\r
+> =C2=A0notmuch-config.c | 42 ++++++++++++++++++++++++++++++++++++++----=\r
+<br>\r
+> =C2=A0notmuch-new.c =C2=A0 =C2=A0| 32 ++++++++++++++++++++++++++++++++=\r
+<br>\r
+> =C2=A03 files changed, 77 insertions(+), 4 deletions(-)<br>\r
+><br>\r
+> diff --git a/notmuch-client.h b/notmuch-client.h<br>\r
+> index ae9344b..ce05e52 100644<br>\r
+> --- a/notmuch-client.h<br>\r
+> +++ b/notmuch-client.h<br>\r
+> @@ -265,6 +265,13 @@ void<br>\r
+> =C2=A0notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *=\r
+config,<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 notmuch_bool_t synchronize_flags);<br>\r
+><br>\r
+> +notmuch_bool_t<br>\r
+> +notmuch_config_get_maildir_add_as_tag_flags (notmuch_config_t *config=\r
+);<br>\r
+> +<br>\r
+> +void<br>\r
+> +notmuch_config_set_maildir_add_as_tag_flags (notmuch_config_t *config=\r
+,<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0notmuch_bool_t add_as_tag_flags);<br>\r
+> +<br>\r
+> =C2=A0const char **<br>\r
+> =C2=A0notmuch_config_get_search_exclude_tags (notmuch_config_t *config=\r
+, size_t *length);<br>\r
+><br>\r
+> diff --git a/notmuch-config.c b/notmuch-config.c<br>\r
+> index 3e37a2d..c95f9dd 100644<br>\r
+> --- a/notmuch-config.c<br>\r
+> +++ b/notmuch-config.c<br>\r
+> @@ -88,7 +88,16 @@ static const char maildir_config_comment[] =3D<br>\r
+> =C2=A0 =C2=A0 =C2=A0"\n"<br>\r
+> =C2=A0 =C2=A0 =C2=A0"\tThe \"notmuch new\" command will=\r
+ notice flag changes in filenames\n"<br>\r
+> =C2=A0 =C2=A0 =C2=A0"\tand update tags, while the \"notmuch =\r
+tag\" and \"notmuch restore\"\n"<br>\r
+> - =C2=A0 =C2=A0"\tcommands will notice tag changes and update fla=\r
+gs in filenames\n";<br>\r
+> + =C2=A0 =C2=A0"\tcommands will notice tag changes and update fla=\r
+gs in filenames\n"<br>\r
+> + =C2=A0 =C2=A0"\n"<br>\r
+> + =C2=A0 =C2=A0"\tadd_as_tag_flags =C2=A0 =C2=A0 =C2=A0 Valid val=\r
+ues are true and false.\n"<br>\r
+> + =C2=A0 =C2=A0"\n"<br>\r
+> + =C2=A0 =C2=A0"\nIf ture, then add the lower-cased name of maild=\r
+irs"<br>\r
+> + =C2=A0 =C2=A0"\n(also deliminated by .) as tags"<br>\r
+> + =C2=A0 =C2=A0"\n"<br>\r
+> + =C2=A0 =C2=A0"\n\te.g. Life =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0-> life"<br>\r
+> + =C2=A0 =C2=A0"\n\te.g. MIT.CSAIL =C2=A0 =C2=A0 =C2=A0 =C2=A0 -&=\r
+gt; mit, csail"<br>\r
+> + =C2=A0 =C2=A0"\n\te.g. Mailing.OSS.Linux -> mailing, oss, li=\r
+nux";<br>\r
+><br>\r
+> =C2=A0static const char search_config_comment[] =3D<br>\r
+> =C2=A0 =C2=A0 =C2=A0" Search configuration\n"<br>\r
+> @@ -114,6 +123,7 @@ struct _notmuch_config {<br>\r
+> =C2=A0 =C2=A0 =C2=A0const char **new_ignore;<br>\r
+> =C2=A0 =C2=A0 =C2=A0size_t new_ignore_length;<br>\r
+> =C2=A0 =C2=A0 =C2=A0notmuch_bool_t maildir_synchronize_flags;<br>\r
+> + =C2=A0 =C2=A0notmuch_bool_t maildir_add_as_tag_flags;<br>\r
+> =C2=A0 =C2=A0 =C2=A0const char **search_exclude_tags;<br>\r
+> =C2=A0 =C2=A0 =C2=A0size_t search_exclude_tags_length;<br>\r
+> =C2=A0};<br>\r
+> @@ -251,7 +261,7 @@ notmuch_config_open (void *ctx,<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 fprintf (stderr, "Out of memory.\n&qu=\r
+ot;);<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;<br>\r
+> =C2=A0 =C2=A0 =C2=A0}<br>\r
+> -<br>\r
+> +<br>\r
+> =C2=A0 =C2=A0 =C2=A0talloc_set_destructor (config, notmuch_config_dest=\r
+ructor);<br>\r
+><br>\r
+> =C2=A0 =C2=A0 =C2=A0if (filename) {<br>\r
+> @@ -393,6 +403,14 @@ notmuch_config_open (void *ctx,<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 g_error_free (error);<br>\r
+> =C2=A0 =C2=A0 =C2=A0}<br>\r
+><br>\r
+> + =C2=A0 =C2=A0config->maildir_add_as_tag_flags =3D<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 g_key_file_get_boolean (config->key_file,<br=\r
+>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "maildir", "add_as_ta=\r
+g_flags", &error);<br>\r
+> + =C2=A0 =C2=A0if (error) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 notmuch_config_set_maildir_add_as_tag_flags (co=\r
+nfig, FALSE);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 g_error_free (error);<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> +<br>\r
+> =C2=A0 =C2=A0 =C2=A0/* Whenever we know of configuration sections that=\r
+ don't appear in<br>\r
+> =C2=A0 =C2=A0 =C2=A0 * the configuration file, we add some comments to=\r
+ help the user<br>\r
+> =C2=A0 =C2=A0 =C2=A0 * understand what can be done. */<br>\r
+> @@ -438,7 +456,7 @@ notmuch_config_open (void *ctx,<br>\r
+> =C2=A0}<br>\r
+><br>\r
+> =C2=A0/* Close the given notmuch_config_t object, freeing all resource=\r
+s.<br>\r
+> - *<br>\r
+> + *<br>\r
+> =C2=A0 * Note: Any changes made to the configuration are *not* saved b=\r
+y this<br>\r
+> =C2=A0 * function. To save changes, call notmuch_config_save before<br=\r
+>\r
+> =C2=A0 * notmuch_config_close.<br>\r
+> @@ -720,7 +738,7 @@ notmuch_config_command_get (void *ctx, char *item)=\r
+<br>\r
+> =C2=A0 =C2=A0 =C2=A0} else if (strcmp(item, "user.other_email&quo=\r
+t;) =3D=3D 0) {<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 const char **other_email;<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t i, length;<br>\r
+> -<br>\r
+> +<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 other_email =3D notmuch_config_get_user_ot=\r
+her_email (config, &length);<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (i =3D 0; i < length; i++)<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf ("%s\n", ot=\r
+her_email[i]);<br>\r
+> @@ -891,3 +909,19 @@ notmuch_config_set_maildir_synchronize_flags (not=\r
+much_config_t *config,<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 "maildir", "synchronize_flags&qu=\r
+ot;, synchronize_flags);<br>\r
+> =C2=A0 =C2=A0 =C2=A0config->maildir_synchronize_flags =3D synchroni=\r
+ze_flags;<br>\r
+> =C2=A0}<br>\r
+> +<br>\r
+> +<br>\r
+> +notmuch_bool_t<br>\r
+> +notmuch_config_get_maildir_add_as_tag_flags (notmuch_config_t *config=\r
+)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0return config->maildir_add_as_tag_flags;<br>\r
+> +}<br>\r
+> +<br>\r
+> +void<br>\r
+> +notmuch_config_set_maildir_add_as_tag_flags (notmuch_config_t *config=\r
+,<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0notmuch_bool_t add_as_tag_flags)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0g_key_file_set_boolean (config->key_file,<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 "maildir", "add_as_tag_flags",=\r
+ add_as_tag_flags);<br>\r
+> + =C2=A0 =C2=A0config->maildir_add_as_tag_flags =3D add_as_tag_flag=\r
+s;<br>\r
+> +}<br>\r
+> diff --git a/notmuch-new.c b/notmuch-new.c<br>\r
+> index 56c4a6f..9ec983f 100644<br>\r
+> --- a/notmuch-new.c<br>\r
+> +++ b/notmuch-new.c<br>\r
+> @@ -20,6 +20,7 @@<br>\r
+><br>\r
+> =C2=A0#include "notmuch-client.h"<br>\r
+><br>\r
+> +#include <ctype.h><br>\r
+> =C2=A0#include <unistd.h><br>\r
+><br>\r
+> =C2=A0typedef struct _filename_node {<br>\r
+> @@ -53,6 +54,7 @@ typedef struct {<br>\r
+> =C2=A0 =C2=A0 =C2=A0_filename_list_t *directory_mtimes;<br>\r
+><br>\r
+> =C2=A0 =C2=A0 =C2=A0notmuch_bool_t synchronize_flags;<br>\r
+> + =C2=A0 =C2=A0notmuch_bool_t add_as_tag_flags;<br>\r
+> =C2=A0} add_files_state_t;<br>\r
+><br>\r
+> =C2=A0static volatile sig_atomic_t do_print_progress =3D 0;<br>\r
+> @@ -240,6 +242,32 @@ _entry_in_ignore_list (const char *entry, add_fil=\r
+es_state_t *state)<br>\r
+> =C2=A0 =C2=A0 =C2=A0return FALSE;<br>\r
+> =C2=A0}<br>\r
+><br>\r
+> +static void<br>\r
+> +_add_maildir_as_tag(notmuch_database_t *notmuch,<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmu=\r
+ch_message_t *msg, const char *path)<br>\r
+> +{<br>\r
+> + =C2=A0 =C2=A0char *tok =3D talloc_strdup (notmuch, path);<br>\r
+> + =C2=A0 =C2=A0int len =3D strlen(tok);<br>\r
+> +<br>\r
+> + =C2=A0 =C2=A0/* asserts path ends with /cur|/tmp|/new */<br>\r
+> + =C2=A0 =C2=A0if (len > 4 && tok[len - 4] =3D=3D '/=\r
+9;) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 char *iter =3D tok + len - 4;<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 *iter =3D '\0';<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 while (-- iter && iter >=3D tok) {<b=\r
+r>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 char c =3D *iter;<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (c =3D=3D '/' || c =3D=\r
+=3D '.') {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *iter =3D '\0&#=\r
+39;;<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_message_add=\r
+_tag (msg, iter + 1);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (c =3D=3D '/=\r
+') {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break=\r
+;<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *iter =3D tolower(*iter);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 }<br>\r
+> + =C2=A0 =C2=A0}<br>\r
+> + =C2=A0 =C2=A0talloc_free (tok);<br>\r
+> +}<br>\r
+> +<br>\r
+> =C2=A0/* Examine 'path' recursively as follows:<br>\r
+> =C2=A0 *<br>\r
+> =C2=A0 * =C2=A0 o Ask the filesystem for the mtime of 'path' (=\r
+fs_mtime)<br>\r
+> @@ -508,6 +536,9 @@ add_files (notmuch_database_t *notmuch,<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_message_freeze (mess=\r
+age);<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (tag=3Dstate->new_tag=\r
+s; *tag !=3D NULL; tag++)<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_messag=\r
+e_add_tag (message, *tag);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (state->add_as_tag_flags =\r
+=3D=3D TRUE) {<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _add_maildir_as_tag=\r
+(notmuch, message, path);<br>\r
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (state->synchronize_fl=\r
+ags =3D=3D TRUE)<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_messag=\r
+e_maildir_flags_to_tags (message);<br>\r
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_message_thaw (messag=\r
+e);<br>\r
+> @@ -878,6 +909,7 @@ notmuch_new_command (void *ctx, int argc, char *ar=\r
+gv[])<br>\r
+> =C2=A0 =C2=A0 =C2=A0add_files_state.new_tags =3D notmuch_config_get_ne=\r
+w_tags (config, &add_files_state.new_tags_length);<br>\r
+> =C2=A0 =C2=A0 =C2=A0add_files_state.new_ignore =3D notmuch_config_get_=\r
+new_ignore (config, &add_files_state.new_ignore_length);<br>\r
+> =C2=A0 =C2=A0 =C2=A0add_files_state.synchronize_flags =3D notmuch_conf=\r
+ig_get_maildir_synchronize_flags (config);<br>\r
+> + =C2=A0 =C2=A0add_files_state.add_as_tag_flags =3D notmuch_config_get=\r
+_maildir_add_as_tag_flags (config);<br>\r
+> =C2=A0 =C2=A0 =C2=A0db_path =3D notmuch_config_get_database_path (conf=\r
+ig);<br>\r
+><br>\r
+> =C2=A0 =C2=A0 =C2=A0if (run_hooks) {<br>\r
+> --<br>\r
+> 1.8.0<br>\r
+><br>\r
+> _______________________________________________<br>\r
+> notmuch mailing list<br>\r
+> <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a>=\r
+<br>\r
+> <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http://not=\r
+muchmail.org/mailman/listinfo/notmuch</a><br>\r
+</p>\r
+\r
+--14dae93b56d4f9726104ccf97331--\r