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.

108 MAIL FOLDER ANNOYANCE-FILTER §129<br />

129. Mail folder.<br />

<strong>The</strong> mailFolder class returns successive lines from a mail folder bound to an input stream.<br />

〈 Class definitions 10 〉 +≡<br />

〈 Configure compression suffix and command 132 〉<br />

class mailFolder {<br />

public:<br />

istream ∗is ; /∗ Stream to read mail folder from ∗/<br />

dictionaryWord ::mailCategory category ; /∗ Category (Mail or Junk) ∗/<br />

unsigned int nLines ; /∗ Number of lines in folder ∗/<br />

unsigned int nMessages ; /∗ Number of messages read so far ∗/<br />

bool newMessage ; /∗ On first line of new message ? ∗/<br />

bool expectingNewMessage ; /∗ Expecting start of new message ? ∗/<br />

bool lastLineBlank ; /∗ Was last line in mail folder blank ? ∗/<br />

bool BSDfolder ; /∗ Mail folder uses “pure BSD” message boundary semantics ∗/<br />

bool inHeader ; /∗ Within message header section ∗/<br />

string lookAheadLine ; /∗ Line to save look ahead while parsing headers ∗/<br />

bool lookedAhead ; /∗ Have we a look ahead line ? ∗/<br />

ifstream isc; /∗ Input stream for (possibly compressed) input file ∗/<br />

#if defined (COMPRESSED_FILES) ∧ defined (HAVE_FDSTREAM_COMPATIBILITY)<br />

fdistream iscc; /∗ Pipe input stream to read compressed input file ∗/<br />

#endif<br />

string fromLine ; /∗ “From␣” line for diagnostics ∗/<br />

string messageID ; /∗ Message ID for diagnostics ∗/<br />

string lastFromLine ; /∗ Last “From␣” line shown in diagnostics ∗/<br />

string lastMessageID ; /∗ Last message ID shown in disgnostics ∗/<br />

/∗ Compressed file decoding ∗/<br />

#if defined (COMPRESSED_FILES) ∨ defined (HAVE_DIRECTORY_TRAVERSAL)<br />

FILE ∗ip; /∗ File handle used for popen pile to decompressor ∗/<br />

#endif<br />

#ifdef HAVE_DIRECTORY_TRAVERSAL /∗ Directory traversal ∗/<br />

bool dirFolder ; /∗ Are we reading a directory folder ? ∗/<br />

DIR ∗ dh ; /∗ Handle for readdir ∗/<br />

string dirName , cfName ; /∗ Directory name and current file name in directory ∗/<br />

string pathSeparator ; /∗ System path separator ∗/<br />

#ifdef HAVE_FDSTREAM_COMPATIBILITY<br />

fdistream ifcdir ; /∗ Stream to read compressed file in directory ∗/<br />

#endif<br />

ifstream ifdir ; /∗ Stream to read file in directory ∗/<br />

istringstream nullstream ; /∗ Null stream for empty directory case ∗/<br />

#endif /∗ Body encoding properties ∗/<br />

string bodyContentType ; /∗ Content−Type ∗/<br />

string bodyContentTypeCharset ; /∗ charset= ∗/<br />

string bodyContentTypeName ; /∗ name= ∗/<br />

string bodyContentTransferEncoding ; /∗ Content−Transfer−Encoding ∗/<br />

/∗ MIME multi-part separators and status ∗/<br />

string partBoundary ; /∗ Mime part boundary sentinel ∗/<br />

bool multiPart ; /∗ Is message MIME multi-part ? ∗/<br />

bool inPartHeader ; /∗ In MIME part header ? ∗/<br />

unsigned int partHeaderLines ; /∗ Number of lines in part header ∗/

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

Saved successfully!

Ooh no, something went wrong!