Commit d044f052 authored by Thomas Roessler's avatar Thomas Roessler

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.
parent e8b857a9
......@@ -28,7 +28,7 @@ mutt_SOURCES = $(BUILT_SOURCES) \
score.c send.c sendlib.c signal.c sort.c \
status.c system.c thread.c charset.c history.c lib.c \
muttlib.c editmsg.c utf8.c mbyte.c wcwidth.c \
url.c ascii.c
url.c ascii.c mutt_idna.c
mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
$(INTLLIBS) $(LIBICONV)
......@@ -61,7 +61,8 @@ CPPFLAGS=@CPPFLAGS@ -I$(includedir)
EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
mutt_tunnel.c pop.c pop_auth.c pop_lib.c smime.c pgp.c pgpinvoke.c pgpkey.c \
pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c
browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c \
pgppacket.c mutt_idna.h
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
configure acconfig.h account.h \
......@@ -75,7 +76,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h Muttrc.head Muttrc \
makedoc.c stamp-doc-rc README.SSL smime.h\
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
ChangeLog.old mkchangelog.sh cvslog2changelog.pl
ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h
mutt_dotlock_SOURCES = mutt_dotlock.c
mutt_dotlock_LDADD = @LIBOBJS@
......
......@@ -55,7 +55,7 @@ alias_format_str (char *dest, size_t destlen, char op, const char *src,
break;
case 'r':
adr[0] = 0;
rfc822_write_address (adr, sizeof (adr), alias->addr);
rfc822_write_address (adr, sizeof (adr), alias->addr, 1);
snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
snprintf (dest, destlen, tmp, adr);
break;
......@@ -222,13 +222,13 @@ new_aliases:
{
if (AliasTable[i]->tagged)
{
rfc822_write_address (buf, buflen, AliasTable[i]->addr);
rfc822_write_address (buf, buflen, AliasTable[i]->addr, 0);
t = -1;
}
}
if(t != -1)
rfc822_write_address (buf, buflen, AliasTable[t]->addr);
rfc822_write_address (buf, buflen, AliasTable[t]->addr, 0);
mutt_menuDestroy (&menu);
FREE (&AliasTable);
......
......@@ -19,6 +19,7 @@
#include "mutt.h"
#include "mutt_regex.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
#include <string.h>
#include <ctype.h>
......@@ -210,6 +211,7 @@ void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr)
{
ALIAS *new, *t;
char buf[LONG_STRING], prompt[SHORT_STRING], *pc;
char *err = NULL;
char fixed[LONG_STRING];
FILE *rc;
ADDRESS *adr = NULL;
......@@ -278,6 +280,12 @@ retry_name:
if((new->addr = rfc822_parse_adrlist (new->addr, buf)) == NULL)
BEEP ();
if (mutt_addrlist_to_idna (new->addr, &err))
{
mutt_error (_("Error: '%s' is a bad IDN."), err);
mutt_sleep (2);
continue;
}
}
while(new->addr == NULL);
......@@ -294,7 +302,7 @@ retry_name:
new->addr->personal = safe_strdup (buf);
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), new->addr);
rfc822_write_address (buf, sizeof (buf), new->addr, 1);
snprintf (prompt, sizeof (prompt), _("[%s = %s] Accept?"), new->name, buf);
if (mutt_yesorno (prompt, M_YES) != M_YES)
{
......@@ -323,7 +331,7 @@ retry_name:
strfcpy (buf, new->name, sizeof (buf));
fprintf (rc, "alias %s ", buf);
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), new->addr);
rfc822_write_address (buf, sizeof (buf), new->addr, 0);
write_safe_address (rc, buf);
fputc ('\n', rc);
fclose (rc);
......
......@@ -49,8 +49,6 @@ void fgetconv_close (FGETCONV **);
void mutt_set_langinfo_charset (void);
#define M_ICONV_HOOK_FROM 1
#if 0
#define M_ICONV_HOOK_TO 2
#endif
#endif /* _CHARSET_H */
......@@ -27,6 +27,7 @@
#include "mx.h"
#include "pager.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -227,6 +228,7 @@ void ci_bounce_message (HEADER *h, int *redraw)
char prompt[SHORT_STRING];
char buf[HUGE_STRING] = { 0 };
ADDRESS *adr = NULL;
char *err = NULL;
int rc;
if(h)
......@@ -253,8 +255,16 @@ void ci_bounce_message (HEADER *h, int *redraw)
adr = mutt_expand_aliases (adr);
if (mutt_addrlist_to_idna (adr, &err) < 0)
{
mutt_error (_("Bad IDN: '%s'"), err);
FREE (&err);
rfc822_free_address (&adr);
return;
}
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr);
rfc822_write_address (buf, sizeof (buf), adr, 1);
#define extra_space (15 + 7 + 2)
snprintf (prompt, sizeof (prompt),
......@@ -590,9 +600,16 @@ void mutt_display_address (ENVELOPE *env)
adr = mutt_get_address (env, &pfx);
if (!adr) return;
/*
* Note: We don't convert IDNA to local representation this time.
* That is intentional, so the user has an opportunity to copy &
* paste the on-the-wire form of the address to other, IDN-unable
* software.
*/
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr);
rfc822_write_address (buf, sizeof (buf), adr, 0);
mutt_message ("%s: %s", pfx, buf);
}
......
......@@ -18,6 +18,7 @@
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_idna.h"
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
......@@ -363,7 +364,7 @@ static void draw_envelope_addr (int line, ADDRESS *addr)
char buf[STRING];
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), addr);
rfc822_write_address (buf, sizeof (buf), addr, 1);
mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
mutt_paddstr (W, buf);
}
......@@ -399,8 +400,10 @@ static void draw_envelope (HEADER *msg, char *fcc)
static int edit_address_list (int line, ADDRESS **addr)
{
char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */
rfc822_write_address (buf, sizeof (buf), *addr);
char *err = NULL;
mutt_addrlist_to_local (*addr);
rfc822_write_address (buf, sizeof (buf), *addr, 0);
if (mutt_get_field (Prompts[line - 1], buf, sizeof (buf), M_ALIAS) == 0)
{
rfc822_free_address (addr);
......@@ -414,12 +417,19 @@ static int edit_address_list (int line, ADDRESS **addr)
return (REDRAW_FULL);
}
if (mutt_addrlist_to_idna (*addr, &err) != 0)
{
mutt_error (_("Warning: '%s' is a bad IDN."), err);
mutt_refresh();
FREE (&err);
}
/* redraw the expanded list so the user can see the result */
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), *addr);
rfc822_write_address (buf, sizeof (buf), *addr, 1);
move (line, HDR_XOFFSET);
mutt_paddstr (W, buf);
return 0;
}
......@@ -692,8 +702,15 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (op == OP_COMPOSE_EDIT_HEADERS ||
(op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))
{
char *tag = NULL, *err = NULL;
mutt_env_to_local (msg->env);
mutt_edit_headers (NONULL (Editor), msg->content->filename, msg,
fcc, fcclen);
if (mutt_env_to_idna (msg->env, &tag, &err))
{
mutt_error (_("Bad IDN in \"%s\": '%s'"), tag, err);
FREE (&err);
}
}
else
{
......
......@@ -677,6 +677,19 @@ AC_ARG_WITH(sasl2, [ --with-sasl2[=PFX] Use Cyrus SASL library version
])
AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
AC_ARG_WITH(idn, [ --with-idn=[PFX] Use GNU libidn for domain names],
[
if test "$with_idn" != "no" ; then
if test "$with_idn" != "yes" ; then
CPPFLAGS="$CPPFLAGS -I$with_idn/include"
LDFLAGS="$LDFLAGS -L$with_idn/lib"
fi
fi
]
)
AC_CHECK_LIB(idn, idna_to_ascii_from_utf8)
if test "$need_md5" = "yes"
then
MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5c.o"
......
......@@ -23,12 +23,14 @@
#include "rfc2047.h"
#include "mime.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h> /* needed for SEEK_SET under SunOS 4.1.4 */
static int address_header_decode (char **str);
static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout, char *date);
/* Ok, the only reason for not merging this with mutt_copy_header()
......@@ -47,6 +49,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
char **headers;
int hdr_count;
int x;
char *this_one = NULL;
int error;
if (ftell (in) != off_start)
......@@ -134,6 +137,28 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
/* Is it the begining of a header? */
if (nl && buf[0] != ' ' && buf[0] != '\t')
{
/* Do we have anything pending? */
if (this_one)
{
if (flags & CH_DECODE)
{
if (!address_header_decode (&this_one))
rfc2047_decode (&this_one);
}
if (!headers[x])
headers[x] = this_one;
else
{
safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) +
mutt_strlen (this_one) + sizeof (char));
strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */
FREE (&this_one);
}
this_one = NULL;
}
ignore = 1;
this_is_from = 0;
if (!from && mutt_strncmp ("From ", buf, 5) == 0)
......@@ -181,32 +206,55 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
}
}
}
ignore = 0;
} /* If beginning of header */
if (!ignore)
{
dprint (2, (debugfile, "Reorder: x = %d; hdr_count = %d\n", x, hdr_count));
/* Save the header in headers[x] */
if (!headers[x])
headers[x] = safe_strdup (buf);
if (!this_one)
this_one = safe_strdup (buf);
else
{
safe_realloc ((void **) &headers[x],
mutt_strlen (headers[x]) + mutt_strlen (buf) + sizeof (char));
strcat (headers[x], buf); /* __STRCAT_CHECKED__ */
safe_realloc ((void **) &this_one,
mutt_strlen (this_one) + mutt_strlen (buf) + sizeof (char));
strcat (this_one, buf); /* __STRCAT_CHECKED__ */
}
}
} /* while (ftell (in) < off_end) */
/* Do we have anything pending? -- XXX, same code as in above in the loop. */
if (this_one)
{
if (flags & CH_DECODE)
{
if (!address_header_decode (&this_one))
rfc2047_decode (&this_one);
}
if (!headers[x])
headers[x] = this_one;
else
{
safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) +
mutt_strlen (this_one) + sizeof (char));
strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */
FREE (&this_one);
}
this_one = NULL;
}
/* Now output the headers in order */
for (x = 0; x < hdr_count; x++)
{
if (headers[x])
{
#if 0
if (flags & CH_DECODE)
rfc2047_decode (&headers[x]);
#endif
/* We couldn't do the prefixing when reading because RFC 2047
* decoding may have concatenated lines.
......@@ -726,3 +774,87 @@ static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout, char *date)
return 0;
}
static int address_header_decode (char **h)
{
char *s = *h;
int l, ll;
ADDRESS *a = NULL;
switch (tolower (*s))
{
case 'r':
{
if (ascii_strncasecmp (s, "return-path:", 12) == 0)
{
l = 12;
break;
}
else if (ascii_strncasecmp (s, "reply-to:", 9) == 0)
{
l = 9;
break;
}
return 0;
}
case 'f':
{
if (ascii_strncasecmp (s, "from:", 5))
return 0;
l = 5;
break;
}
case 'c':
{
if (ascii_strncasecmp (s, "to:", 3))
return 0;
l = 3;
break;
}
case 'b':
{
if (ascii_strncasecmp (s, "bcc:", 4))
return 0;
l = 4;
break;
}
case 's':
{
if (ascii_strncasecmp (s, "sender:", 7))
return 0;
l = 7;
break;
}
case 'm':
{
if (ascii_strncasecmp (s, "mail-followup-to:", 17))
return 0;
l = 17;
break;
}
default: return 0;
}
if ((a = rfc822_parse_adrlist (a, s + l + 1)) == NULL)
return 0;
mutt_addrlist_to_local (a);
rfc2047_decode_adrlist (a);
ll = mutt_strlen (s) * 6 + 3; /* XXX -- should be safe */
*h = safe_calloc (1, ll);
strncpy (*h, s, l);
strncat (*h, " ", ll);
rfc822_write_address (*h + l + 1, ll - l - 1, a, 0);
rfc822_free_address (&a);
strncat (*h, "\n", ll);
safe_realloc ((void **) h, mutt_strlen (*h) + 1);
FREE (&s);
return 1;
}
......@@ -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);
......
......@@ -21,6 +21,7 @@
#include "sort.h"
#include "charset.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#include <ctype.h>
#include <stdlib.h>
......@@ -261,7 +262,7 @@ hdr_format_str (char *dest,
case 'A':
if(hdr->env->reply_to && hdr->env->reply_to->mailbox)
{
mutt_format_s (dest, destlen, prefix, hdr->env->reply_to->mailbox);
mutt_format_s (dest, destlen, prefix, mutt_addr_for_display (hdr->env->reply_to));
break;
}
/* fall through if 'A' returns nothing */
......@@ -269,7 +270,7 @@ hdr_format_str (char *dest,
case 'a':
if(hdr->env->from && hdr->env->from->mailbox)
{
mutt_format_s (dest, destlen, prefix, hdr->env->from->mailbox);
mutt_format_s (dest, destlen, prefix, mutt_addr_for_display (hdr->env->from));
}
else
dest[0] = '\0';
......@@ -429,7 +430,7 @@ hdr_format_str (char *dest,
case 'f':
buf2[0] = 0;
rfc822_write_address (buf2, sizeof (buf2), hdr->env->from);
rfc822_write_address (buf2, sizeof (buf2), hdr->env->from, 1);
mutt_format_s (dest, destlen, prefix, buf2);
break;
......@@ -593,7 +594,7 @@ hdr_format_str (char *dest,
case 'u':
if (hdr->env->from && hdr->env->from->mailbox)
{
strfcpy (buf2, hdr->env->from->mailbox, sizeof (buf2));
strfcpy (buf2, mutt_addr_for_display (hdr->env->from), sizeof (buf2));
if ((p = strpbrk (buf2, "%@")))
*p = 0;
}
......
......@@ -17,8 +17,8 @@
*/
#include "mutt.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#include <sys/stat.h>
#include <string.h>
......@@ -46,7 +46,8 @@ void mutt_edit_headers (const char *editor,
mutt_perror (path);
return;
}
mutt_env_to_local (msg->env);
mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0);
fputc ('\n', ofp); /* tie off the header. */
......
......@@ -25,6 +25,7 @@
#include "mbyte.h"
#include "charset.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#if defined(USE_SSL) || defined(USE_NSS)
#include "mutt_ssl.h"
......@@ -488,7 +489,8 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
ALIAS *tmp = Aliases;
ALIAS *last = NULL;
char *estr = NULL;
if (!MoreArgs (s))
{
strfcpy (err->data, _("alias: no address"), err->dsize);
......@@ -529,6 +531,12 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
last->next = tmp;
else
Aliases = tmp;
if (mutt_addrlist_to_idna (tmp->addr, &estr))
{
snprintf (err->data, err->dsize, _("Warning: Bad IDN '%s' in alias '%s'.\n"),
estr, tmp->name);
return -1;
}
return 0;
}
......@@ -671,7 +679,7 @@ static void mutt_set_default (struct option_t *p)
{
char tmp[HUGE_STRING];
*tmp = '\0';
rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data));
rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data), 0);
p->init = (unsigned long) safe_strdup (tmp);
}
break;
......@@ -902,7 +910,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
if (DTYPE (MuttVars[idx].type) == DT_ADDR)
{
_tmp[0] = '\0';
rfc822_write_address (_tmp, sizeof (_tmp), *((ADDRESS **) MuttVars[idx].data));
rfc822_write_address (_tmp, sizeof (_tmp), *((ADDRESS **) MuttVars[idx].data), 0);
val = _tmp;
}
else
......@@ -1582,7 +1590,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
}
else if (DTYPE (MuttVars[idx].type) == DT_ADDR)
{
rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) MuttVars[idx].data));
rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) MuttVars[idx].data), 0);
}
else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
strfcpy (tmp, vals[quadoption (MuttVars[idx].data)], sizeof (tmp));
......
......@@ -25,6 +25,7 @@
#include "mailbox.h"
#include "url.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#include <string.h>
#include <stdlib.h>
......@@ -38,6 +39,10 @@
#include <getopt.h>
#endif
#ifdef HAVE_LIBIDN
#include <stringprep.h>
#endif
static const char *ReachingUs = N_("\
To contact the developers, please mail to <mutt-dev@mutt.org>.\n\
To report a bug, please use the flea(1) utility.\n");
......@@ -148,6 +153,11 @@ static void show_version (void)
printf (" [using libiconv %d.%d]", _LIBICONV_VERSION >> 8,
_LIBICONV_VERSION & 0xff);
#endif
#ifdef HAVE_LIBIDN
printf (" [using libidn %s (compiled with %s)]", stringprep_check_version (NULL),
STRINGPREP_VERSION);
#endif
puts (_("\nCompile options:"));
......@@ -383,6 +393,12 @@ static void show_version (void)
"-ICONV_NONTRANS "
#endif
#if HAVE_LIBIDN
"+HAVE_LIBIDN "
#else
"-HAVE_LIBIDN "
#endif
#if HAVE_GETSID
"+HAVE_GETSID "
#else
......@@ -647,7 +663,11 @@ int main (int argc, char **argv)
for (; alias_queries; alias_queries = alias_queries->next)
{
if ((a = mutt_lookup_alias (alias_queries->data)))
mutt_write_address_list (a, stdout, 0);
{
/* output in machine-readable form */
mutt_addrlist_to_idna (a, NULL);
mutt_write_address_list (a, stdout, 0, 0);
}
else
{
rv = 1;
......
/*
* Copyright (C) 2003 Thomas Roessler <roessler@does-not-exist.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.