[PATCH 1/4] Add user.other_name property to associate names with other_email.
authorShea Levy <shea@shealevy.com>
Tue, 9 Aug 2016 20:55:15 +0000 (16:55 +2000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:22 +0000 (16:22 -0700)
3a/8f2b11efaa425ac397a712b612f87950a34ef2 [new file with mode: 0644]

diff --git a/3a/8f2b11efaa425ac397a712b612f87950a34ef2 b/3a/8f2b11efaa425ac397a712b612f87950a34ef2
new file mode 100644 (file)
index 0000000..d549ed9
--- /dev/null
@@ -0,0 +1,174 @@
+Return-Path: <shea@shealevy.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 arlo.cworth.org (Postfix) with ESMTP id 2A2F96DE0281\r
+ for <notmuch@notmuchmail.org>; Tue,  9 Aug 2016 14:04:12 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id iBpt6P5qqAmg for <notmuch@notmuchmail.org>;\r
+ Tue,  9 Aug 2016 14:04:03 -0700 (PDT)\r
+X-Greylist: delayed 445 seconds by postgrey-1.35 at arlo;\r
+ Tue, 09 Aug 2016 14:04:03 PDT\r
+Received: from smtprelay.hostedemail.com (smtprelay0165.hostedemail.com\r
+ [216.40.44.165])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 989306DE01C2\r
+ for <notmuch@notmuchmail.org>; Tue,  9 Aug 2016 14:04:03 -0700 (PDT)\r
+Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com\r
+ [10.5.19.251])\r
+ by smtpgrave08.hostedemail.com (Postfix) with ESMTP id F160921172D\r
+ for <notmuch@notmuchmail.org>; Tue,  9 Aug 2016 20:56:40 +0000 (UTC)\r
+Received: from filter.hostedemail.com (unknown [216.40.38.60])\r
+ by smtprelay07.hostedemail.com (Postfix) with ESMTP id A1809C1F81\r
+ for <notmuch@notmuchmail.org>; Tue,  9 Aug 2016 20:56:39 +0000 (UTC)\r
+X-Session-Marker: 7368656140736865616C6576792E636F6D\r
+X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, shea@shealevy.com, :,\r
+ 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,\r
+ DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0,\r
+ LFtime:1, LUA_SUMMARY:none\r
+X-HE-Tag: toys92_1cd2613433624\r
+X-Filterd-Recvd-Size: 4524\r
+Received: from shlevy-laptop.local.tld (unknown [184.209.6.164])\r
+ (Authenticated sender: shea@shealevy.com)\r
+ by omf08.hostedemail.com (Postfix) with ESMTPA\r
+ for <notmuch@notmuchmail.org>; Tue,  9 Aug 2016 20:56:37 +0000 (UTC)\r
+From: Shea Levy <shea@shealevy.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/4] Add user.other_name property to associate names with\r
+ other_email.\r
+Date: Tue,  9 Aug 2016 16:55:15 -0400\r
+Message-Id: <1470776118-5070-2-git-send-email-shea@shealevy.com>\r
+X-Mailer: git-send-email 2.7.4\r
+In-Reply-To: <1470776118-5070-1-git-send-email-shea@shealevy.com>\r
+References: <1470776118-5070-1-git-send-email-shea@shealevy.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 09 Aug 2016 21:04:12 -0000\r
+\r
+Entries are paired with the email address at the same index in\r
+other_email. To use user.name for a given other_email, leave that\r
+entry blank or leave user.other_name shorter than the relevant index\r
+altogether.\r
+---\r
+ notmuch-client.h |  9 +++++++++\r
+ notmuch-config.c | 32 ++++++++++++++++++++++++++++++++\r
+ 2 files changed, 41 insertions(+)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index ebc092b..69c83a2 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -304,6 +304,15 @@ notmuch_config_set_user_other_email (notmuch_config_t *config,\r
+                                    size_t length);\r
\r
+ const char **\r
++notmuch_config_get_user_other_name (notmuch_config_t *config,\r
++                                  size_t *length);\r
++\r
++void\r
++notmuch_config_set_user_other_name (notmuch_config_t *config,\r
++                                  const char *other_name[],\r
++                                  size_t length);\r
++\r
++const char **\r
+ notmuch_config_get_new_tags (notmuch_config_t *config,\r
+                            size_t *length);\r
+ void\r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index e5d42a0..4ac16b7 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -63,6 +63,8 @@ static const char user_config_comment[] =\r
+     "\tprimary_email  Your primary email address.\n"\r
+     "\tother_email    A list (separated by ';') of other email addresses\n"\r
+     "\t               at which you receive email.\n"\r
++    "\tother_name     A list (separated by ';') of names corresponding to\n"\r
++    "\t       other_email addresses. Leave an entry blank to use default\n"\r
+     "\n"\r
+     " Notmuch will use the various email addresses configured here when\n"\r
+     " formatting replies. It will avoid including your own addresses in the\n"\r
+@@ -120,6 +122,8 @@ struct _notmuch_config {\r
+     char *user_primary_email;\r
+     const char **user_other_email;\r
+     size_t user_other_email_length;\r
++    const char **user_other_name;\r
++    size_t user_other_name_length;\r
+     const char **new_tags;\r
+     size_t new_tags_length;\r
+     const char **new_ignore;\r
+@@ -237,6 +241,8 @@ get_username_from_passwd_file (void *ctx)\r
+  *\r
+  *            user_other_email:       Not set.\r
+  *\r
++ *            user_other_name:        Not set.\r
++ *\r
+  *    The default configuration also contains comments to guide the\r
+  *    user in editing the file directly.\r
+  */\r
+@@ -280,6 +286,8 @@ notmuch_config_open (void *ctx,\r
+     config->user_primary_email = NULL;\r
+     config->user_other_email = NULL;\r
+     config->user_other_email_length = 0;\r
++    config->user_other_name = NULL;\r
++    config->user_other_name_length = 0;\r
+     config->new_tags = NULL;\r
+     config->new_tags_length = 0;\r
+     config->new_ignore = NULL;\r
+@@ -674,6 +682,23 @@ notmuch_config_set_user_other_email (notmuch_config_t *config,\r
+                    &(config->user_other_email));\r
+ }\r
\r
++const char **\r
++notmuch_config_get_user_other_name (notmuch_config_t *config, size_t *length)\r
++{\r
++    return _config_get_list (config, "user", "other_name",\r
++                           &(config->user_other_name),\r
++                           &(config->user_other_name_length), length);\r
++}\r
++\r
++void\r
++notmuch_config_set_user_other_name (notmuch_config_t *config,\r
++                                  const char *list[],\r
++                                  size_t length)\r
++{\r
++    _config_set_list (config, "user", "other_name", list, length,\r
++                   &(config->user_other_name));\r
++}\r
++\r
+ void\r
+ notmuch_config_set_new_tags (notmuch_config_t *config,\r
+                                    const char *list[],\r
+@@ -790,6 +815,13 @@ notmuch_config_command_get (notmuch_config_t *config, char *item)\r
+       other_email = notmuch_config_get_user_other_email (config, &length);\r
+       for (i = 0; i < length; i++)\r
+           printf ("%s\n", other_email[i]);\r
++    } else if (strcmp(item, "user.other_name") == 0) {\r
++      const char **other_name;\r
++      size_t i, length;\r
++\r
++      other_name = notmuch_config_get_user_other_name (config, &length);\r
++      for (i = 0; i < length; i++)\r
++          printf ("%s\n", other_name[i]);\r
+     } else if (strcmp(item, "new.tags") == 0) {\r
+       const char **tags;\r
+       size_t i, length;\r
+-- \r
+2.7.4\r
+\r