summaryrefslogtreecommitdiffstats
path: root/edit.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2003-03-03 14:01:06 +0000
committerThomas Roessler <roessler@does-not-exist.org>2003-03-03 14:01:06 +0000
commitd044f05207a3eea8124b2029c4b04826b9f14003 (patch)
tree096b05db63f07f52223c1215e6531dce5a9e20e8 /edit.c
parente8b857a970452e6301b3e937002b623f2684334e (diff)
IDN support for e-mail messages. Things should work automagically
once you have the GNU IDN library available from ftp://alpha.gnu.org/pub/gnu/libidn/ installed. For IDN's which can't be losslessly recoded to your local character set, mutt should automatically fall back to using the ASCII representation. There's probably a considerable number of bugs in this, and the code may, at this point, not even compile on machines without libidn. Will start working on that ASAP.
Diffstat (limited to 'edit.c')
-rw-r--r--edit.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/edit.c b/edit.c
index 37684939..77472910 100644
--- a/edit.c
+++ b/edit.c
@@ -20,6 +20,7 @@
#include "mutt.h"
#include "mutt_curses.h"
+#include "mutt_idna.h"
#include <stdio.h>
#include <string.h>
@@ -192,7 +193,7 @@ static void be_print_header (ENVELOPE *env)
{
addstr ("To: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), env->to);
+ rfc822_write_address (tmp, sizeof (tmp), env->to, 1);
addstr (tmp);
addch ('\n');
}
@@ -200,7 +201,7 @@ static void be_print_header (ENVELOPE *env)
{
addstr ("Cc: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), env->cc);
+ rfc822_write_address (tmp, sizeof (tmp), env->cc, 1);
addstr (tmp);
addch ('\n');
}
@@ -208,7 +209,7 @@ static void be_print_header (ENVELOPE *env)
{
addstr ("Bcc: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), env->bcc);
+ rfc822_write_address (tmp, sizeof (tmp), env->bcc, 1);
addstr (tmp);
addch ('\n');
}
@@ -232,7 +233,8 @@ static void be_edit_header (ENVELOPE *e, int force)
addstr ("To: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->to);
+ mutt_addrlist_to_local (e->to);
+ rfc822_write_address (tmp, sizeof (tmp), e->to, 0);
if (!e->to || force)
{
if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 4, 0) == 0)
@@ -240,13 +242,15 @@ static void be_edit_header (ENVELOPE *e, int force)
rfc822_free_address (&e->to);
e->to = mutt_parse_adrlist (e->to, tmp);
e->to = mutt_expand_aliases (e->to);
+ mutt_addrlist_to_idna (e->to, NULL); /* XXX - IDNA error reporting? */
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->to);
+ rfc822_write_address (tmp, sizeof (tmp), e->to, 1);
mvaddstr (LINES - 1, 4, tmp);
}
}
else
{
+ mutt_addrlist_to_idna (e->to, NULL); /* XXX - IDNA error reporting? */
addstr (tmp);
}
addch ('\n');
@@ -264,16 +268,20 @@ static void be_edit_header (ENVELOPE *e, int force)
{
addstr ("Cc: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->cc);
+ mutt_addrlist_to_local (e->cc);
+ rfc822_write_address (tmp, sizeof (tmp), e->cc, 0);
if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 4, 0) == 0)
{
rfc822_free_address (&e->cc);
e->cc = mutt_parse_adrlist (e->cc, tmp);
e->cc = mutt_expand_aliases (e->cc);
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->cc);
+ mutt_addrlist_to_idna (e->cc, NULL);
+ rfc822_write_address (tmp, sizeof (tmp), e->cc, 1);
mvaddstr (LINES - 1, 4, tmp);
}
+ else
+ mutt_addrlist_to_idna (e->cc, NULL);
addch ('\n');
}
@@ -281,16 +289,20 @@ static void be_edit_header (ENVELOPE *e, int force)
{
addstr ("Bcc: ");
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->bcc);
+ mutt_addrlist_to_local (e->bcc);
+ rfc822_write_address (tmp, sizeof (tmp), e->bcc, 0);
if (mutt_enter_string (tmp, sizeof (tmp), LINES-1, 5, 0) == 0)
{
rfc822_free_address (&e->bcc);
e->bcc = mutt_parse_adrlist (e->bcc, tmp);
e->bcc = mutt_expand_aliases (e->bcc);
+ mutt_addrlist_to_idna (e->bcc, NULL);
tmp[0] = 0;
- rfc822_write_address (tmp, sizeof (tmp), e->bcc);
+ rfc822_write_address (tmp, sizeof (tmp), e->bcc, 1);
mvaddstr (LINES - 1, 5, tmp);
}
+ else
+ mutt_addrlist_to_idna (e->bcc, NULL);
addch ('\n');
}
}
@@ -415,12 +427,18 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
case 'v':
if (be_barf_file (path, buf, buflen) == 0)
{
+ char *tag, *err;
be_free_memory (buf, buflen);
buf = NULL;
bufmax = buflen = 0;
if (option (OPTEDITHDRS))
+ {
+ mutt_env_to_local (msg->env);
mutt_edit_headers (NONULL(Visual), path, msg, NULL, 0);
+ if (mutt_env_to_idna (msg->env, &tag, &err))
+ printw (_("Bad IDN in %s: '%s'\n"), tag, err);
+ }
else
mutt_edit_file (NONULL(Visual), path);