Changeset 5458:f93dcd689032

Show
Ignore:
Timestamp:
2008-07-21 00:11:40 (4 months ago)
Author:
Rocco Rutte <pdmef@…>
Branch:
HEAD
Message:

Encode lines written to $alias_file in $config_charset if set. Closes #3095

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5455 r5458  
     12008-07-10 09:38 -0400  Aron Griffis  <agriffis@n01se.net>  (7729b1ad530c) 
     2 
     3        * copy.c, protos.h, sendlib.c: Unify mutt_write_references 
     4 
     5        copy.c and sendlib.c have independent and different implementations 
     6        of writing references to a file. Choose the one in sendlib since 
     7        it's conservative with mallocs and supports trimming the list. 
     8 
     9        Signed-off-by: Aron Griffis <agriffis@n01se.net> 
     10 
     112008-07-10 09:38 -0400  Aron Griffis  <agriffis@n01se.net>  (651ffe277dfd) 
     12 
     13        * copy.c: Clean up error handling in mutt_copy_header 
     14 
     15        mutt_copy_header unnecessarily tests the result of each fputc/fputs 
     16        (well, most of them anyway, it's not consistent). This obfuscates 
     17        the code and hides bugs. Remove these extraneous checks since 
     18        ferror/feof are checked at the bottom of the function, and get rid 
     19        of all the early returns. 
     20 
     21        Signed-off-by: Aron Griffis <agriffis@n01se.net> 
     22 
     232008-07-17 19:48 +0200  Rocco Rutte  <pdmef@gmx.net>  (f135d64e0082) 
     24 
     25        * ChangeLog, query.c: Cleanup unused vars changeset ba0d96408425 
     26        didn't remove 
     27 
    1282008-07-11 11:34 +0200  Rocco Rutte  <pdmef@gmx.net>  (cc67b008038c) 
    229 
  • alias.c

    r5417 r5458  
    212212} 
    213213 
     214static void recode_buf (char *buf, size_t buflen) 
     215{ 
     216  char *s; 
     217 
     218  if (!ConfigCharset || !*ConfigCharset || !Charset) 
     219    return; 
     220  s = safe_strdup (buf); 
     221  if (!s) 
     222    return; 
     223  if (mutt_convert_string (&s, Charset, ConfigCharset, 0) == 0) 
     224    strfcpy (buf, s, buflen); 
     225  FREE(&s); 
     226} 
     227 
    214228void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr) 
    215229{ 
     
    356370    else 
    357371      strfcpy (buf, new->name, sizeof (buf)); 
     372    recode_buf (buf, sizeof (buf)); 
    358373    fprintf (rc, "alias %s ", buf); 
    359374    buf[0] = 0; 
    360375    rfc822_write_address (buf, sizeof (buf), new->addr, 0); 
     376    recode_buf (buf, sizeof (buf)); 
    361377    write_safe_address (rc, buf); 
    362378    fputc ('\n', rc); 
  • init.h

    r5431 r5458  
    104104  ** .pp 
    105105  ** The default file in which to save aliases created by the  
    106   ** ``$create-alias'' function. 
     106  ** ``$create-alias'' function. Entries added to this file are 
     107  ** encoded in the charsacter set specified by $$config_charset if it 
     108  ** is set or the current character set otherwise. 
    107109  ** .pp 
    108110  ** \fBNote:\fP Mutt will not automatically source this file; you must 
     
    373375  ** .pp 
    374376  ** When defined, Mutt will recode commands in rc files from this 
    375   ** encoding. 
     377  ** encoding to the current charsacter set and aliases written to 
     378  ** $$alias_file from the current character set. 
    376379  */ 
    377380  { "confirmappend",    DT_BOOL, R_NONE, OPTCONFIRMAPPEND, 1 },