+ while ((loc = ftello(f)),
+ mutt_read_rfc822_line(f, &line, &linelen))
+ {
+ char buf[LONG_STRING + 1] = "";
+ char *p;
+
+ p = strpbrk(line, ": \t");
+ if (!p || *p != ':') {
+ char return_path[LONG_STRING];
+ time_t t;
+
+ /* some bogus MTAs will quote the original "From " line */
+ if (!m_strncmp(">From ", line, 6))
+ continue; /* just ignore */
+
+ 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 */
+ }
+
+ if (mutt_match_spam_list(line, SpamList, buf, sizeof(buf))) {
+ if (!rx_list_match(NoSpamList, line)) {
+ /* if spam tag already exists, figure out how to amend it */
+ if (e->spam && *buf) {
+ if (SpamSep) {
+ /* If SpamSep defined, append with separator */
+ mutt_buffer_addstr(e->spam, SpamSep);
+ mutt_buffer_addstr(e->spam, buf);
+ } else {
+ /* else overwrite */
+ mutt_buffer_reset(e->spam);
+ mutt_buffer_addstr(e->spam, buf);
+ }
+ }
+ else if (!e->spam && *buf) {
+ /* spam tag is new, and match expr is non-empty; copy */
+ e->spam = mutt_buffer_from(NULL, buf);
+ }
+ else if (!e->spam) {
+ /* match expr is empty; plug in null string if no existing tag */
+ e->spam = mutt_buffer_from(NULL, "");
+ }
+ }
+ }