[RFC PATCH 2/3] cli: add reply.honor_followup_to configuration option
authorJani Nikula <jani@nikula.org>
Sat, 2 Mar 2013 19:55:20 +0000 (21:55 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:50 +0000 (09:53 -0800)
0f/c488d4f67ce6d03f63e03ca8eb15dcf1f94859 [new file with mode: 0644]

diff --git a/0f/c488d4f67ce6d03f63e03ca8eb15dcf1f94859 b/0f/c488d4f67ce6d03f63e03ca8eb15dcf1f94859
new file mode 100644 (file)
index 0000000..cc0d22f
--- /dev/null
@@ -0,0 +1,205 @@
+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 7D04A431FC2\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 11:55:29 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 djKpzwWP7RpI for <notmuch@notmuchmail.org>;\r
+       Sat,  2 Mar 2013 11:55:27 -0800 (PST)\r
+Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com\r
+       [209.85.217.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 782AE431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 11:55:27 -0800 (PST)\r
+Received: by mail-lb0-f182.google.com with SMTP id gg6so3075672lbb.13\r
+       for <notmuch@notmuchmail.org>; Sat, 02 Mar 2013 11:55:25 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references:in-reply-to:references:x-gm-message-state;\r
+       bh=UUERYx8WznyJ8eXUoRBpqPs2Ohoav9Is5Uu2bCccoOc=;\r
+       b=YxsxwoS7wC9ujwqBaXWH1ErVRO0RDYarghuzMfZ/GEewNJmyluEro9U3u8dPWNvHvM\r
+       etbY0DtDNy5v3KcQJNYADRAllJUsHpUyL5Mxp9ttL5DUiBt9lZMkJ/Kcs7uKGzXZbo2g\r
+       R7V+h9zy5iHlqVldwO+zfFWM0Vq395d38ZnosdLa4Ly1z4s7zNnJ8zH0zB1qyRyF1jwR\r
+       dVepdO4pkaE+CWOPP1WW35Jz/OgPnfEE48M1uKAt7FnfWmDOBMhaCz6ghQq6OHiEBwHn\r
+       fWjJ6w1Bf56TggO4ovGGGe2s+WJzZNaLocGs3ZFbBPQuYFmqR2K9jS8ZB9tiegQHPwmf\r
+       SIEw==\r
+X-Received: by 10.112.30.104 with SMTP id r8mr2443118lbh.82.1362254125806;\r
+       Sat, 02 Mar 2013 11:55:25 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id l1sm5515632lbn.8.2013.03.02.11.55.24\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 02 Mar 2013 11:55:25 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 2/3] cli: add reply.honor_followup_to configuration option\r
+Date: Sat,  2 Mar 2013 21:55:20 +0200\r
+Message-Id:\r
+ <7d854894e5406778693f33358c67e86b98cb61c2.1362254104.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+References:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+In-Reply-To:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+References:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlmUT6OCxFUmqOjRWhdqk/0OE7q3QxMEdar4gIITmkP7R16ffVid5m/XEIOARW3NtwDiCdz\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: Sat, 02 Mar 2013 19:55:30 -0000\r
+\r
+The reply.honor_followup_to configuration option determines whether\r
+notmuch reply takes into account the Mail-Followup-To: header in\r
+incoming messages.\r
+---\r
+ notmuch-client.h |    7 +++++++\r
+ notmuch-config.c |   43 +++++++++++++++++++++++++++++++++++++++++++\r
+ 2 files changed, 50 insertions(+)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 5f28836..54df811 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -304,6 +304,13 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,\r
+                              size_t length);\r
\r
+ notmuch_bool_t\r
++notmuch_config_get_reply_honor_followup_to (notmuch_config_t *config);\r
++\r
++void\r
++notmuch_config_set_reply_honor_followup_to (notmuch_config_t *config,\r
++                                          notmuch_bool_t honor_followup_to);\r
++\r
++notmuch_bool_t\r
+ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);\r
\r
+ void\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index 45b4c0e..69c4bee 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -53,6 +53,17 @@ static const char new_config_comment[] =\r
+     "\t       names will be ignored, independent of its depth/location\n"\r
+     "\t       in the mail store.\n";\r
\r
++static const char reply_config_comment[] =\r
++    " Configuration for \"notmuch reply\"\n"\r
++    "\n"\r
++    " The following option is supported here:\n"\r
++    "\n"\r
++    "\thonor_followup_to      Valid values are true and false.\n"\r
++    "\n"\r
++    "\tIf true, \"notmuch reply\" will honor the \"Mail-Followup-To:\""\r
++    "\theader in incoming messages. (This will not generate the headers"\r
++    "\tto outgoing messages.)\n";\r
++\r
+ static const char user_config_comment[] =\r
+     " User configuration\n"\r
+     "\n"\r
+@@ -114,6 +125,7 @@ struct _notmuch_config {\r
+     size_t new_tags_length;\r
+     const char **new_ignore;\r
+     size_t new_ignore_length;\r
++    notmuch_bool_t reply_honor_followup_to;\r
+     notmuch_bool_t maildir_synchronize_flags;\r
+     const char **search_exclude_tags;\r
+     size_t search_exclude_tags_length;\r
+@@ -240,6 +252,7 @@ notmuch_config_open (void *ctx,\r
+     char *notmuch_config_env = NULL;\r
+     int file_had_database_group;\r
+     int file_had_new_group;\r
++    int file_had_reply_group;\r
+     int file_had_user_group;\r
+     int file_had_maildir_group;\r
+     int file_had_search_group;\r
+@@ -275,6 +288,7 @@ notmuch_config_open (void *ctx,\r
+     config->new_tags_length = 0;\r
+     config->new_ignore = NULL;\r
+     config->new_ignore_length = 0;\r
++    config->reply_honor_followup_to = FALSE;\r
+     config->maildir_synchronize_flags = TRUE;\r
+     config->search_exclude_tags = NULL;\r
+     config->search_exclude_tags_length = 0;\r
+@@ -319,6 +333,7 @@ notmuch_config_open (void *ctx,\r
+     file_had_database_group = g_key_file_has_group (config->key_file,\r
+                                                   "database");\r
+     file_had_new_group = g_key_file_has_group (config->key_file, "new");\r
++    file_had_reply_group = g_key_file_has_group (config->key_file, "reply");\r
+     file_had_user_group = g_key_file_has_group (config->key_file, "user");\r
+     file_had_maildir_group = g_key_file_has_group (config->key_file, "maildir");\r
+     file_had_search_group = g_key_file_has_group (config->key_file, "search");\r
+@@ -386,6 +401,15 @@ notmuch_config_open (void *ctx,\r
+     }\r
\r
+     error = NULL;\r
++    config->reply_honor_followup_to =\r
++      g_key_file_get_boolean (config->key_file,\r
++                              "reply", "honor_followup_to", &error);\r
++    if (error) {\r
++      notmuch_config_set_reply_honor_followup_to (config, FALSE);\r
++      g_error_free (error);\r
++    }\r
++\r
++    error = NULL;\r
+     config->maildir_synchronize_flags =\r
+       g_key_file_get_boolean (config->key_file,\r
+                               "maildir", "synchronize_flags", &error);\r
+@@ -409,6 +433,10 @@ notmuch_config_open (void *ctx,\r
+       g_key_file_set_comment (config->key_file, "new", NULL,\r
+                               new_config_comment, NULL);\r
\r
++    if (! file_had_reply_group)\r
++      g_key_file_set_comment (config->key_file, "reply", NULL,\r
++                              reply_config_comment, NULL);\r
++\r
+     if (! file_had_user_group)\r
+       g_key_file_set_comment (config->key_file, "user", NULL,\r
+                               user_config_comment, NULL);\r
+@@ -868,6 +896,21 @@ notmuch_config_command (void *ctx, int argc, char *argv[])\r
+ }\r
\r
+ notmuch_bool_t\r
++notmuch_config_get_reply_honor_followup_to (notmuch_config_t *config)\r
++{\r
++    return config->reply_honor_followup_to;\r
++}\r
++\r
++void\r
++notmuch_config_set_reply_honor_followup_to (notmuch_config_t *config,\r
++                                          notmuch_bool_t honor_followup_to)\r
++{\r
++    g_key_file_set_boolean (config->key_file,\r
++                          "reply", "honor_followup_to", honor_followup_to);\r
++    config->reply_honor_followup_to = honor_followup_to;\r
++}\r
++\r
++notmuch_bool_t\r
+ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)\r
+ {\r
+     return config->maildir_synchronize_flags;\r
+-- \r
+1.7.10.4\r
+\r