12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

118 MAIL FOLDER ANNOYANCE-FILTER §135<br />

135. Some mail systems define mail folders as directories containing individual messages as files. If<br />

the folder name is in fact a directory, set up to retrieve the contents of all the files it contains logically<br />

concatenated.<br />

〈 Check whether folder is a directory of messages 135 〉 ≡<br />

#ifdef HAVE_DIRECTORY_TRAVERSAL<br />

dirFolder = false ;<br />

struct stat fs ;<br />

if ((stat (fname .c str ( ), &fs ) ≡ 0) ∧ S_ISDIR(fs .st mode )) {<br />

dh = opendir (fname .c str ( ));<br />

if (dh ≠ Λ) {<br />

dirFolder = true ;<br />

dirName = fname ;<br />

pathSeparator = ’/’; /∗ Should detect in configuration process ∗/<br />

if (¬findNextFileInDirectory (fname )) {<br />

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

is = &nullstream ; /∗ Doooh!!! No mail messages in directory ∗/<br />

}<br />

else {<br />

if (verbose ) {<br />

cerr ≪ "Processing␣files␣from␣directory␣\"" ≪ dirName ≪ "\"." ≪ endl ;<br />

}<br />

}<br />

}<br />

else {<br />

cerr ≪ "Cannot␣open␣mail␣folder␣directory␣\"" ≪ fname ≪ "\"" ≪ endl ;<br />

exit (1);<br />

}<br />

}<br />

#endif<br />

This code is cited in section 256.<br />

This code is used in section 129.

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

Saved successfully!

Ooh no, something went wrong!