summaryrefslogtreecommitdiff
path: root/noncore/net/mail/imapwrapper.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/imapwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp16
1 files changed, 13 insertions, 3 deletions
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
@@ -389,19 +389,25 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
QValueList<int> path;
fillSinglePart(singlePart,mailDescription);
switch (mailDescription->bd_type) {
case MAILIMAP_BODY_TYPE_1PART_MSG:
path.append(1);
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
target_body.setDescription(singlePart);
break;
case MAILIMAP_BODY_TYPE_1PART_TEXT:
qDebug("Mediatype single: %s",mailDescription->bd_data.bd_type_text->bd_media_text);
path.append(1);
body_text = fetchPart(mail,path,true);
+ if (singlePart.Encoding()=="quoted-printable") {
+ body_text = decode_quoted_printable(body_text.latin1());
+ }
target_body.setBodytext(body_text);
target_body.setDescription(singlePart);
break;
case MAILIMAP_BODY_TYPE_1PART_BASIC:
qDebug("Single attachment");
target_body.setBodytext("");
@@ -452,13 +458,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
break;
}
}
return l;
}
-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)
{
QString body("");
const char*mb;
int err;
mailimap_fetch_type *fetchType;
mailimap_set *set;
@@ -504,13 +510,17 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,boo
msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
if (text) {
+ if (enc=="quoted-printable") {
+ body = decode_quoted_printable(text);
+ } else {
body = QString(text);
+ }
free(text);
} else {
body = "";
}
}
}
@@ -544,13 +554,13 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mai
RecPart currentPart;
fillSinglePart(currentPart,current_body->bd_data.bd_body_1part);
QValueList<int>clist = recList;
clist.append(count);
/* important: Check for is NULL 'cause a body can be empty! */
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);
target_body.setBodytext(body_text);
} else {
QString id("");
for (unsigned int j = 0; j < clist.count();++j) {
id+=(j>0?" ":"");
@@ -702,13 +712,13 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
target_part.setEncoding(encoding);
target_part.setSize(which->bd_size);
}
QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
{
- return fetchPart(mail,part.Positionlist(),false);
+ return fetchPart(mail,part.Positionlist(),false,part.Encoding());
}
void IMAPwrapper::deleteMail(const RecMail&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;