From: David Levine Date: Sat, 24 Sep 2016 21:08:01 +0000 (-0400) Subject: Replace profile-based hack to allow getname() to handle 8-bit X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/2c00d4488d86c136d4ef1dcd78cce0d23c91d736 Replace profile-based hack to allow getname() to handle 8-bit addresses with a global data-based hack. At least the global data is hidden in addrsbr.c. --- diff --git a/h/addrsbr.h b/h/addrsbr.h index de5dc3b4..1b147f68 100644 --- a/h/addrsbr.h +++ b/h/addrsbr.h @@ -40,6 +40,12 @@ struct mailname { void mnfree(struct mailname *); int ismymbox(struct mailname *); +/* + * Enable Email Address Internationalization, which requires + * support of 8-bit addresses. + */ +void enable_eai(); + /* * Parse an address header, and return a sequence of email addresses. * This function is the main entry point into the nmh address parser. diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index f8b98f23..6bb94211 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -76,17 +76,22 @@ static char *grp = NULL; static char *note = NULL; static char err[BUFSIZ]; static char adr[BUFSIZ]; +static int eai = 0; + +void +enable_eai() { + eai = 1; +} char * getname (const char *addrs) { struct adrx *ap; - const char *const eai = context_find ("eai"); pers = mbox = host = route = grp = note = NULL; err[0] = '\0'; - if ((ap = getadrx (addrs ? addrs : "", eai && strncasecmp (eai, "utf-8", 5) == 0)) == NULL) { + if ((ap = getadrx (addrs ? addrs : "", eai)) == NULL) { return NULL; } diff --git a/uip/post.c b/uip/post.c index 810d678b..47941afc 100644 --- a/uip/post.c +++ b/uip/post.c @@ -791,9 +791,8 @@ putfmt (char *name, char *str, int *eai, FILE *out) /* Enable SMTPUTF8. */ *eai = 1; - /* Add eai profile entry, to pass utf-8 setting to - getname()/getadrx(). */ - add_profile_entry ("eai", "utf-8"); + /* Enable passing of utf-8 setting to getname()/getadrx(). */ + enable_eai(); } }