summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/abstractmail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/abstractmail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 0bb2525..92a46f1 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -1,6 +1,7 @@
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 "mailtypes.h"
4 5
5#include <qstring.h> 6#include <qstring.h>
6#include <stdlib.h> 7#include <stdlib.h>
@@ -16,19 +17,32 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
16 return new POP3wrapper(a); 17 return new POP3wrapper(a);
17} 18}
18 19
19QString AbstractMail::decode_quoted_printable(const char*text) 20encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
20{ 21{
22 qDebug("Decode string start");
21 char*result_text; 23 char*result_text;
22 size_t index = 0; 24 size_t index = 0;
23 QString result = "";
24 /* reset for recursive use! */ 25 /* reset for recursive use! */
25 size_t target_length = 0; 26 size_t target_length = 0;
26 result_text = 0; 27 result_text = 0;
27 int err = mailmime_quoted_printable_body_parse(text,strlen(text), 28 int mimetype = MAILMIME_MECHANISM_7BIT;
28 &index,&result_text,&target_length,0); 29 if (enc.lower()=="quoted-printable") {
29 if (result_text) { 30 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
30 result = result_text; 31 } else if (enc.lower()=="base64") {
31 free(result_text); 32 mimetype = MAILMIME_MECHANISM_BASE64;
33 } else if (enc.lower()=="8bit") {
34 mimetype = MAILMIME_MECHANISM_8BIT;
35 } else if (enc.lower()=="binary") {
36 mimetype = MAILMIME_MECHANISM_BINARY;
32 } 37 }
38
39 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
40 &result_text,&target_length);
41
42 encodedString* result = new encodedString();
43 if (err == MAILIMF_NO_ERROR) {
44 result->setContent(result_text,target_length);
45 }
46 qDebug("Decode string finished");
33 return result; 47 return result;
34} 48}