X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=parse.c;h=6a076540807c683bcfc9944b6df2279e17c4ae72;hp=bb1ab2a9880599bde72917be6e570d9487d36d16;hb=b661011c5210796beaf103676c0d24b87f1a2787;hpb=3d937534e7b1ee723f86594b5e4c64c95158a933 diff --git a/parse.c b/parse.c index bb1ab2a..6a07654 100644 --- a/parse.c +++ b/parse.c @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "mutt_regex.h" #include "mailbox.h" @@ -209,9 +213,23 @@ static PARAMETER *parse_parameters (const char *s) 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 (!option (OPTSTRICTMIME)) { + /* As iso-2022-* has a characer of '"' with non-ascii state, + * ignore it. */ + if (*s == 0x1b && i < sizeof (buffer) - 2) + { + if (s[1] == '(' && (s[2] == 'B' || s[2] == 'J')) + state_ascii = 1; + else + state_ascii = 0; + } + } + if (state_ascii && *s == '"') + break; if (*s == '\\') { /* Quote the next character */ @@ -380,7 +398,9 @@ void mutt_parse_content_type (char *s, BODY *ct) if (ct->type == TYPETEXT) { if (!(pc = mutt_get_parameter ("charset", ct->parameter))) - mutt_set_parameter ("charset", "us-ascii", &ct->parameter); + mutt_set_parameter ("charset", option (OPTSTRICTMIME) ? "us-ascii" : + (const char *) mutt_get_first_charset (AssumedCharset), + &ct->parameter); } } @@ -1037,6 +1057,15 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short if (!ascii_strcasecmp ("rom", line + 1)) { e->from = rfc822_parse_adrlist (e->from, p); + /* don't leave from info NULL if there's an invalid address (or + * whatever) in From: field; mutt would just display it as empty + * and mark mail/(esp.) news article as your own. aaargh! this + * bothered me for _years_ */ + if (!e->from) + { + e->from = rfc822_new_address (); + e->from->personal = safe_strdup (line+6); + } matched = 1; } #ifdef USE_NNTP @@ -1447,6 +1476,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs, rfc2047_decode_adrlist (e->from); rfc2047_decode_adrlist (e->to); rfc2047_decode_adrlist (e->cc); + rfc2047_decode_adrlist (e->bcc); rfc2047_decode_adrlist (e->reply_to); rfc2047_decode_adrlist (e->mail_followup_to); rfc2047_decode_adrlist (e->return_path);