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.

§157 ANNOYANCE-FILTER MAIL FOLDER 133<br />

157. Test for Content-Types we are never interested in parsing, regardless of their encoding. This<br />

includes images, video, and most application specific files which UNIX strings would make no sense<br />

of. <strong>The</strong>se parts are dispatched to the sink decoder for disposal. Note that some of these items may<br />

be compressed files and/or archives (zip, gzip, tar, etc.) which might be comprehensible if we could<br />

enlist the appropriate utilities, but we’ll defer that refinement for now.<br />

〈 Test for Content-Types we always ignore 157 〉 ≡<br />

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

ostringstream os ;<br />

reportParserDiagnostic("");<br />

os ≪ "mimeContentType:␣{" ≪ mimeContentType ≪ "}";<br />

reportParserDiagnostic(os );<br />

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

os ≪ "mimeContentTypeCharset:␣{" ≪ mimeContentTypeCharset ≪ "}";<br />

reportParserDiagnostic(os );<br />

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

os ≪ "mimeContentTransferEncoding:␣{" ≪ mimeContentTransferEncoding ≪ "}";<br />

reportParserDiagnostic(os );<br />

}<br />

if ((asp ≡ Λ) ∧ (mimeContentType .substr (0, 6) ≡ "image/") ∨ (mimeContentType .substr (0,<br />

6) ≡ "video/")) {<br />

smd .set(is , this, partBoundary , tlist );<br />

mdp = &smd ;<br />

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

ostringstream os ;<br />

}<br />

os ≪ "Activating␣MIME␣sink␣decoder␣with␣sentinel:␣\"" ≪ partBoundary ≪<br />

"\"␣due␣to␣Content−Type␣=␣" ≪ mimeContentType ;<br />

reportParserDiagnostic(os );<br />

}<br />

if (dlist ) {<br />

dlist ⃗ push back (Xfile + "−Decoder:␣Sink");<br />

}<br />

This code is used in section 153.<br />

158. Next, check for content types we’re always interested parsing. This includes most forms labeled<br />

as text and embedded mail messages. If the content is of interest but is encoded, make sure we have<br />

the requisite decoder and, if so, plumb it into the pipeline.<br />

〈 Process Content-Types we are interested in parsing 158 〉 ≡<br />

else<br />

if (byteStream ∨ (asp ≠ Λ) ∨ (mimeContentType ≡ "plain/txt") ∨ (mimeContentType .substr (0,<br />

5) ≡ "text/") ∨ (mimeContentType ≡ "message/rfc822")) {<br />

〈 Test for multiple byte character sets and activate decoder if available 159 〉;<br />

〈 Verify Content-Transfer-Encoding and activate decoder if necessary 160 〉;<br />

〈 Cancel byte stream interpretation for non-binary encoded parts 161 〉;<br />

〈 Test for message/rfc822 embedded as part 162 〉;<br />

}<br />

This code is used in section 153.

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

Saved successfully!

Ooh no, something went wrong!