<<< Date Index >>>     <<< Thread Index >>>

For 1.5.8: fmtstring, assumed, filecharset, iconvhook, flags and manual



This is the assortment of some patches,
and there's no objection to their inclusion so far IIRC.

If there is some objection,
I'll remove it and repost.

-- 
tamo
TODO:
        Mutt has $include_onlyfirst

muttlib.c pager.c:
        column-length and byte-length are different
        (TAKIZAWA Takashi)

charset.c mbyte.c hook.c:
        Allow iconv-hook overwrite existing charset
        (MORIYAMA Masayuki)

charset.c charset.h globals.h handler.c init.h parse.c rfc2047.c rfc2231.c:
        Assume charset of messages if not declared ($assumed_charset)
        (TAKIZAWA Takashi)

globals.h init.h mutt.h sendlib.c:
        Fix a bug in forwarding messages as MIME attachment ($file_charset)
        (TAKIZAWA Takashi)

editmsg.c:
        Fix debian bug #275060 (editing a message in a mbox loses its flags)

imap/message.c:
        Fix debian bug #275060 (editing on an imap server loses its flags)
        (TAKAHASHI Tamotsu, Oswald Buddenhagen)

main.c:
        Correct "mutt -h"
        (Oswald Buddenhagen)

init.h doc/manual.sgml.head doc/manual.sgml.tail:
        Trivial documentation fixes
        (TAKAHASHI Tamotsu, Brendan Cully, Paul Walker, Derek Martin)


Index: TODO
===================================================================
RCS file: /home/roessler/cvs/mutt/TODO,v
retrieving revision 3.0
diff -u -u -r3.0 TODO
--- TODO        24 Jan 2002 12:10:47 -0000      3.0
+++ TODO        10 Feb 2005 00:15:45 -0000
@@ -44,8 +44,6 @@
   STATE struct so that all of the MIME handlers can look
   up the corresponding HEADERs if need be?
 
-- option to not include attachments in replies
-
 - handle message/external-body in some fashion
 
 - handle message/partial reconstruction
Index: charset.c
===================================================================
RCS file: /home/roessler/cvs/mutt/charset.c,v
retrieving revision 3.8
diff -u -u -r3.8 charset.c
--- charset.c   3 Feb 2005 17:01:42 -0000       3.8
+++ charset.c   10 Feb 2005 00:15:46 -0000
@@ -199,6 +199,7 @@
   /* seems to be common on some systems */
 
   { "sjis",            "Shift_JIS"     },
+  { "euc-jp-ms",       "eucJP-ms"      },
 
 
   /*
@@ -328,10 +329,13 @@
   if ((flags & M_ICONV_HOOK_FROM) && (tmp = mutt_charset_hook (fromcode1)))
     mutt_canonical_charset (fromcode1, sizeof (fromcode1), tmp);
 
-  if ((cd = iconv_open (tocode1, fromcode1)) != (iconv_t) -1)
+  tocode2 = mutt_iconv_hook (tocode1);
+  tocode2 = (tocode2) ? tocode2 : tocode1;
+  fromcode2 = mutt_iconv_hook (fromcode1);
+  fromcode2 = (fromcode2) ? fromcode2 : fromcode1;
+
+  if ((cd = iconv_open (tocode2, fromcode2)) != (iconv_t) -1)
     return cd;
-  if ((tocode2 = mutt_iconv_hook (tocode1)) && (fromcode2 = mutt_iconv_hook 
(fromcode1)))
-    return iconv_open (tocode2, fromcode2);
   
   return (iconv_t) -1;
 }
@@ -590,3 +594,93 @@
     iconv_close (fc->cd);
   FREE (_fc);
 }
+
+char *mutt_get_first_charset (const char *charset)
+{
+  static char fcharset[SHORT_STRING];
+  const char *next;
+
+  if (!charset || !*charset)
+    return NONULL (charset);
+  if (!(next = strchr (charset, ':')))
+    return charset;
+  strfcpy (fcharset, charset, next - charset + 1);
+  return fcharset;
+}
+
+static size_t convert_string (ICONV_CONST char *src, size_t srclen,
+                             const char *from, const char *to,
+                             char **dst, size_t *dstlen)
+{
+  iconv_t cd;
+  char *buf, *ob;
+  size_t obl, n;
+  int e;
+
+  if (!from || !(*from))
+  {
+    *dst = safe_strdup (src);
+    *dstlen = mutt_strlen (src);
+    return 0;
+  }
+
+  cd = mutt_iconv_open (to, from, M_ICONV_HOOK_FROM);
+  if (cd == (iconv_t)(-1))
+    return (size_t)(-1);
+  obl = 4 * srclen + 1;
+  ob = buf = safe_malloc (obl);
+  n = iconv (cd, &src, &srclen, &ob, &obl);
+  if (n == (size_t)(-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t)(-1))
+  {
+    e = errno;
+    FREE (&buf);
+    iconv_close (cd);
+    errno = e;
+    return (size_t)(-1);
+  }
+  *ob = '\0';
+  
+  *dstlen = ob - buf;
+
+  safe_realloc (&buf, ob - buf + 1);
+  *dst = buf;
+  iconv_close (cd);
+
+  return n;
+}
+
+int mutt_convert_nomime_string (char **ps)
+{
+  const char *c, *c1;
+
+  for (c = NONULL (AssumedCharset); c; c = c1 ? c1 + 1 : 0)
+  {
+    char *u = *ps;
+    char *s;
+    char *fromcode;
+    size_t m, n;
+    size_t ulen = mutt_strlen (*ps);
+    size_t slen;
+
+    if (!u || !*u)
+      return 0;
+
+    c1 = strchr (c, ':');
+    n = c1 ? c1 - c : mutt_strlen (c);
+    fromcode = safe_malloc (n + 1);
+    strfcpy (fromcode, c, n + 1);
+    m = convert_string (u, ulen, fromcode, Charset, &s, &slen);
+    FREE (&fromcode);
+    if (m != (size_t)(-1))
+    {
+      FREE (ps);
+      *ps = s;
+      return 0;
+    }
+  }
+  mutt_convert_string (ps,
+    (const char *) mutt_get_first_charset (AssumedCharset),
+    Charset, M_ICONV_HOOK_FROM);
+  return -1;
+}
+
Index: charset.h
===================================================================
RCS file: /home/roessler/cvs/mutt/charset.h,v
retrieving revision 3.6
diff -u -u -r3.6 charset.h
--- charset.h   3 Mar 2003 14:01:06 -0000       3.6
+++ charset.h   10 Feb 2005 00:15:46 -0000
@@ -35,6 +35,8 @@
 #endif
 
 int mutt_convert_string (char **, const char *, const char *, int);
+char *mutt_get_first_charset (const char *);
+int mutt_convert_nomime_string (char **);
 
 iconv_t mutt_iconv_open (const char *, const char *, int);
 size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *, 
ICONV_CONST char **, const char *);
Index: editmsg.c
===================================================================
RCS file: /home/roessler/cvs/mutt/editmsg.c,v
retrieving revision 3.7
diff -u -u -r3.7 editmsg.c
--- editmsg.c   3 Feb 2005 17:01:43 -0000       3.7
+++ editmsg.c   10 Feb 2005 00:15:46 -0000
@@ -79,7 +79,9 @@
     return -1;
   }
 
-  rc = mutt_append_message (&tmpctx, ctx, cur, 0, CH_NOLEN | CH_NOSTATUS); 
oerrno = errno;
+  rc = mutt_append_message (&tmpctx, ctx, cur, 0, CH_NOLEN |
+       ((ctx->magic == M_MBOX || ctx->magic == M_MMDF) ? 0 : CH_NOSTATUS));
+  oerrno = errno;
 
   mx_close_mailbox (&tmpctx, NULL);
 
@@ -143,7 +145,8 @@
     goto bail;
   }
 
-  of = cf = 0;
+  of = 0;
+  cf = ((tmpctx.magic == M_MBOX || tmpctx.magic == M_MMDF) ? 0 : CH_NOSTATUS);
   
   if (fgets (buff, sizeof (buff), fp) && is_from (buff, NULL, 0, NULL))
   {
@@ -171,7 +174,7 @@
     goto bail;
   }
 
-  if ((rc = mutt_copy_hdr (fp, msg->fp, 0, sb.st_size, CH_NOSTATUS | CH_NOLEN 
| cf, NULL)) == 0)
+  if ((rc = mutt_copy_hdr (fp, msg->fp, 0, sb.st_size, CH_NOLEN | cf, NULL)) 
== 0)
   {
     fputc ('\n', msg->fp);
     rc = mutt_copy_stream (fp, msg->fp);
Index: globals.h
===================================================================
RCS file: /home/roessler/cvs/mutt/globals.h,v
retrieving revision 3.13
diff -u -u -r3.13 globals.h
--- globals.h   27 Jan 2005 18:54:24 -0000      3.13
+++ globals.h   10 Feb 2005 00:15:46 -0000
@@ -32,6 +32,7 @@
 
 WHERE char *AliasFile;
 WHERE char *AliasFmt;
+WHERE char *AssumedCharset;
 WHERE char *AttachSep;
 WHERE char *Attribution;
 WHERE char *AttachFormat;
@@ -46,6 +47,7 @@
 WHERE char *DsnReturn;
 WHERE char *Editor;
 WHERE char *EscChar;
+WHERE char *FileCharset;
 WHERE char *FolderFormat;
 WHERE char *ForwFmt;
 WHERE char *Fqdn;
Index: handler.c
===================================================================
RCS file: /home/roessler/cvs/mutt/handler.c,v
retrieving revision 3.19
diff -u -u -r3.19 handler.c
--- handler.c   3 Feb 2005 17:01:43 -0000       3.19
+++ handler.c   10 Feb 2005 00:15:47 -0000
@@ -1725,11 +1725,21 @@
   int istext = mutt_is_text_part (b);
   iconv_t cd = (iconv_t)(-1);
 
-  if (istext && s->flags & M_CHARCONV)
+  if (istext)
   {
-    char *charset = mutt_get_parameter ("charset", b->parameter);
-    if (charset && Charset)
-      cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM);
+    if(s->flags & M_CHARCONV)
+    {
+      char *charset = mutt_get_parameter ("charset", b->parameter);
+      if (!charset && AssumedCharset && *AssumedCharset)
+        charset = mutt_get_first_charset (AssumedCharset);
+      if (charset && Charset)
+        cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM);
+    }
+    else
+    {
+      if (b->file_charset)
+        cd = mutt_iconv_open (Charset, b->file_charset, M_ICONV_HOOK_FROM);
+    }
   }
 
   fseek (s->fpin, b->offset, 0);
Index: hook.c
===================================================================
RCS file: /home/roessler/cvs/mutt/hook.c,v
retrieving revision 3.10
diff -u -u -r3.10 hook.c
--- hook.c      3 Feb 2005 17:01:43 -0000       3.10
+++ hook.c      10 Feb 2005 00:15:47 -0000
@@ -92,7 +92,7 @@
     memset (&pattern, 0, sizeof (pattern));
     pattern.data = safe_strdup (path);
   }
-  else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
+  else if (DefaultHook && !(data & (M_CHARSETHOOK|M_ICONVHOOK|M_ACCOUNTHOOK))
            && (!WithCrypto || !(data & M_CRYPTHOOK))
       )
   {
@@ -161,7 +161,7 @@
   {
     rx = safe_malloc (sizeof (regex_t));
 #ifdef M_CRYPTHOOK
-    if ((rc = REGCOMP (rx, NONULL(pattern.data), ((data & 
(M_CRYPTHOOK|M_CHARSETHOOK)) ? REG_ICASE : 0))) != 0)
+    if ((rc = REGCOMP (rx, NONULL(pattern.data), ((data & 
(M_CRYPTHOOK|M_CHARSETHOOK|M_ICONVHOOK)) ? REG_ICASE : 0))) != 0)
 #else
     if ((rc = REGCOMP (rx, NONULL(pattern.data), (data & 
(M_CHARSETHOOK|M_ICONVHOOK)) ? REG_ICASE : 0)) != 0)
 #endif /* M_CRYPTHOOK */
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.61
diff -u -u -r3.61 init.h
--- init.h      8 Feb 2005 17:23:50 -0000       3.61
+++ init.h      10 Feb 2005 00:15:48 -0000
@@ -185,6 +185,22 @@
   ** If set, Mutt will prompt you for carbon-copy (Cc) recipients before
   ** editing the body of an outgoing message.
   */  
+  { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL "" },
+  /*
+  ** .pp
+  ** This variable is a colon-separated list of character encoding 
+  ** schemes for messages without character encoding indication.
+  ** Header field values without character encoding indication would be 
+  ** assumed to be written in one of this list.
+  ** Message body content without character encoding indication would be
+  ** assumed to be written in the first entry of this list.
+  ** By default, any header fields and message body with no charset 
+  ** indication are assumed to be in $$charset.
+  ** .pp
+  ** For example, Japanese users might prefer this setting:
+  ** .pp
+  **   set assumed_charset="iso-2022-jp:euc-jp:shift_jis:utf-8"
+  */
   { "attach_format",   DT_STR,  R_NONE, UL &AttachFormat, UL "%u%D%I %t%4n 
%T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " },
   /*
   ** .pp
@@ -550,6 +566,20 @@
   ** signed.
   ** (PGP only)
   */
+  { "file_charset",    DT_STR,  R_NONE, UL &FileCharset, UL 0 },
+  /*
+  ** .pp
+  ** This variable is a colon-separated list of character encoding
+  ** schemes for text file attatchments.
+  ** If unset, $$charset value will be used instead.
+  ** For example, the following configuration would work for Japanese
+  ** text handling:
+  ** .pp
+  **   set file_charset="iso-2022-jp:euc-jp:shift_jis:utf-8"
+  ** .pp
+  ** Note: "iso-2022-*" must be put at the head of the value as shown above
+  ** if included.
+  */
   { "folder",          DT_PATH, R_NONE, UL &Maildir, UL "~/Mail" },
   /*
   ** .pp
@@ -1192,7 +1222,7 @@
   { "move",            DT_QUAD, R_NONE, OPT_MOVE, M_ASKNO },
   /*
   ** .pp
-  ** Controls whether you will be asked to confirm moving read messages
+  ** Controls whether or not Mutt will move read messages
   ** from your spool mailbox to your ``$$mbox'' mailbox, or as a result of
   ** a ``$mbox-hook'' command.
   */
@@ -2038,8 +2068,9 @@
   { "print",           DT_QUAD, R_NONE, OPT_PRINT, M_ASKNO },
   /*
   ** .pp
-  ** Controls whether or not Mutt asks for confirmation before printing.
-  ** This is useful for people (like me) who accidentally hit ``p'' often.
+  ** Controls whether or not Mutt really prints messages.
+  ** This is set to \fIask-no\fP by default, because some people
+  ** accidentally hit ``p'' often (like me).
   */
   { "print_command",   DT_PATH, R_NONE, UL &PrintCmd, UL "lpr" },
   /*
@@ -2140,7 +2171,7 @@
   { "recall",          DT_QUAD, R_NONE, OPT_RECALL, M_ASKYES },
   /*
   ** .pp
-  ** Controls whether or not you are prompted to recall postponed messages
+  ** Controls whether or not Mutt recalls postponed messages
   ** when composing a new message.  Also see ``$$postponed''.
   ** .pp
   ** Setting this variable to ``yes'' is not generally useful, and thus not
@@ -2174,8 +2205,8 @@
   { "reply_to",                DT_QUAD, R_NONE, OPT_REPLYTO, M_ASKYES },
   /*
   ** .pp
-  ** If set, Mutt will ask you if you want to use the address listed in the
-  ** Reply-To: header field when replying to a message.  If you answer no,
+  ** If set, when replying to a message, Mutt will use the address listed
+  ** in the Reply-to: header as the recipient of the reply.  If unset,
   ** it will use the address in the From: header field instead.  This
   ** option is useful for reading a mailing list that sets the Reply-To:
   ** header field to the list address and you want to send a private
@@ -2540,7 +2571,7 @@
   ** .dt %m  .dd the number of messages in the mailbox *
   ** .dt %M  .dd the number of messages shown (i.e., which match the current 
limit) *
   ** .dt %n  .dd number of new messages in the mailbox *
-  ** .dt %o  .dd number of old unread messages
+  ** .dt %o  .dd number of old unread messages *
   ** .dt %p  .dd number of postponed messages *
   ** .dt %P  .dd percentage of the way through the index
   ** .dt %r  .dd modified/read-only/won't-write/attach-message indicator,
@@ -2567,8 +2598,8 @@
   ** .pp
   ** where \fIsequence_char\fP is a character from the table above, and
   ** \fIoptional_string\fP is the string you would like printed if
-  ** \fIstatus_char\fP is nonzero.  \fIoptional_string\fP \fBmay\fP contain
-  ** other sequence as well as normal text, but you may \fBnot\fP nest
+  ** \fIsequence_char\fP is nonzero.  \fIoptional_string\fP \fBmay\fP contain
+  ** other sequences as well as normal text, but you may \fBnot\fP nest
   ** optional strings.
   ** .pp
   ** Here is an example illustrating how to optionally print the number of
@@ -2760,7 +2791,7 @@
   { "weed",            DT_BOOL, R_NONE, OPTWEED, 1 },
   /*
   ** .pp
-  ** When set, mutt will weed headers when when displaying, forwarding,
+  ** When set, mutt will weed headers when displaying, forwarding,
   ** printing, or replying to messages.
   */
   { "wrap_search",     DT_BOOL, R_NONE, OPTWRAPSEARCH, 1 },
@@ -2790,7 +2821,7 @@
   /*
   ** .pp
   ** Controls whether mutt writes out the Bcc header when preparing
-  ** messages to be sent.  Exim users may wish to use this.
+  ** messages to be sent.  Exim users may wish to unset this.
   */
   /*--*/
   { NULL }
Index: main.c
===================================================================
RCS file: /home/roessler/cvs/mutt/main.c,v
retrieving revision 3.21
diff -u -u -r3.21 main.c
--- main.c      3 Feb 2005 17:01:43 -0000       3.21
+++ main.c      10 Feb 2005 00:15:48 -0000
@@ -111,8 +111,8 @@
   -e <command>\tspecify a command to be executed after initialization\n\
   -f <file>\tspecify which mailbox to read\n\
   -F <file>\tspecify an alternate muttrc file\n\
-  -H <file>\tspecify a draft file to read header from\n\
-  -i <file>\tspecify a file which Mutt should include in the reply\n\
+  -H <file>\tspecify a draft file to read header and body from\n\
+  -i <file>\tspecify a file which Mutt should include in the body\n\
   -m <type>\tspecify a default mailbox type\n\
   -n\t\tcauses Mutt not to read the system Muttrc\n\
   -p\t\trecall a postponed message\n\
Index: mbyte.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mbyte.c,v
retrieving revision 3.3
diff -u -u -r3.3 mbyte.c
--- mbyte.c     3 Feb 2005 17:01:43 -0000       3.3
+++ mbyte.c     10 Feb 2005 00:15:49 -0000
@@ -68,11 +68,11 @@
     Charset_is_utf8 = 1;
 #ifndef HAVE_WC_FUNCS
   else if (!strcmp(buffer, "euc-jp") || !strcmp(buffer, "shift_jis")
-       || !strcmp(buffer, "cp932"))
+       || !strcmp(buffer, "cp932") || !ascii_strcasecmp(buffer, "eucJP-ms"))
   {
     charset_is_ja = 1;
-    charset_to_utf8 = iconv_open ("UTF-8", charset);
-    charset_from_utf8 = iconv_open (charset, "UTF-8");
+    charset_to_utf8 = mutt_iconv_open ("UTF-8", charset, 0);
+    charset_from_utf8 = mutt_iconv_open (charset, "UTF-8", 0);
   }
 #endif
 
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.38
diff -u -u -r3.38 mutt.h
--- mutt.h      8 Feb 2005 17:23:50 -0000       3.38
+++ mutt.h      10 Feb 2005 00:15:49 -0000
@@ -630,6 +630,7 @@
                                 * If NULL, filename is used 
                                 * instead.
                                 */
+  char *file_charset;          /* charset of attached file */
   CONTENT *content;             /* structure used to store detailed info about
                                 * the content of the attachment.  this is used
                                 * to determine what content-transfer-encoding
Index: muttlib.c
===================================================================
RCS file: /home/roessler/cvs/mutt/muttlib.c,v
retrieving revision 3.26
diff -u -u -r3.26 muttlib.c
--- muttlib.c   3 Feb 2005 17:01:43 -0000       3.26
+++ muttlib.c   10 Feb 2005 00:15:49 -0000
@@ -933,11 +933,12 @@
 {
   char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch;
   char ifstring[SHORT_STRING], elsestring[SHORT_STRING];
-  size_t wlen, count, len;
+  size_t wlen, count, len, col, wid;
 
   prefix[0] = '\0';
   destlen--; /* save room for the terminal \0 */
   wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0;
+  col = wlen;
     
   while (*src && wlen < destlen)
   {
@@ -947,6 +948,7 @@
       {
        *wptr++ = '%';
        wlen++;
+       col++;
        src++;
        continue;
       }
@@ -1019,23 +1021,26 @@
        /* calculate space left on line.  if we've already written more data
           than will fit on the line, ignore the rest of the line */
        count = (COLS < destlen ? COLS : destlen);
-       if (count > wlen)
+       if (count > col)
        {
-         count -= wlen; /* how many chars left on this line */
+         count -= col; /* how many columns left on this line */
          mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);
          len = mutt_strlen (buf);
-         if (count > len)
+         wid = mutt_strwidth (buf);
+         if (count > wid)
          {
-           count -= len; /* how many chars to pad */
+           count -= wid; /* how many chars to pad */
            memset (wptr, ch, count);
            wptr += count;
            wlen += count;
+           col += count;
          }
          if (len + wlen > destlen)
            len = destlen - wlen;
          memcpy (wptr, buf, len);
          wptr += len;
          wlen += len;
+         col += mutt_strwidth (buf);
        }
        break; /* skip rest of input */
       }
@@ -1087,6 +1092,7 @@
        memcpy (wptr, buf, len);
        wptr += len;
        wlen += len;
+       col += mutt_strwidth (buf);
       }
     }
     else if (*src == '\\')
@@ -1117,11 +1123,13 @@
       src++;
       wptr++;
       wlen++;
+      col++;
     }
     else
     {
       *wptr++ = *src++;
       wlen++;
+      col++;
     }
   }
   *wptr = 0;
Index: pager.c
===================================================================
RCS file: /home/roessler/cvs/mutt/pager.c,v
retrieving revision 3.17
diff -u -u -r3.17 pager.c
--- pager.c     3 Feb 2005 17:01:43 -0000       3.17
+++ pager.c     10 Feb 2005 00:15:50 -0000
@@ -1710,15 +1710,17 @@
       CLEARLINE (statusoffset);
       if (IsHeader (extra))
       {
-       _mutt_make_string (buffer,
-                          COLS-9 < sizeof (buffer) ? COLS-9 : sizeof (buffer),
-                          NONULL (PagerFmt), Context, extra->hdr, 
M_FORMAT_MAKEPRINT);
+       size_t l1 = (COLS - 9) * MB_LEN_MAX;
+       size_t l2 = sizeof (buffer);
+       _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
+                          Context, extra->hdr, M_FORMAT_MAKEPRINT);
       }
       else if (IsMsgAttach (extra))
       {
-       _mutt_make_string (buffer,
-                          COLS - 9 < sizeof (buffer) ? COLS - 9: sizeof 
(buffer),
-                          NONULL (PagerFmt), Context, extra->bdy->hdr, 
M_FORMAT_MAKEPRINT);
+       size_t l1 = (COLS - 9) * MB_LEN_MAX;
+       size_t l2 = sizeof (buffer);
+       _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
+                          Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
       }
       mutt_paddstr (COLS-10, IsHeader (extra) || IsMsgAttach (extra) ?
                    buffer : banner);
Index: parse.c
===================================================================
RCS file: /home/roessler/cvs/mutt/parse.c,v
retrieving revision 3.14
diff -u -u -r3.14 parse.c
--- parse.c     3 Feb 2005 17:01:43 -0000       3.14
+++ parse.c     10 Feb 2005 00:15:50 -0000
@@ -213,9 +213,21 @@
 
       if (*s == '"')
       {
+       int state_ascii = 1;
        s++;
-       for (i=0; *s && *s != '"' && i < sizeof (buffer) - 1; i++, s++)
+       for (i=0; *s && i < sizeof (buffer) - 1; i++, s++)
        {
+         if (*s == 0x1b)
+         {
+           if (s[1] == '(' && (s[2] == 'B' || s[2] == 'J'))
+             state_ascii = 1;
+           else
+             state_ascii = 0;
+         }
+         if (state_ascii)
+         {
+           if (*s == '"')
+             break;
          if (*s == '\\')
          {
            /* Quote the next character */
@@ -226,6 +238,9 @@
          else
            buffer[i] = *s;
        }
+         else
+           buffer[i] = *s;
+       }
        buffer[i] = 0;
        if (*s)
          s++; /* skip over the " */
@@ -384,7 +399,10 @@
   if (ct->type == TYPETEXT)
   {
     if (!(pc = mutt_get_parameter ("charset", ct->parameter)))
-      mutt_set_parameter ("charset", "us-ascii", &ct->parameter);
+      mutt_set_parameter ("charset", (AssumedCharset && *AssumedCharset) ?
+                         (const char *) mutt_get_first_charset 
(AssumedCharset) :
+                         "us-ascii",
+                         &ct->parameter);
   }
 
 }
Index: rfc2047.c
===================================================================
RCS file: /home/roessler/cvs/mutt/rfc2047.c,v
retrieving revision 3.8
diff -u -u -r3.8 rfc2047.c
--- rfc2047.c   3 Feb 2005 17:01:44 -0000       3.8
+++ rfc2047.c   10 Feb 2005 00:15:50 -0000
@@ -733,6 +733,21 @@
     if (!(p = find_encoded_word (s, &q)))
     {
       /* no encoded words */
+      n = mutt_strlen (s);
+      if (AssumedCharset && *AssumedCharset)
+      {
+       char *t;
+       size_t tlen;
+
+       t = safe_malloc (n + 1);
+       strfcpy (t, s, n + 1);
+       mutt_convert_nomime_string (&t);
+       tlen = mutt_strlen (t);
+       strncpy (d, t, tlen); 
+       d += tlen;
+       FREE (&t);
+       break;
+      }
       strncpy (d, s, dlen);
       d += dlen;
       break;
@@ -770,7 +785,7 @@
 {
   while (a)
   {
-    if (a->personal && strstr (a->personal, "=?") != NULL)
+    if (a->personal)
       rfc2047_decode (&a->personal);
 #ifdef EXACT_ADDRESS
     if (a->val && strstr (a->val, "=?") != NULL)
Index: rfc2231.c
===================================================================
RCS file: /home/roessler/cvs/mutt/rfc2231.c,v
retrieving revision 3.5
diff -u -u -r3.5 rfc2231.c
--- rfc2231.c   3 Feb 2005 17:01:44 -0000       3.5
+++ rfc2231.c   10 Feb 2005 00:15:50 -0000
@@ -117,6 +117,8 @@
 
       if (option (OPTRFC2047PARAMS) && p->value && strstr (p->value, "=?"))
        rfc2047_decode (&p->value);
+      else if (AssumedCharset && *AssumedCharset)
+       mutt_convert_nomime_string (&p->value);
 
       *last = p;
       last = &p->next;
Index: sendlib.c
===================================================================
RCS file: /home/roessler/cvs/mutt/sendlib.c,v
retrieving revision 3.28
diff -u -u -r3.28 sendlib.c
--- sendlib.c   3 Feb 2005 17:01:44 -0000       3.28
+++ sendlib.c   10 Feb 2005 00:15:51 -0000
@@ -500,7 +500,7 @@
   }
 
   if (a->type == TYPETEXT && (!a->noconv))
-    fc = fgetconv_open (fpin, Charset, 
+    fc = fgetconv_open (fpin, a->file_charset, 
                        mutt_get_body_charset (send_charset, sizeof 
(send_charset), a),
                        0);
   else
@@ -900,6 +900,7 @@
   CONTENT *info;
   CONTENT_STATE state;
   FILE *fp = NULL;
+  char *fromcode;
   char *tocode;
   char buffer[100];
   char chsbuf[STRING];
@@ -934,15 +935,18 @@
   if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset))
   {
     char *chs = mutt_get_parameter ("charset", b->parameter);
+    char *fchs = b->use_disp ? ((FileCharset && *FileCharset) ?
+                                FileCharset : Charset) : Charset;
     if (Charset && (chs || SendCharset) &&
-       convert_file_from_to (fp, Charset, chs ? chs : SendCharset,
-                             0, &tocode, info) != (size_t)(-1))
+       convert_file_from_to (fp, fchs, chs ? chs : SendCharset,
+                             &fromcode, &tocode, info) != (size_t)(-1))
     {
       if (!chs)
       {
        mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode);
        mutt_set_parameter ("charset", chsbuf, &b->parameter);
       }
+      b->file_charset = fromcode;
       FREE (&tocode);
       safe_fclose (&fp);
       return info;
@@ -1322,6 +1326,7 @@
   body->unlink = 1;
   body->use_disp = 0;
   body->disposition = DISPINLINE;
+  body->noconv = 1;
 
   mutt_parse_mime_message (ctx, hdr);
 
Index: doc/manual.sgml.head
===================================================================
RCS file: /home/roessler/cvs/mutt/doc/manual.sgml.head,v
retrieving revision 3.35
diff -u -u -r3.35 manual.sgml.head
--- doc/manual.sgml.head        15 Jan 2005 07:36:37 -0000      3.35
+++ doc/manual.sgml.head        10 Feb 2005 00:15:52 -0000
@@ -56,8 +56,8 @@
 <sect1>IRC
 <p>
 Visit channel <em/#mutt/ on <htmlurl
-url="http://www.openprojects.net"; name="OpenProjects.Net
-(www.openprojects.net)"> to chat with other people interested in Mutt.
+url="http://www.freenode.net/"; name="irc.freenode.net
+(www.freenode.net)"> to chat with other people interested in Mutt.
 
 <sect1>USENET
 <p>
@@ -411,7 +411,7 @@
 <p><bf/list-reply/<label id="list-reply"> (default: L)<newline>
 
 Reply to the current or tagged message(s) by extracting any addresses which
-match the addresses given by the <ref id="lists" name="lists or subscribe">
+match the regular expressions given by the <ref id="lists" name="lists or 
subscribe">
 commands, but also honor any <tt/Mail-Followup-To/ header(s) if the
 <ref id="honor_followup_to" name="&dollar;honor&lowbar;followup&lowbar;to">
 configuration variable is set.  Using this when replying to messages posted
@@ -1182,7 +1182,7 @@
 sent to a different party, mutt will automatically suggest to send
 the response to the original message's recipients -- responding to
 yourself won't make much sense in many cases.  (See <ref
-id="reply_to" name="&dollar;reply_to">.)
+id="reply_to" name="&dollar;reply&lowbar;to">.)
 
 Many users receive e-mail under a number of different addresses. To
 fully use mutt's features here, the program must be able to
@@ -1211,7 +1211,7 @@
 supported by all mail user agents.  Adding it is not bullet-proof against
 receiving personal CCs of list messages.  Also note that the generation
 of the Mail-Followup-To header is controlled by the <ref id="followup_to"
-name="&dollar;followup_to"> configuration variable.
+name="&dollar;followup&lowbar;to"> configuration variable.
 
 More precisely, Mutt maintains lists of patterns for the addresses
 of known and subscribed mailing lists.  Every subscribed mailing
@@ -1231,8 +1231,8 @@
 initialization file.  To tell mutt that you are subscribed to it,
 add ``subscribe mutt-users'' to your initialization file instead.
 If you also happen to get mail from someone whose address is
-<em/mutt-users@xxxxxxxxxxx/, you could use ``lists mutt-users@xxxxxxxx'' 
-or ``subscribe mutt-users@xxxxxxxx'' to
+<em/mutt-users@xxxxxxxxxxx/, you could use ``lists 
mutt-users@mutt&bsol;&bsol;.org'' 
+or ``subscribe mutt-users@mutt&bsol;&bsol;.org'' to
 match only mail from the actual list.
 
 The ``unlists'' command is used to remove a token from the list of
@@ -1375,7 +1375,7 @@
 
 See <ref id="pattern_hook" name="Message Matching in Hooks"> for information 
on the exact format of <em/pattern/.
 
-Example: <tt/fcc-hook aol.com&dollar; +spammers/
+Example: <tt/fcc-hook &lsqb;@.&rsqb;aol&bsol;&bsol;.com&dollar; +spammers/
 
 The above will save a copy of all messages going to the aol.com domain to
 the `+spammers' mailbox by default.  Also see the <ref id="fcc-save-hook" 
@@ -2104,7 +2104,7 @@
 
 <tscreen><verb>
 send-hook . 'unmy_hdr From:'
-send-hook ~Cb@xxx my_hdr from: c@xxx
+send-hook ~C'^b@b\.b$' my_hdr from: c@xxx
 </verb></tscreen>
 
 <sect2>Message Matching in Hooks<label id="pattern_hook">
@@ -2298,10 +2298,11 @@
 to reply directly to the author in private, since most mail clients
 will automatically reply to the address given in the ``Reply-To''
 field.  Mutt uses the <ref id="reply_to" name="&dollar;reply&lowbar;to">
-variable to help decide which address to use.  If set, you will be
+variable to help decide which address to use.  If set to <em/ask-yes/ or
+<em/ask-no/, you will be
 prompted as to whether or not you would like to use the address given in
 the ``Reply-To'' field, or reply directly to the address given in the
-``From'' field.  When unset, the ``Reply-To'' field will be used when
+``From'' field.  When set to <em/yes/, the ``Reply-To'' field will be used when
 present.
 
 The ``X-Label:'' header field can be used to further identify mailing
Index: doc/manual.sgml.tail
===================================================================
RCS file: /home/roessler/cvs/mutt/doc/manual.sgml.tail,v
retrieving revision 3.3
diff -u -u -r3.3 manual.sgml.tail
--- doc/manual.sgml.tail        19 Nov 2004 16:16:51 -0000      3.3
+++ doc/manual.sgml.tail        10 Feb 2005 00:15:53 -0000
@@ -45,6 +45,7 @@
 tag-prefix                 ;   apply next command to tagged entries
 tag-prefix-cond    not bound   apply next function ONLY to tagged messages
 top-page                   H   move to the top of the page
+what-key           not bound   display the keycode for a key press
 </verb>
 <sect2>index
 <p>
Index: imap/message.c
===================================================================
RCS file: /home/roessler/cvs/mutt/imap/message.c,v
retrieving revision 3.16
diff -u -u -r3.16 message.c
--- imap/message.c      3 Feb 2005 17:01:44 -0000       3.16
+++ imap/message.c      10 Feb 2005 00:15:53 -0000
@@ -556,7 +556,10 @@
   rewind (fp);
   
   imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
-  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%lu}", mbox, (unsigned 
long)len);
+  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen%s%s) {%lu}", mbox,
+           msg->flags.replied ? " \\Answered" : "",
+           msg->flags.flagged ? " \\Flagged" : "",
+           (unsigned long) len);
 
   imap_cmd_start (idata, buf);
 
Index: imap/util.c
===================================================================
RCS file: /home/roessler/cvs/mutt/imap/util.c,v
retrieving revision 3.8
diff -u -u -r3.8 util.c
--- imap/util.c 5 Feb 2005 14:11:36 -0000       3.8
+++ imap/util.c 10 Feb 2005 00:15:53 -0000
@@ -271,6 +271,7 @@
  * in IMAP.  Additionally, the filesystem converts multiple hierarchy
  * delimiters into a single one, ie "///" is equal to "/".  IMAP servers
  * are not required to do this.
+ * Moreover, IMAP servers may dislike the path ending with the delimiter.
  */
 char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, 
     size_t plen)
@@ -297,6 +298,8 @@
     }
     x++;
   }
+  if (x && path[--x] != idata->delim)
+    x++;
   path[x] = '\0';
   return path;
 }