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.

56 QUOTED-PRINTABLE MIME DECODER ANNOYANCE-FILTER §58<br />

58. Quoted-Printable MIME decoder.<br />

<strong>The</strong> quotedPrintableMIMEdecoder decodes an input stream encoded as MIME “Quoted-Printable”<br />

per RFC 1521. This is based on my stand-alone Quoted-Printable decoder.<br />

〈 Class definitions 10 〉 +≡<br />

class quotedPrintableMIMEdecoder : public MIMEdecoder {<br />

public:<br />

quotedPrintableMIMEdecoder( )<br />

{<br />

atEndOfLine = false ;<br />

}<br />

string name (void) const<br />

{<br />

return "Quoted−Printable";<br />

}<br />

int getDecodedChar (void);<br />

static string decodeEscapedText (const string s, mailFolder ∗m = Λ);<br />

protected:<br />

bool atEndOfLine ;<br />

int getNextChar (void);<br />

static int hex to nybble (const int ch );<br />

};<br />

59. Get the next decoded character from the stream, expanding “=” escape sequences.<br />

〈 Class implementations 11 〉 +≡<br />

int quotedPrintableMIMEdecoder ::getDecodedChar (void)<br />

{<br />

int ch ;<br />

}<br />

〈 Check for look ahead character 55 〉;<br />

while (true ) {<br />

ch = getNextChar ( );<br />

if (ch ≡ ’=’) {<br />

〈 Decode equal sign escape 60 〉;<br />

}<br />

else {<br />

return ch ;<br />

}<br />

}

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

Saved successfully!

Ooh no, something went wrong!