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