fix bug with bad message "From " delimiter detection

This commit is contained in:
dockes 2006-12-07 07:06:28 +00:00
parent 290a7272be
commit d5745bdb83

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: mh_mail.cpp,v 1.21 2006-12-05 15:25:17 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: mh_mail.cpp,v 1.22 2006-12-07 07:06:28 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -173,22 +173,23 @@ MimeHandlerMail::processmbox(const string &fn, Rcl::Doc &docout, string& ipath)
iseof = true; iseof = true;
break; break;
} }
if (line[0] == '\n') {
hademptyline = true;
continue;
}
if (hademptyline && !regexec(&fromregex, line, 0, 0, 0)) { if (hademptyline && !regexec(&fromregex, line, 0, 0, 0)) {
break; break;
} }
if (mtarg <= 0 || m_msgnum == mtarg) { if (mtarg <= 0 || m_msgnum == mtarg) {
msgtxt += line; msgtxt += line;
} }
hademptyline = false; if (line[0] == '\n') {
hademptyline = true;
} else {
hademptyline = false;
}
} }
fseek(fp, end, SEEK_SET); fseek(fp, end, SEEK_SET);
} while (mtarg > 0 && m_msgnum < mtarg); } while (mtarg > 0 && m_msgnum < mtarg);
stringstream s(msgtxt); stringstream s(msgtxt);
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
Binc::MimeDocument doc; Binc::MimeDocument doc;
doc.parseFull(s); doc.parseFull(s);
if (!doc.isHeaderParsed() && !doc.isAllParsed()) { if (!doc.isHeaderParsed() && !doc.isAllParsed()) {
@ -196,9 +197,9 @@ MimeHandlerMail::processmbox(const string &fn, Rcl::Doc &docout, string& ipath)
fn.c_str())); fn.c_str()));
return MimeHandler::MHError; return MimeHandler::MHError;
} }
LOGDEB2(("Calling processMsg with msgnum %d\n", m_msgnum));
MimeHandler::Status ret = processMsg(docout, doc, 0); MimeHandler::Status ret = processMsg(docout, doc, 0);
LOGDEB2(("msgnum %d: [%s]\n", m_msgnum, docout.text.c_str()));
if (ret == MimeHandler::MHError) if (ret == MimeHandler::MHError)
return ret; return ret;
char buf[20]; char buf[20];