blob: 8065fd908715e39d8332e1643b8da2652bd81bdd (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 | /*
** Copyright 2002-2004, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#include "libmail_config.h"
#include "misc.H"
#include "autodecoder.H"
using namespace std;
mail::autodecoder::base64::base64(mail::autodecoder &meArg)
	: me(meArg)
{
}
mail::autodecoder::base64::~base64()
{
}
void mail::autodecoder::base64::decoded(string s)
{
	me.decoded(s);
}
mail::autodecoder::qp::qp(mail::autodecoder &meArg)
	: me(meArg)
{
}
mail::autodecoder::qp::~qp()
{
}
void mail::autodecoder::qp::decoded(string s)
{
	me.decoded(s);
}
//////////////////////////////////////////////////////////////////////
mail::autodecoder::autodecoder(string cte)
	: base64Decoder(*this),
	  qpDecoder(*this),
	  decoder(NULL)
{
	mail::upper(cte);
	if (cte == "QUOTED-PRINTABLE")
		decoder= &qpDecoder;
	if (cte == "BASE64")
		decoder= &base64Decoder;
}
mail::autodecoder::~autodecoder()
{
}
void mail::autodecoder::decode(string s)
{
	if (decoder)
		decoder->decode(s);	// 7bit or 8bit, or something...
	else
		decoded(s);
}
 |