12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

§169 ANNOYANCE-FILTER MAIL FOLDER 141<br />

169. When we detect an error within the message, it’s reported to standard error if we’re in verbose<br />

mode and appended to the parserDiagnostics for inclusion in the transcript if the “p” annotation<br />

is selected. This method is public so higher-level parsing routines can use it to append their own<br />

diagnostics. Since in many cases we compose the diagnostic in an ostringstream, we overload a<br />

variant which accepts one directly as an argument.<br />

〈 Class implementations 11 〉 +≡<br />

void mailFolder ::reportParserDiagnostic(const string s)<br />

{<br />

if (verbose ) {<br />

if ((lastFromLine ≠ fromLine ) ∨ (lastMessageID ≠ messageID )) {<br />

cerr ≪ fromLine ≪ endl ;<br />

if (messageID ≠ "") {<br />

cerr ≪ "Message−ID:␣" ≪ messageID ≪ ":" ≪ endl ;<br />

}<br />

lastFromLine = fromLine ;<br />

lastMessageID = messageID ;<br />

}<br />

cerr ≪ "␣␣␣␣" ≪ s ≪ endl ;<br />

}<br />

if (Annotate (’p’) ∨ Annotate (’d’)) {<br />

parserDiagnostics .push (s);<br />

}<br />

}<br />

void mailFolder ::reportParserDiagnostic(const ostringstream &os )<br />

{<br />

reportParserDiagnostic(os .str ( ));<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!