X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=parse.c;h=6a076540807c683bcfc9944b6df2279e17c4ae72;hp=939fc35ee691f3be2d72d57d3f40e8bc7de22b99;hb=4ff362c6b720c1ae7c6fde8300567644905bd923;hpb=46cc2f0fc3459400d3c7d4dad7a1fbb952cadd46 diff --git a/parse.c b/parse.c index 939fc35..6a07654 100644 --- a/parse.c +++ b/parse.c @@ -213,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 */ @@ -384,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); } } @@ -1041,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