summaryrefslogtreecommitdiff
path: root/noncore/net/mail/abstractmail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/abstractmail.cpp94
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
14AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
15{
16 return new IMAPwrapper(a);
17}
18
19AbstractMail* AbstractMail::getWrapper(POP3account *a)
20{
21 return new POP3wrapper(a);
22}
23
24AbstractMail* AbstractMail::getWrapper(const QString&a)
25{
26 return new MBOXwrapper(a);
27}
28
29encodedString* 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
59QString 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 */
80QString 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
91int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool)
92{
93 return 0;
94}