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.

178 POP3 PROXY SERVER IMPLEMENTATION ANNOYANCE-FILTER §217<br />

217. POP3 proxy server implementation.<br />

Using the POP3Proxy class defined above, the following code actually provides the proxying for<br />

annoyance−filter, including running filtering retrieved messages and returning them to the client<br />

annotated with their classification.<br />

218. This is the entire proxy server! It is invoked by the main program after processing command<br />

line options if popProxyServer has been set. It creates a POP3Proxy with the specified arguments<br />

and puts it to work. <strong>The</strong>re is no escape from here except through catastrophic circumstances.<br />

〈 Operate POP3 proxy server, filtering replies 218 〉 ≡<br />

if (dict .empty ( ) ∧ (¬fDict .isDictionaryLoaded ( ))) {<br />

cerr ≪ "You␣cannot␣operate␣a␣−−pop3proxy␣server␣""unless␣you␣have␣fir\<br />

st␣loaded␣a␣dictionary." ≪ endl ;<br />

return 1;<br />

}<br />

if (verbose ) {<br />

cerr ≪ "Starting␣POP3␣proxy␣server␣on␣port␣" ≪ popProxyPort ≪ "␣with␣server␣" ≪<br />

popProxyServer ≪ ":" ≪ popProxyServerPort ≪ endl ;<br />

}<br />

POP3Proxy pp(popProxyPort , popProxyServer , popProxyServerPort , &pop<strong>Filter</strong> );<br />

pp.operateProxyServer ( );<br />

This code is used in section 223.

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

Saved successfully!

Ooh no, something went wrong!