author | alwin <alwin> | 2004-01-04 01:53:04 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-04 01:53:04 (UTC) |
commit | 6fd109ed595e4e28f49f5de0a26e9f9445e672f6 (patch) (unidiff) | |
tree | 4bbd79045d003701bd6bdd649b1057fee9549fc6 /noncore/net/mail/abstractmail.cpp | |
parent | 4c9f71fba68fcf98b0b4c9b14b699282dfe962e5 (diff) | |
download | opie-6fd109ed595e4e28f49f5de0a26e9f9445e672f6.zip opie-6fd109ed595e4e28f49f5de0a26e9f9445e672f6.tar.gz opie-6fd109ed595e4e28f49f5de0a26e9f9445e672f6.tar.bz2 |
moved to shared lib for usage with tody and taskbar plugin
Diffstat (limited to 'noncore/net/mail/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/abstractmail.cpp | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/noncore/net/mail/abstractmail.cpp b/noncore/net/mail/abstractmail.cpp deleted file mode 100644 index f303d72..0000000 --- a/noncore/net/mail/abstractmail.cpp +++ b/dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | #include "abstractmail.h" | ||
2 | #include "imapwrapper.h" | ||
3 | #include "pop3wrapper.h" | ||
4 | #include "mboxwrapper.h" | ||
5 | #include "mailtypes.h" | ||
6 | |||
7 | #include <qstring.h> | ||
8 | #include <qfile.h> | ||
9 | #include <qtextstream.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <libetpan/mailmime_content.h> | ||
12 | #include <libetpan/mailmime.h> | ||
13 | |||
14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | ||
15 | { | ||
16 | return new IMAPwrapper(a); | ||
17 | } | ||
18 | |||
19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | ||
20 | { | ||
21 | return new POP3wrapper(a); | ||
22 | } | ||
23 | |||
24 | AbstractMail* AbstractMail::getWrapper(const QString&a) | ||
25 | { | ||
26 | return new MBOXwrapper(a); | ||
27 | } | ||
28 | |||
29 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | ||
30 | { | ||
31 | qDebug("Decode string start"); | ||
32 | char*result_text; | ||
33 | size_t index = 0; | ||
34 | /* reset for recursive use! */ | ||
35 | size_t target_length = 0; | ||
36 | result_text = 0; | ||
37 | int mimetype = MAILMIME_MECHANISM_7BIT; | ||
38 | if (enc.lower()=="quoted-printable") { | ||
39 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | ||
40 | } else if (enc.lower()=="base64") { | ||
41 | mimetype = MAILMIME_MECHANISM_BASE64; | ||
42 | } else if (enc.lower()=="8bit") { | ||
43 | mimetype = MAILMIME_MECHANISM_8BIT; | ||
44 | } else if (enc.lower()=="binary") { | ||
45 | mimetype = MAILMIME_MECHANISM_BINARY; | ||
46 | } | ||
47 | |||
48 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | ||
49 | &result_text,&target_length); | ||
50 | |||
51 | encodedString* result = new encodedString(); | ||
52 | if (err == MAILIMF_NO_ERROR) { | ||
53 | result->setContent(result_text,target_length); | ||
54 | } | ||
55 | qDebug("Decode string finished"); | ||
56 | return result; | ||
57 | } | ||
58 | |||
59 | QString AbstractMail::convert_String(const char*text) | ||
60 | { | ||
61 | size_t index = 0; | ||
62 | char*res = 0; | ||
63 | |||
64 | /* attention - doesn't work with arm systems! */ | ||
65 | int err = mailmime_encoded_phrase_parse("iso-8859-1", | ||
66 | text, strlen(text),&index, "iso-8859-1",&res); | ||
67 | if (err != MAILIMF_NO_ERROR) { | ||
68 | if (res) free(res); | ||
69 | return QString(text); | ||
70 | } | ||
71 | if (res) { | ||
72 | QString result(res); | ||
73 | free(res); | ||
74 | return result; | ||
75 | } | ||
76 | return QString(text); | ||
77 | } | ||
78 | |||
79 | /* cp & paste from launcher */ | ||
80 | QString AbstractMail::gen_attachment_id() | ||
81 | { | ||
82 | QFile file( "/proc/sys/kernel/random/uuid" ); | ||
83 | if (!file.open(IO_ReadOnly ) ) | ||
84 | return QString::null; | ||
85 | |||
86 | QTextStream stream(&file); | ||
87 | |||
88 | return "{" + stream.read().stripWhiteSpace() + "}"; | ||
89 | } | ||
90 | |||
91 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||