]> granicus.if.org Git - mutt/commitdiff
Encode lines written to $alias_file in $config_charset if set. Closes #3095
authorRocco Rutte <pdmef@gmx.net>
Mon, 21 Jul 2008 07:11:40 +0000 (09:11 +0200)
committerRocco Rutte <pdmef@gmx.net>
Mon, 21 Jul 2008 07:11:40 +0000 (09:11 +0200)
ChangeLog
alias.c
init.h

index fb6b636b87966ebc7dc13036ba9ef4770e1e383f..5e38659c402a521fcbdab9ac9cb3bbf4b3c833e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2008-07-10 09:38 -0400  Aron Griffis  <agriffis@n01se.net>  (7729b1ad530c)
+
+       * copy.c, protos.h, sendlib.c: Unify mutt_write_references
+
+       copy.c and sendlib.c have independent and different implementations
+       of writing references to a file. Choose the one in sendlib since
+       it's conservative with mallocs and supports trimming the list.
+
+       Signed-off-by: Aron Griffis <agriffis@n01se.net>
+
+2008-07-10 09:38 -0400  Aron Griffis  <agriffis@n01se.net>  (651ffe277dfd)
+
+       * copy.c: Clean up error handling in mutt_copy_header
+
+       mutt_copy_header unnecessarily tests the result of each fputc/fputs
+       (well, most of them anyway, it's not consistent). This obfuscates
+       the code and hides bugs. Remove these extraneous checks since
+       ferror/feof are checked at the bottom of the function, and get rid
+       of all the early returns.
+
+       Signed-off-by: Aron Griffis <agriffis@n01se.net>
+
+2008-07-17 19:48 +0200  Rocco Rutte  <pdmef@gmx.net>  (f135d64e0082)
+
+       * ChangeLog, query.c: Cleanup unused vars changeset ba0d96408425
+       didn't remove
+
 2008-07-11 11:34 +0200  Rocco Rutte  <pdmef@gmx.net>  (cc67b008038c)
 
        * doc/manual.xml.head: Mention that @ can be used in usernames in URLs
diff --git a/alias.c b/alias.c
index 90608c9026d5399e9d0444406b67c477ffccf1b7..75d49aa3d2989dd6c891e5d1f0aee6593c08bc01 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -211,6 +211,20 @@ ADDRESS *mutt_get_address (ENVELOPE *env, char **pfxp)
   return adr;
 }
 
+static void recode_buf (char *buf, size_t buflen)
+{
+  char *s;
+
+  if (!ConfigCharset || !*ConfigCharset || !Charset)
+    return;
+  s = safe_strdup (buf);
+  if (!s)
+    return;
+  if (mutt_convert_string (&s, Charset, ConfigCharset, 0) == 0)
+    strfcpy (buf, s, buflen);
+  FREE(&s);
+}
+
 void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr)
 {
   ALIAS *new, *t;
@@ -355,9 +369,11 @@ retry_name:
       mutt_quote_filename (buf, sizeof (buf), new->name);
     else
       strfcpy (buf, new->name, sizeof (buf));
+    recode_buf (buf, sizeof (buf));
     fprintf (rc, "alias %s ", buf);
     buf[0] = 0;
     rfc822_write_address (buf, sizeof (buf), new->addr, 0);
+    recode_buf (buf, sizeof (buf));
     write_safe_address (rc, buf);
     fputc ('\n', rc);
     fclose (rc);
diff --git a/init.h b/init.h
index 5f5b4fd4e6d157360a8b70d6fa58e910102ea1bd..8d4a706d9d15910cd77f572ef7201f3ed40ae742 100644 (file)
--- a/init.h
+++ b/init.h
@@ -103,7 +103,9 @@ struct option_t MuttVars[] = {
   /*
   ** .pp
   ** The default file in which to save aliases created by the 
-  ** ``$create-alias'' function.
+  ** ``$create-alias'' function. Entries added to this file are
+  ** encoded in the charsacter set specified by $$config_charset if it
+  ** is set or the current character set otherwise.
   ** .pp
   ** \fBNote:\fP Mutt will not automatically source this file; you must
   ** explicitly use the ``$source'' command for it to be executed.
@@ -372,7 +374,8 @@ struct option_t MuttVars[] = {
   /*
   ** .pp
   ** When defined, Mutt will recode commands in rc files from this
-  ** encoding.
+  ** encoding to the current charsacter set and aliases written to
+  ** $$alias_file from the current character set.
   */
   { "confirmappend",   DT_BOOL, R_NONE, OPTCONFIRMAPPEND, 1 },
   /*