From: Shea Levy Date: Tue, 9 Aug 2016 20:55:15 +0000 (+2000) Subject: [PATCH 1/4] Add user.other_name property to associate names with other_email. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e2adad6cc7da7c8f30e03fa2ec68b7e2460bb68c;p=notmuch-archives.git [PATCH 1/4] Add user.other_name property to associate names with other_email. --- diff --git a/3a/8f2b11efaa425ac397a712b612f87950a34ef2 b/3a/8f2b11efaa425ac397a712b612f87950a34ef2 new file mode 100644 index 000000000..d549ed968 --- /dev/null +++ b/3a/8f2b11efaa425ac397a712b612f87950a34ef2 @@ -0,0 +1,174 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 2A2F96DE0281 + for ; Tue, 9 Aug 2016 14:04:12 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.02 +X-Spam-Level: +X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id iBpt6P5qqAmg for ; + Tue, 9 Aug 2016 14:04:03 -0700 (PDT) +X-Greylist: delayed 445 seconds by postgrey-1.35 at arlo; + Tue, 09 Aug 2016 14:04:03 PDT +Received: from smtprelay.hostedemail.com (smtprelay0165.hostedemail.com + [216.40.44.165]) + by arlo.cworth.org (Postfix) with ESMTPS id 989306DE01C2 + for ; Tue, 9 Aug 2016 14:04:03 -0700 (PDT) +Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com + [10.5.19.251]) + by smtpgrave08.hostedemail.com (Postfix) with ESMTP id F160921172D + for ; Tue, 9 Aug 2016 20:56:40 +0000 (UTC) +Received: from filter.hostedemail.com (unknown [216.40.38.60]) + by smtprelay07.hostedemail.com (Postfix) with ESMTP id A1809C1F81 + for ; Tue, 9 Aug 2016 20:56:39 +0000 (UTC) +X-Session-Marker: 7368656140736865616C6576792E636F6D +X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, shea@shealevy.com, :, + RULES_HIT:41:355:379:541:960:973:988:989:1252:1260:1345:1359:1381:1437:1534:1543:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3354:3865:3866:3867:3870:3872:3873:3874:4321:4552:5007:6261:7903:9010:9163:10004:10044:10848:11026:11658:11914:12043:12291:12296:12438:12517:12519:12555:12683:14110:14181:14394:14721:21080:21433:30003:30022:30030:30051:30054, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, + DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0, + LFtime:1, LUA_SUMMARY:none +X-HE-Tag: toys92_1cd2613433624 +X-Filterd-Recvd-Size: 4524 +Received: from shlevy-laptop.local.tld (unknown [184.209.6.164]) + (Authenticated sender: shea@shealevy.com) + by omf08.hostedemail.com (Postfix) with ESMTPA + for ; Tue, 9 Aug 2016 20:56:37 +0000 (UTC) +From: Shea Levy +To: notmuch@notmuchmail.org +Subject: [PATCH 1/4] Add user.other_name property to associate names with + other_email. +Date: Tue, 9 Aug 2016 16:55:15 -0400 +Message-Id: <1470776118-5070-2-git-send-email-shea@shealevy.com> +X-Mailer: git-send-email 2.7.4 +In-Reply-To: <1470776118-5070-1-git-send-email-shea@shealevy.com> +References: <1470776118-5070-1-git-send-email-shea@shealevy.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Tue, 09 Aug 2016 21:04:12 -0000 + +Entries are paired with the email address at the same index in +other_email. To use user.name for a given other_email, leave that +entry blank or leave user.other_name shorter than the relevant index +altogether. +--- + notmuch-client.h | 9 +++++++++ + notmuch-config.c | 32 ++++++++++++++++++++++++++++++++ + 2 files changed, 41 insertions(+) + +diff --git a/notmuch-client.h b/notmuch-client.h +index ebc092b..69c83a2 100644 +--- a/notmuch-client.h ++++ b/notmuch-client.h +@@ -304,6 +304,15 @@ notmuch_config_set_user_other_email (notmuch_config_t *config, + size_t length); + + const char ** ++notmuch_config_get_user_other_name (notmuch_config_t *config, ++ size_t *length); ++ ++void ++notmuch_config_set_user_other_name (notmuch_config_t *config, ++ const char *other_name[], ++ size_t length); ++ ++const char ** + notmuch_config_get_new_tags (notmuch_config_t *config, + size_t *length); + void +diff --git a/notmuch-config.c b/notmuch-config.c +index e5d42a0..4ac16b7 100644 +--- a/notmuch-config.c ++++ b/notmuch-config.c +@@ -63,6 +63,8 @@ static const char user_config_comment[] = + "\tprimary_email Your primary email address.\n" + "\tother_email A list (separated by ';') of other email addresses\n" + "\t at which you receive email.\n" ++ "\tother_name A list (separated by ';') of names corresponding to\n" ++ "\t other_email addresses. Leave an entry blank to use default\n" + "\n" + " Notmuch will use the various email addresses configured here when\n" + " formatting replies. It will avoid including your own addresses in the\n" +@@ -120,6 +122,8 @@ struct _notmuch_config { + char *user_primary_email; + const char **user_other_email; + size_t user_other_email_length; ++ const char **user_other_name; ++ size_t user_other_name_length; + const char **new_tags; + size_t new_tags_length; + const char **new_ignore; +@@ -237,6 +241,8 @@ get_username_from_passwd_file (void *ctx) + * + * user_other_email: Not set. + * ++ * user_other_name: Not set. ++ * + * The default configuration also contains comments to guide the + * user in editing the file directly. + */ +@@ -280,6 +286,8 @@ notmuch_config_open (void *ctx, + config->user_primary_email = NULL; + config->user_other_email = NULL; + config->user_other_email_length = 0; ++ config->user_other_name = NULL; ++ config->user_other_name_length = 0; + config->new_tags = NULL; + config->new_tags_length = 0; + config->new_ignore = NULL; +@@ -674,6 +682,23 @@ notmuch_config_set_user_other_email (notmuch_config_t *config, + &(config->user_other_email)); + } + ++const char ** ++notmuch_config_get_user_other_name (notmuch_config_t *config, size_t *length) ++{ ++ return _config_get_list (config, "user", "other_name", ++ &(config->user_other_name), ++ &(config->user_other_name_length), length); ++} ++ ++void ++notmuch_config_set_user_other_name (notmuch_config_t *config, ++ const char *list[], ++ size_t length) ++{ ++ _config_set_list (config, "user", "other_name", list, length, ++ &(config->user_other_name)); ++} ++ + void + notmuch_config_set_new_tags (notmuch_config_t *config, + const char *list[], +@@ -790,6 +815,13 @@ notmuch_config_command_get (notmuch_config_t *config, char *item) + other_email = notmuch_config_get_user_other_email (config, &length); + for (i = 0; i < length; i++) + printf ("%s\n", other_email[i]); ++ } else if (strcmp(item, "user.other_name") == 0) { ++ const char **other_name; ++ size_t i, length; ++ ++ other_name = notmuch_config_get_user_other_name (config, &length); ++ for (i = 0; i < length; i++) ++ printf ("%s\n", other_name[i]); + } else if (strcmp(item, "new.tags") == 0) { + const char **tags; + size_t i, length; +-- +2.7.4 +