summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/abstractmail.cpp21
-rw-r--r--noncore/net/mail/abstractmail.h4
-rw-r--r--noncore/net/mail/imapwrapper.cpp18
-rw-r--r--noncore/net/mail/imapwrapper.h4
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp21
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h4
8 files changed, 78 insertions, 16 deletions
diff --git a/noncore/net/mail/abstractmail.cpp b/noncore/net/mail/abstractmail.cpp
index 7380c31..0bb2525 100644
--- a/noncore/net/mail/abstractmail.cpp
+++ b/noncore/net/mail/abstractmail.cpp
@@ -4,2 +4,6 @@
+#include <qstring.h>
+#include <stdlib.h>
+#include <libetpan/mailmime_content.h>
+
AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
@@ -13 +17,18 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
}
+
+QString AbstractMail::decode_quoted_printable(const char*text)
+{
+ char*result_text;
+ size_t index = 0;
+ QString result = "";
+ /* reset for recursive use! */
+ size_t target_length = 0;
+ result_text = 0;
+ int err = mailmime_quoted_printable_body_parse(text,strlen(text),
+ &index,&result_text,&target_length,0);
+ if (result_text) {
+ result = result_text;
+ free(result_text);
+ }
+ return result;
+}
diff --git a/noncore/net/mail/abstractmail.h b/noncore/net/mail/abstractmail.h
index 62e0715..4473ad2 100644
--- a/noncore/net/mail/abstractmail.h
+++ b/noncore/net/mail/abstractmail.h
@@ -25,7 +25,7 @@ public:
virtual void answeredMail(const RecMail&mail)=0;
-
+
static AbstractMail* getWrapper(IMAPaccount *a);
static AbstractMail* getWrapper(POP3account *a);
+ static QString decode_quoted_printable(const char*text);
};
-
#endif
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index ad95384..a4e6228 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -394,2 +394,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
@@ -401,2 +404,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
@@ -457,3 +463,3 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
-QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call)
+QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
{
@@ -509,3 +515,7 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,boo
if (text) {
- body = QString(text);
+ if (enc=="quoted-printable") {
+ body = decode_quoted_printable(text);
+ } else {
+ body = QString(text);
+ }
free(text);
@@ -549,3 +559,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mai
if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) {
- QString body_text = fetchPart(mail,clist,true);
+ QString body_text = fetchPart(mail,clist,true,currentPart.Encoding());
target_body.setDescription(currentPart);
@@ -707,3 +717,3 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
{
- return fetchPart(mail,part.Positionlist(),false);
+ return fetchPart(mail,part.Positionlist(),false,part.Encoding());
}
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h
index 700d512..768a517 100644
--- a/noncore/net/mail/imapwrapper.h
+++ b/noncore/net/mail/imapwrapper.h
@@ -36,3 +36,3 @@ protected:
- virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false);
+ virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
@@ -50,3 +50,3 @@ protected:
-private:
+
IMAPaccount *account;
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 7380c31..0bb2525 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -4,2 +4,6 @@
+#include <qstring.h>
+#include <stdlib.h>
+#include <libetpan/mailmime_content.h>
+
AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
@@ -13 +17,18 @@ AbstractMail* AbstractMail::getWrapper(POP3account *a)
}
+
+QString AbstractMail::decode_quoted_printable(const char*text)
+{
+ char*result_text;
+ size_t index = 0;
+ QString result = "";
+ /* reset for recursive use! */
+ size_t target_length = 0;
+ result_text = 0;
+ int err = mailmime_quoted_printable_body_parse(text,strlen(text),
+ &index,&result_text,&target_length,0);
+ if (result_text) {
+ result = result_text;
+ free(result_text);
+ }
+ return result;
+}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 62e0715..4473ad2 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -25,7 +25,7 @@ public:
virtual void answeredMail(const RecMail&mail)=0;
-
+
static AbstractMail* getWrapper(IMAPaccount *a);
static AbstractMail* getWrapper(POP3account *a);
+ static QString decode_quoted_printable(const char*text);
};
-
#endif
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index ad95384..a4e6228 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -394,2 +394,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
@@ -401,2 +404,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
@@ -457,3 +463,3 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
-QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call)
+QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
{
@@ -509,3 +515,7 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,boo
if (text) {
- body = QString(text);
+ if (enc=="quoted-printable") {
+ body = decode_quoted_printable(text);
+ } else {
+ body = QString(text);
+ }
free(text);
@@ -549,3 +559,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mai
if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) {
- QString body_text = fetchPart(mail,clist,true);
+ QString body_text = fetchPart(mail,clist,true,currentPart.Encoding());
target_body.setDescription(currentPart);
@@ -707,3 +717,3 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
{
- return fetchPart(mail,part.Positionlist(),false);
+ return fetchPart(mail,part.Positionlist(),false,part.Encoding());
}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 700d512..768a517 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -36,3 +36,3 @@ protected:
- virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false);
+ virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
@@ -50,3 +50,3 @@ protected:
-private:
+
IMAPaccount *account;