Changeset 3311:cd3774ecfa9f for alias.c

Show
Ignore:
Timestamp:
2003-03-03 06:01:06 (6 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • alias.c

    r3253 r3311  
    2020#include "mutt_regex.h" 
    2121#include "mutt_curses.h" 
     22#include "mutt_idna.h" 
    2223 
    2324#include <string.h> 
     
    211212  ALIAS *new, *t; 
    212213  char buf[LONG_STRING], prompt[SHORT_STRING], *pc; 
     214  char *err = NULL; 
    213215  char fixed[LONG_STRING]; 
    214216  FILE *rc; 
     
    279281    if((new->addr = rfc822_parse_adrlist (new->addr, buf)) == NULL) 
    280282      BEEP (); 
     283    if (mutt_addrlist_to_idna (new->addr, &err)) 
     284    { 
     285      mutt_error (_("Error: '%s' is a bad IDN."), err); 
     286      mutt_sleep (2); 
     287      continue; 
     288    } 
    281289  } 
    282290  while(new->addr == NULL); 
     
    295303 
    296304  buf[0] = 0; 
    297   rfc822_write_address (buf, sizeof (buf), new->addr); 
     305  rfc822_write_address (buf, sizeof (buf), new->addr, 1); 
    298306  snprintf (prompt, sizeof (prompt), _("[%s = %s] Accept?"), new->name, buf); 
    299307  if (mutt_yesorno (prompt, M_YES) != M_YES) 
     
    324332    fprintf (rc, "alias %s ", buf); 
    325333    buf[0] = 0; 
    326     rfc822_write_address (buf, sizeof (buf), new->addr); 
     334    rfc822_write_address (buf, sizeof (buf), new->addr, 0); 
    327335    write_safe_address (rc, buf); 
    328336    fputc ('\n', rc);