summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/abstractmail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/abstractmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 592cd5e..741a8e1 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -1,36 +1,42 @@
1#include "abstractmail.h" 1#include "abstractmail.h"
2#include "imapwrapper.h" 2#include "imapwrapper.h"
3#include "pop3wrapper.h" 3#include "pop3wrapper.h"
4#include "nntpwrapper.h"
4#include "mhwrapper.h" 5#include "mhwrapper.h"
5#include "mboxwrapper.h" 6#include "mboxwrapper.h"
6#include "mailtypes.h" 7#include "mailtypes.h"
7 8
8#include <qstring.h> 9#include <qstring.h>
9#include <qfile.h> 10#include <qfile.h>
10#include <qtextstream.h> 11#include <qtextstream.h>
11#include <stdlib.h> 12#include <stdlib.h>
12#include <libetpan/mailmime_content.h> 13#include <libetpan/mailmime_content.h>
13#include <libetpan/mailmime.h> 14#include <libetpan/mailmime.h>
14 15
15AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 16AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
16{ 17{
17 return new IMAPwrapper(a); 18 return new IMAPwrapper(a);
18} 19}
19 20
20AbstractMail* AbstractMail::getWrapper(POP3account *a) 21AbstractMail* AbstractMail::getWrapper(POP3account *a)
21{ 22{
22 return new POP3wrapper(a); 23 return new POP3wrapper(a);
23} 24}
24 25
26AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
27{
28 return new NNTPwrapper(a);
29}
30
25AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) 31AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
26{ 32{
27 return new MHwrapper(a,name); 33 return new MHwrapper(a,name);
28} 34}
29 35
30encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 36encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
31{ 37{
32 qDebug("Decode string start"); 38 qDebug("Decode string start");
33 char*result_text; 39 char*result_text;
34 size_t index = 0; 40 size_t index = 0;
35 /* reset for recursive use! */ 41 /* reset for recursive use! */
36 size_t target_length = 0; 42 size_t target_length = 0;
@@ -39,38 +45,38 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
39 if (enc.lower()=="quoted-printable") { 45 if (enc.lower()=="quoted-printable") {
40 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 46 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
41 } else if (enc.lower()=="base64") { 47 } else if (enc.lower()=="base64") {
42 mimetype = MAILMIME_MECHANISM_BASE64; 48 mimetype = MAILMIME_MECHANISM_BASE64;
43 } else if (enc.lower()=="8bit") { 49 } else if (enc.lower()=="8bit") {
44 mimetype = MAILMIME_MECHANISM_8BIT; 50 mimetype = MAILMIME_MECHANISM_8BIT;
45 } else if (enc.lower()=="binary") { 51 } else if (enc.lower()=="binary") {
46 mimetype = MAILMIME_MECHANISM_BINARY; 52 mimetype = MAILMIME_MECHANISM_BINARY;
47 } 53 }
48 54
49 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 55 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
50 &result_text,&target_length); 56 &result_text,&target_length);
51 57
52 encodedString* result = new encodedString(); 58 encodedString* result = new encodedString();
53 if (err == MAILIMF_NO_ERROR) { 59 if (err == MAILIMF_NO_ERROR) {
54 result->setContent(result_text,target_length); 60 result->setContent(result_text,target_length);
55 } 61 }
56 qDebug("Decode string finished"); 62 qDebug("Decode string finished");
57 return result; 63 return result;
58} 64}
59 65
60QString AbstractMail::convert_String(const char*text) 66QString AbstractMail::convert_String(const char*text)
61{ 67{
62 size_t index = 0; 68 size_t index = 0;
63 char*res = 0; 69 char*res = 0;
64 70
65 /* attention - doesn't work with arm systems! */ 71 /* attention - doesn't work with arm systems! */
66 int err = mailmime_encoded_phrase_parse("iso-8859-1", 72 int err = mailmime_encoded_phrase_parse("iso-8859-1",
67 text, strlen(text),&index, "iso-8859-1",&res); 73 text, strlen(text),&index, "iso-8859-1",&res);
68 if (err != MAILIMF_NO_ERROR) { 74 if (err != MAILIMF_NO_ERROR) {
69 if (res) free(res); 75 if (res) free(res);
70 return QString(text); 76 return QString(text);
71 } 77 }
72 if (res) { 78 if (res) {
73 QString result(res); 79 QString result(res);
74 free(res); 80 free(res);
75 return result; 81 return result;
76 } 82 }