Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 56e7df9..230cf53 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -483,9 +483,9 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
483 | return m; | 483 | return m; |
484 | } | 484 | } |
485 | 485 | ||
486 | RecBody IMAPwrapper::fetchBody(const RecMailP&mail) | 486 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) |
487 | { | 487 | { |
488 | RecBody body; | 488 | RecBodyP body = new RecBody(); |
489 | const char *mb; | 489 | const char *mb; |
490 | int err = MAILIMAP_NO_ERROR; | 490 | int err = MAILIMAP_NO_ERROR; |
491 | clist *result = 0; | 491 | clist *result = 0; |
@@ -642,7 +642,7 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
642 | 642 | ||
643 | /* current_recursion is for recursive calls. | 643 | /* current_recursion is for recursive calls. |
644 | current_count means the position inside the internal loop! */ | 644 | current_count means the position inside the internal loop! */ |
645 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body, | 645 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
646 | int current_recursion,QValueList<int>recList,int current_count) | 646 | int current_recursion,QValueList<int>recList,int current_count) |
647 | { | 647 | { |
648 | if (!body || current_recursion>=10) { | 648 | if (!body || current_recursion>=10) { |
@@ -653,28 +653,28 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
653 | { | 653 | { |
654 | QValueList<int>countlist = recList; | 654 | QValueList<int>countlist = recList; |
655 | countlist.append(current_count); | 655 | countlist.append(current_count); |
656 | RecPart currentPart; | 656 | RecPartP currentPart = new RecPart(); |
657 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 657 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
658 | QString id(""); | 658 | QString id(""); |
659 | currentPart.setPositionlist(countlist); | 659 | currentPart->setPositionlist(countlist); |
660 | for (unsigned int j = 0; j < countlist.count();++j) { | 660 | for (unsigned int j = 0; j < countlist.count();++j) { |
661 | id+=(j>0?" ":""); | 661 | id+=(j>0?" ":""); |
662 | id+=QString("%1").arg(countlist[j]); | 662 | id+=QString("%1").arg(countlist[j]); |
663 | } | 663 | } |
664 | qDebug("ID = %s",id.latin1()); | 664 | qDebug("ID = %s",id.latin1()); |
665 | currentPart.setIdentifier(id); | 665 | currentPart->setIdentifier(id); |
666 | fillSinglePart(currentPart,part1); | 666 | fillSinglePart(currentPart,part1); |
667 | /* important: Check for is NULL 'cause a body can be empty! | 667 | /* important: Check for is NULL 'cause a body can be empty! |
668 | And we put it only into the mail if it is the FIRST part */ | 668 | And we put it only into the mail if it is the FIRST part */ |
669 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body.Bodytext().isNull() && countlist[0]==1) { | 669 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
670 | QString body_text = fetchTextPart(mail,countlist,true,currentPart.Encoding()); | 670 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
671 | target_body.setDescription(currentPart); | 671 | target_body->setDescription(currentPart); |
672 | target_body.setBodytext(body_text); | 672 | target_body->setBodytext(body_text); |
673 | if (countlist.count()>1) { | 673 | if (countlist.count()>1) { |
674 | target_body.addPart(currentPart); | 674 | target_body->addPart(currentPart); |
675 | } | 675 | } |
676 | } else { | 676 | } else { |
677 | target_body.addPart(currentPart); | 677 | target_body->addPart(currentPart); |
678 | } | 678 | } |
679 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 679 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
680 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 680 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
@@ -691,12 +691,12 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
691 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 691 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
692 | current_body = (mailimap_body*)current->data; | 692 | current_body = (mailimap_body*)current->data; |
693 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 693 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
694 | RecPart targetPart; | 694 | RecPartP targetPart = new RecPart(); |
695 | targetPart.setType("multipart"); | 695 | targetPart->setType("multipart"); |
696 | fillMultiPart(targetPart,mailDescription); | 696 | fillMultiPart(targetPart,mailDescription); |
697 | countlist.append(current_count); | 697 | countlist.append(current_count); |
698 | targetPart.setPositionlist(countlist); | 698 | targetPart->setPositionlist(countlist); |
699 | target_body.addPart(targetPart); | 699 | target_body->addPart(targetPart); |
700 | QString id(""); | 700 | QString id(""); |
701 | for (unsigned int j = 0; j < countlist.count();++j) { | 701 | for (unsigned int j = 0; j < countlist.count();++j) { |
702 | id+=(j>0?" ":""); | 702 | id+=(j>0?" ":""); |
@@ -717,21 +717,21 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta | |||
717 | } | 717 | } |
718 | } | 718 | } |
719 | 719 | ||
720 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 720 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) |
721 | { | 721 | { |
722 | if (!Description) { | 722 | if (!Description) { |
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | switch (Description->bd_type) { | 725 | switch (Description->bd_type) { |
726 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 726 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
727 | target_part.setType("text"); | 727 | target_part->setType("text"); |
728 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 728 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
729 | break; | 729 | break; |
730 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 730 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
731 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 731 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
732 | break; | 732 | break; |
733 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 733 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
734 | target_part.setType("message"); | 734 | target_part->setType("message"); |
735 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 735 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
736 | break; | 736 | break; |
737 | default: | 737 | default: |
@@ -739,7 +739,7 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De | |||
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | 742 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) |
743 | { | 743 | { |
744 | if (!which) { | 744 | if (!which) { |
745 | return; | 745 | return; |
@@ -747,41 +747,41 @@ void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text | |||
747 | QString sub; | 747 | QString sub; |
748 | sub = which->bd_media_text; | 748 | sub = which->bd_media_text; |
749 | qDebug("Type= text/%s",which->bd_media_text); | 749 | qDebug("Type= text/%s",which->bd_media_text); |
750 | target_part.setSubtype(sub.lower()); | 750 | target_part->setSubtype(sub.lower()); |
751 | target_part.setLines(which->bd_lines); | 751 | target_part->setLines(which->bd_lines); |
752 | fillBodyFields(target_part,which->bd_fields); | 752 | fillBodyFields(target_part,which->bd_fields); |
753 | } | 753 | } |
754 | 754 | ||
755 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) | 755 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) |
756 | { | 756 | { |
757 | if (!which) { | 757 | if (!which) { |
758 | return; | 758 | return; |
759 | } | 759 | } |
760 | target_part.setSubtype("rfc822"); | 760 | target_part->setSubtype("rfc822"); |
761 | qDebug("Message part"); | 761 | qDebug("Message part"); |
762 | /* we set this type to text/plain */ | 762 | /* we set this type to text/plain */ |
763 | target_part.setLines(which->bd_lines); | 763 | target_part->setLines(which->bd_lines); |
764 | fillBodyFields(target_part,which->bd_fields); | 764 | fillBodyFields(target_part,which->bd_fields); |
765 | } | 765 | } |
766 | 766 | ||
767 | void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which) | 767 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) |
768 | { | 768 | { |
769 | if (!which) return; | 769 | if (!which) return; |
770 | QString sub = which->bd_media_subtype; | 770 | QString sub = which->bd_media_subtype; |
771 | target_part.setSubtype(sub.lower()); | 771 | target_part->setSubtype(sub.lower()); |
772 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { | 772 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { |
773 | clistcell*cur = 0; | 773 | clistcell*cur = 0; |
774 | mailimap_single_body_fld_param*param=0; | 774 | mailimap_single_body_fld_param*param=0; |
775 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 775 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
776 | param = (mailimap_single_body_fld_param*)cur->data; | 776 | param = (mailimap_single_body_fld_param*)cur->data; |
777 | if (param) { | 777 | if (param) { |
778 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 778 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
779 | } | 779 | } |
780 | } | 780 | } |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | 784 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) |
785 | { | 785 | { |
786 | if (!which) { | 786 | if (!which) { |
787 | return; | 787 | return; |
@@ -818,12 +818,12 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
818 | sub = ""; | 818 | sub = ""; |
819 | } | 819 | } |
820 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 820 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
821 | target_part.setType(type.lower()); | 821 | target_part->setType(type.lower()); |
822 | target_part.setSubtype(sub.lower()); | 822 | target_part->setSubtype(sub.lower()); |
823 | fillBodyFields(target_part,which->bd_fields); | 823 | fillBodyFields(target_part,which->bd_fields); |
824 | } | 824 | } |
825 | 825 | ||
826 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 826 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
827 | { | 827 | { |
828 | if (!which) return; | 828 | if (!which) return; |
829 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 829 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
@@ -832,7 +832,7 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
832 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 832 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
833 | param = (mailimap_single_body_fld_param*)cur->data; | 833 | param = (mailimap_single_body_fld_param*)cur->data; |
834 | if (param) { | 834 | if (param) { |
835 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 835 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
836 | } | 836 | } |
837 | } | 837 | } |
838 | } | 838 | } |
@@ -864,10 +864,10 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
864 | } | 864 | } |
865 | } | 865 | } |
866 | if (which->bd_description) { | 866 | if (which->bd_description) { |
867 | target_part.setDescription(QString(which->bd_description)); | 867 | target_part->setDescription(QString(which->bd_description)); |
868 | } | 868 | } |
869 | target_part.setEncoding(encoding); | 869 | target_part->setEncoding(encoding); |
870 | target_part.setSize(which->bd_size); | 870 | target_part->setSize(which->bd_size); |
871 | } | 871 | } |
872 | 872 | ||
873 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 873 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
@@ -948,22 +948,22 @@ QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&pat | |||
948 | return body; | 948 | return body; |
949 | } | 949 | } |
950 | 950 | ||
951 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) | 951 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) |
952 | { | 952 | { |
953 | return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); | 953 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); |
954 | } | 954 | } |
955 | 955 | ||
956 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part) | 956 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) |
957 | { | 957 | { |
958 | encodedString*res = fetchRawPart(mail,part.Positionlist(),false); | 958 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); |
959 | encodedString*r = decode_String(res,part.Encoding()); | 959 | encodedString*r = decode_String(res,part->Encoding()); |
960 | delete res; | 960 | delete res; |
961 | return r; | 961 | return r; |
962 | } | 962 | } |
963 | 963 | ||
964 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) | 964 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) |
965 | { | 965 | { |
966 | return fetchRawPart(mail,part.Positionlist(),false); | 966 | return fetchRawPart(mail,part->Positionlist(),false); |
967 | } | 967 | } |
968 | 968 | ||
969 | int IMAPwrapper::deleteAllMail(const FolderP&folder) | 969 | int IMAPwrapper::deleteAllMail(const FolderP&folder) |