Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 91332c3..d79df4f 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -851,196 +851,199 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba | |||
851 | type = "audio"; | 851 | type = "audio"; |
852 | break; | 852 | break; |
853 | case MAILIMAP_MEDIA_BASIC_IMAGE: | 853 | case MAILIMAP_MEDIA_BASIC_IMAGE: |
854 | type = "image"; | 854 | type = "image"; |
855 | break; | 855 | break; |
856 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | 856 | case MAILIMAP_MEDIA_BASIC_MESSAGE: |
857 | type = "message"; | 857 | type = "message"; |
858 | break; | 858 | break; |
859 | case MAILIMAP_MEDIA_BASIC_VIDEO: | 859 | case MAILIMAP_MEDIA_BASIC_VIDEO: |
860 | type = "video"; | 860 | type = "video"; |
861 | break; | 861 | break; |
862 | case MAILIMAP_MEDIA_BASIC_OTHER: | 862 | case MAILIMAP_MEDIA_BASIC_OTHER: |
863 | default: | 863 | default: |
864 | if (which->bd_media_basic->med_basic_type) { | 864 | if (which->bd_media_basic->med_basic_type) { |
865 | type = which->bd_media_basic->med_basic_type; | 865 | type = which->bd_media_basic->med_basic_type; |
866 | } else { | 866 | } else { |
867 | type = ""; | 867 | type = ""; |
868 | } | 868 | } |
869 | break; | 869 | break; |
870 | } | 870 | } |
871 | if (which->bd_media_basic->med_subtype) { | 871 | if (which->bd_media_basic->med_subtype) { |
872 | sub = which->bd_media_basic->med_subtype; | 872 | sub = which->bd_media_basic->med_subtype; |
873 | } else { | 873 | } else { |
874 | sub = ""; | 874 | sub = ""; |
875 | } | 875 | } |
876 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; | 876 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; |
877 | target_part->setType(type.lower()); | 877 | target_part->setType(type.lower()); |
878 | target_part->setSubtype(sub.lower()); | 878 | target_part->setSubtype(sub.lower()); |
879 | fillBodyFields(target_part,which->bd_fields); | 879 | fillBodyFields(target_part,which->bd_fields); |
880 | } | 880 | } |
881 | 881 | ||
882 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) | 882 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
883 | { | 883 | { |
884 | if (!which) return; | 884 | if (!which) return; |
885 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 885 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
886 | clistcell*cur; | 886 | clistcell*cur; |
887 | mailimap_single_body_fld_param*param=0; | 887 | mailimap_single_body_fld_param*param=0; |
888 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 888 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
889 | param = (mailimap_single_body_fld_param*)cur->data; | 889 | param = (mailimap_single_body_fld_param*)cur->data; |
890 | if (param) { | 890 | if (param) { |
891 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 891 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
892 | } | 892 | } |
893 | } | 893 | } |
894 | } | 894 | } |
895 | mailimap_body_fld_enc*enc = which->bd_encoding; | 895 | mailimap_body_fld_enc*enc = which->bd_encoding; |
896 | QString encoding(""); | 896 | QString encoding(""); |
897 | switch (enc->enc_type) { | 897 | switch (enc->enc_type) { |
898 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 898 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
899 | encoding = "7bit"; | 899 | encoding = "7bit"; |
900 | break; | 900 | break; |
901 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 901 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
902 | encoding = "8bit"; | 902 | encoding = "8bit"; |
903 | break; | 903 | break; |
904 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 904 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
905 | encoding="binary"; | 905 | encoding="binary"; |
906 | break; | 906 | break; |
907 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 907 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
908 | encoding="base64"; | 908 | encoding="base64"; |
909 | break; | 909 | break; |
910 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 910 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
911 | encoding="quoted-printable"; | 911 | encoding="quoted-printable"; |
912 | break; | 912 | break; |
913 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 913 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
914 | default: | 914 | default: |
915 | if (enc->enc_value) { | 915 | if (enc->enc_value) { |
916 | char*t=enc->enc_value; | 916 | char*t=enc->enc_value; |
917 | encoding=QString(enc->enc_value); | 917 | encoding=QString(enc->enc_value); |
918 | enc->enc_value=0L; | 918 | enc->enc_value=0L; |
919 | free(t); | 919 | free(t); |
920 | } | 920 | } |
921 | } | 921 | } |
922 | if (which->bd_description) { | 922 | if (which->bd_description) { |
923 | target_part->setDescription(QString(which->bd_description)); | 923 | target_part->setDescription(QString(which->bd_description)); |
924 | } | 924 | } |
925 | target_part->setEncoding(encoding); | 925 | target_part->setEncoding(encoding); |
926 | target_part->setSize(which->bd_size); | 926 | target_part->setSize(which->bd_size); |
927 | } | 927 | } |
928 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | 928 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) |
929 | { | 929 | { |
930 | //#if 0 | 930 | //#if 0 |
931 | mailimap_flag_list*flist; | 931 | mailimap_flag_list*flist; |
932 | mailimap_set *set; | 932 | mailimap_set *set; |
933 | mailimap_store_att_flags * store_flags; | 933 | mailimap_store_att_flags * store_flags; |
934 | int err; | 934 | int err; |
935 | login(); | 935 | login(); |
936 | //#endif | 936 | //#endif |
937 | if (!m_imap) { | 937 | if (!m_imap) { |
938 | return; | 938 | return; |
939 | } | 939 | } |
940 | int iii = 0; | 940 | int iii = 0; |
941 | int count = target.count(); | 941 | int count = target.count(); |
942 | // qDebug("imap remove count %d ", count); | 942 | // qDebug("imap remove count %d ", count); |
943 | 943 | ||
944 | 944 | ||
945 | mMax = count; | 945 | mMax = count; |
946 | //progress( tr("Delete")); | 946 | //progress( tr("Delete")); |
947 | QWidget wid; | 947 | |
948 | QProgressBar wid ( count ); | ||
949 | wid.setCaption( tr("Deleting ...")); | ||
948 | wid.show(); | 950 | wid.show(); |
949 | while (iii < count ) { | 951 | while (iii < count ) { |
950 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 952 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
953 | wid.setProgress( iii ); | ||
951 | wid.raise(); | 954 | wid.raise(); |
952 | qApp->processEvents(); | 955 | qApp->processEvents(); |
953 | RecMailP mail = (*target.at( iii )); | 956 | RecMailP mail = (*target.at( iii )); |
954 | //#if 0 | 957 | //#if 0 |
955 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); | 958 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); |
956 | err = selectMbox(mail->getMbox()); | 959 | err = selectMbox(mail->getMbox()); |
957 | if ( err != MAILIMAP_NO_ERROR ) { | 960 | if ( err != MAILIMAP_NO_ERROR ) { |
958 | return; | 961 | return; |
959 | } | 962 | } |
960 | flist = mailimap_flag_list_new_empty(); | 963 | flist = mailimap_flag_list_new_empty(); |
961 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 964 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
962 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 965 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
963 | set = mailimap_set_new_single(mail->getNumber()); | 966 | set = mailimap_set_new_single(mail->getNumber()); |
964 | err = mailimap_store(m_imap,set,store_flags); | 967 | err = mailimap_store(m_imap,set,store_flags); |
965 | mailimap_set_free( set ); | 968 | mailimap_set_free( set ); |
966 | mailimap_store_att_flags_free(store_flags); | 969 | mailimap_store_att_flags_free(store_flags); |
967 | 970 | ||
968 | if (err != MAILIMAP_NO_ERROR) { | 971 | if (err != MAILIMAP_NO_ERROR) { |
969 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 972 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
970 | return; | 973 | return; |
971 | } | 974 | } |
972 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 975 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
973 | /* should we realy do that at this moment? */ | 976 | /* should we realy do that at this moment? */ |
974 | 977 | ||
975 | // err = mailimap_expunge(m_imap); | 978 | // err = mailimap_expunge(m_imap); |
976 | //if (err != MAILIMAP_NO_ERROR) { | 979 | //if (err != MAILIMAP_NO_ERROR) { |
977 | // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); | 980 | // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); |
978 | // } | 981 | // } |
979 | //#endif | 982 | //#endif |
980 | //deleteMail( mail); | 983 | //deleteMail( mail); |
981 | ++iii; | 984 | ++iii; |
982 | } | 985 | } |
983 | //qDebug("Deleting imap mails... "); | 986 | //qDebug("Deleting imap mails... "); |
984 | err = mailimap_expunge(m_imap); | 987 | err = mailimap_expunge(m_imap); |
985 | if (err != MAILIMAP_NO_ERROR) { | 988 | if (err != MAILIMAP_NO_ERROR) { |
986 | Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); | 989 | Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); |
987 | } | 990 | } |
988 | } | 991 | } |
989 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 992 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
990 | { | 993 | { |
991 | mailimap_flag_list*flist; | 994 | mailimap_flag_list*flist; |
992 | mailimap_set *set; | 995 | mailimap_set *set; |
993 | mailimap_store_att_flags * store_flags; | 996 | mailimap_store_att_flags * store_flags; |
994 | int err; | 997 | int err; |
995 | login(); | 998 | login(); |
996 | if (!m_imap) { | 999 | if (!m_imap) { |
997 | return; | 1000 | return; |
998 | } | 1001 | } |
999 | err = selectMbox(mail->getMbox()); | 1002 | err = selectMbox(mail->getMbox()); |
1000 | if ( err != MAILIMAP_NO_ERROR ) { | 1003 | if ( err != MAILIMAP_NO_ERROR ) { |
1001 | return; | 1004 | return; |
1002 | } | 1005 | } |
1003 | flist = mailimap_flag_list_new_empty(); | 1006 | flist = mailimap_flag_list_new_empty(); |
1004 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 1007 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
1005 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 1008 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
1006 | set = mailimap_set_new_single(mail->getNumber()); | 1009 | set = mailimap_set_new_single(mail->getNumber()); |
1007 | err = mailimap_store(m_imap,set,store_flags); | 1010 | err = mailimap_store(m_imap,set,store_flags); |
1008 | mailimap_set_free( set ); | 1011 | mailimap_set_free( set ); |
1009 | mailimap_store_att_flags_free(store_flags); | 1012 | mailimap_store_att_flags_free(store_flags); |
1010 | 1013 | ||
1011 | if (err != MAILIMAP_NO_ERROR) { | 1014 | if (err != MAILIMAP_NO_ERROR) { |
1012 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 1015 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
1013 | return; | 1016 | return; |
1014 | } | 1017 | } |
1015 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 1018 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1016 | /* should we realy do that at this moment? */ | 1019 | /* should we realy do that at this moment? */ |
1017 | 1020 | ||
1018 | err = mailimap_expunge(m_imap); | 1021 | err = mailimap_expunge(m_imap); |
1019 | if (err != MAILIMAP_NO_ERROR) { | 1022 | if (err != MAILIMAP_NO_ERROR) { |
1020 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 1023 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
1021 | } | 1024 | } |
1022 | //qDebug("IMAPwrapper::deleteMail 2"); | 1025 | //qDebug("IMAPwrapper::deleteMail 2"); |
1023 | 1026 | ||
1024 | } | 1027 | } |
1025 | 1028 | ||
1026 | void IMAPwrapper::answeredMail(const RecMailP&mail) | 1029 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
1027 | { | 1030 | { |
1028 | mailimap_flag_list*flist; | 1031 | mailimap_flag_list*flist; |
1029 | mailimap_set *set; | 1032 | mailimap_set *set; |
1030 | mailimap_store_att_flags * store_flags; | 1033 | mailimap_store_att_flags * store_flags; |
1031 | int err; | 1034 | int err; |
1032 | login(); | 1035 | login(); |
1033 | if (!m_imap) { | 1036 | if (!m_imap) { |
1034 | return; | 1037 | return; |
1035 | } | 1038 | } |
1036 | err = selectMbox(mail->getMbox()); | 1039 | err = selectMbox(mail->getMbox()); |
1037 | if ( err != MAILIMAP_NO_ERROR ) { | 1040 | if ( err != MAILIMAP_NO_ERROR ) { |
1038 | return; | 1041 | return; |
1039 | } | 1042 | } |
1040 | flist = mailimap_flag_list_new_empty(); | 1043 | flist = mailimap_flag_list_new_empty(); |
1041 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | 1044 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); |
1042 | store_flags = mailimap_store_att_flags_new_add_flags(flist); | 1045 | store_flags = mailimap_store_att_flags_new_add_flags(flist); |
1043 | set = mailimap_set_new_single(mail->getNumber()); | 1046 | set = mailimap_set_new_single(mail->getNumber()); |
1044 | err = mailimap_store(m_imap,set,store_flags); | 1047 | err = mailimap_store(m_imap,set,store_flags); |
1045 | mailimap_set_free( set ); | 1048 | mailimap_set_free( set ); |
1046 | mailimap_store_att_flags_free(store_flags); | 1049 | mailimap_store_att_flags_free(store_flags); |