- ENVELOPE *e = envelope_new();
- LIST *last = NULL;
- char *line = p_new(char, LONG_STRING);
- char *p;
- off_t loc;
- int matched;
- ssize_t linelen = LONG_STRING;
- char buf[LONG_STRING + 1];
-
- if (hdr) {
- if (hdr->content == NULL) {
- hdr->content = mutt_new_body ();
-
- /* set the defaults from RFC1521 */
- hdr->content->type = TYPETEXT;
- hdr->content->subtype = m_strdup("plain");
- hdr->content->encoding = ENC7BIT;
- hdr->content->length = -1;
-
- /* RFC 2183 says this is arbitrary */
- hdr->content->disposition = DISPINLINE;
- }
- }
-
- while ((loc = ftello (f)),
- mutt_read_rfc822_line (f, &line, &linelen))
- {
- matched = 0;
-
- if ((p = strpbrk (line, ": \t")) == NULL || *p != ':') {
- char return_path[LONG_STRING];
- time_t t;
-
- /* some bogus MTAs will quote the original "From " line */
- if (m_strncmp(">From ", line, 6) == 0)
- continue; /* just ignore */
- else if (is_from (line, return_path, sizeof (return_path), &t)) {
- /* MH somtimes has the From_ line in the middle of the header! */
- if (hdr && !hdr->received)
- hdr->received = t - mutt_local_tz (t);
- continue;
- }
-
- fseeko (f, loc, 0);
- break; /* end of header */
- }