Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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 | |||
@@ -389,19 +389,25 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
389 | QValueList<int> path; | 389 | QValueList<int> path; |
390 | fillSinglePart(singlePart,mailDescription); | 390 | fillSinglePart(singlePart,mailDescription); |
391 | switch (mailDescription->bd_type) { | 391 | switch (mailDescription->bd_type) { |
392 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 392 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
393 | path.append(1); | 393 | path.append(1); |
394 | body_text = fetchPart(mail,path,true); | 394 | body_text = fetchPart(mail,path,true); |
395 | if (singlePart.Encoding()=="quoted-printable") { | ||
396 | body_text = decode_quoted_printable(body_text.latin1()); | ||
397 | } | ||
395 | target_body.setBodytext(body_text); | 398 | target_body.setBodytext(body_text); |
396 | target_body.setDescription(singlePart); | 399 | target_body.setDescription(singlePart); |
397 | break; | 400 | break; |
398 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 401 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
399 | qDebug("Mediatype single: %s",mailDescription->bd_data.bd_type_text->bd_media_text); | 402 | qDebug("Mediatype single: %s",mailDescription->bd_data.bd_type_text->bd_media_text); |
400 | path.append(1); | 403 | path.append(1); |
401 | body_text = fetchPart(mail,path,true); | 404 | body_text = fetchPart(mail,path,true); |
405 | if (singlePart.Encoding()=="quoted-printable") { | ||
406 | body_text = decode_quoted_printable(body_text.latin1()); | ||
407 | } | ||
402 | target_body.setBodytext(body_text); | 408 | target_body.setBodytext(body_text); |
403 | target_body.setDescription(singlePart); | 409 | target_body.setDescription(singlePart); |
404 | break; | 410 | break; |
405 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 411 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
406 | qDebug("Single attachment"); | 412 | qDebug("Single attachment"); |
407 | target_body.setBodytext(""); | 413 | target_body.setBodytext(""); |
@@ -452,13 +458,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
452 | break; | 458 | break; |
453 | } | 459 | } |
454 | } | 460 | } |
455 | return l; | 461 | return l; |
456 | } | 462 | } |
457 | 463 | ||
458 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 464 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc) |
459 | { | 465 | { |
460 | QString body(""); | 466 | QString body(""); |
461 | const char*mb; | 467 | const char*mb; |
462 | int err; | 468 | int err; |
463 | mailimap_fetch_type *fetchType; | 469 | mailimap_fetch_type *fetchType; |
464 | mailimap_set *set; | 470 | mailimap_set *set; |
@@ -504,13 +510,17 @@ QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,boo | |||
504 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 510 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
505 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 511 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
506 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 512 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
507 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 513 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
508 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 514 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
509 | if (text) { | 515 | if (text) { |
510 | body = QString(text); | 516 | if (enc=="quoted-printable") { |
517 | body = decode_quoted_printable(text); | ||
518 | } else { | ||
519 | body = QString(text); | ||
520 | } | ||
511 | free(text); | 521 | free(text); |
512 | } else { | 522 | } else { |
513 | body = ""; | 523 | body = ""; |
514 | } | 524 | } |
515 | } | 525 | } |
516 | } | 526 | } |
@@ -544,13 +554,13 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mai | |||
544 | RecPart currentPart; | 554 | RecPart currentPart; |
545 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | 555 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); |
546 | QValueList<int>clist = recList; | 556 | QValueList<int>clist = recList; |
547 | clist.append(count); | 557 | clist.append(count); |
548 | /* important: Check for is NULL 'cause a body can be empty! */ | 558 | /* important: Check for is NULL 'cause a body can be empty! */ |
549 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { | 559 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { |
550 | QString body_text = fetchPart(mail,clist,true); | 560 | QString body_text = fetchPart(mail,clist,true,currentPart.Encoding()); |
551 | target_body.setDescription(currentPart); | 561 | target_body.setDescription(currentPart); |
552 | target_body.setBodytext(body_text); | 562 | target_body.setBodytext(body_text); |
553 | } else { | 563 | } else { |
554 | QString id(""); | 564 | QString id(""); |
555 | for (unsigned int j = 0; j < clist.count();++j) { | 565 | for (unsigned int j = 0; j < clist.count();++j) { |
556 | id+=(j>0?" ":""); | 566 | id+=(j>0?" ":""); |
@@ -702,13 +712,13 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
702 | target_part.setEncoding(encoding); | 712 | target_part.setEncoding(encoding); |
703 | target_part.setSize(which->bd_size); | 713 | target_part.setSize(which->bd_size); |
704 | } | 714 | } |
705 | 715 | ||
706 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 716 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
707 | { | 717 | { |
708 | return fetchPart(mail,part.Positionlist(),false); | 718 | return fetchPart(mail,part.Positionlist(),false,part.Encoding()); |
709 | } | 719 | } |
710 | 720 | ||
711 | void IMAPwrapper::deleteMail(const RecMail&mail) | 721 | void IMAPwrapper::deleteMail(const RecMail&mail) |
712 | { | 722 | { |
713 | mailimap_flag_list*flist; | 723 | mailimap_flag_list*flist; |
714 | mailimap_set *set; | 724 | mailimap_set *set; |