Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 3b3be0f..071e734 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -204,9 +204,9 @@ void IMAPwrapper::logout() | |||
204 | m_imap = 0; | 204 | m_imap = 0; |
205 | m_Lastmbox = ""; | 205 | m_Lastmbox = ""; |
206 | } | 206 | } |
207 | 207 | ||
208 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | 208 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPointer<RecMail> > &target ) |
209 | { | 209 | { |
210 | int err = MAILIMAP_NO_ERROR; | 210 | int err = MAILIMAP_NO_ERROR; |
211 | clist *result = 0; | 211 | clist *result = 0; |
212 | clistcell *current; | 212 | clistcell *current; |
@@ -265,9 +265,9 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
265 | } | 265 | } |
266 | if (result) mailimap_fetch_list_free(result); | 266 | if (result) mailimap_fetch_list_free(result); |
267 | } | 267 | } |
268 | 268 | ||
269 | QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders() | 269 | QValueList<Opie::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
270 | { | 270 | { |
271 | const char *path, *mask; | 271 | const char *path, *mask; |
272 | int err = MAILIMAP_NO_ERROR; | 272 | int err = MAILIMAP_NO_ERROR; |
273 | clist *result = 0; | 273 | clist *result = 0; |
@@ -481,9 +481,9 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
481 | } | 481 | } |
482 | return m; | 482 | return m; |
483 | } | 483 | } |
484 | 484 | ||
485 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) | 485 | RecBody IMAPwrapper::fetchBody(const RecMailP&mail) |
486 | { | 486 | { |
487 | RecBody body; | 487 | RecBody body; |
488 | const char *mb; | 488 | const char *mb; |
489 | int err = MAILIMAP_NO_ERROR; | 489 | int err = MAILIMAP_NO_ERROR; |
@@ -493,21 +493,21 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
493 | mailimap_fetch_type *fetchType = 0; | 493 | mailimap_fetch_type *fetchType = 0; |
494 | mailimap_set *set = 0; | 494 | mailimap_set *set = 0; |
495 | mailimap_body*body_desc = 0; | 495 | mailimap_body*body_desc = 0; |
496 | 496 | ||
497 | mb = mail.getMbox().latin1(); | 497 | mb = mail->getMbox().latin1(); |
498 | 498 | ||
499 | login(); | 499 | login(); |
500 | if (!m_imap) { | 500 | if (!m_imap) { |
501 | return body; | 501 | return body; |
502 | } | 502 | } |
503 | err = selectMbox(mail.getMbox()); | 503 | err = selectMbox(mail->getMbox()); |
504 | if ( err != MAILIMAP_NO_ERROR ) { | 504 | if ( err != MAILIMAP_NO_ERROR ) { |
505 | return body; | 505 | return body; |
506 | } | 506 | } |
507 | 507 | ||
508 | /* the range has to start at 1!!! not with 0!!!! */ | 508 | /* the range has to start at 1!!! not with 0!!!! */ |
509 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 509 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); |
510 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 510 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
511 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 511 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
512 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 512 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
513 | mailimap_set_free( set ); | 513 | mailimap_set_free( set ); |
@@ -567,9 +567,9 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
567 | } | 567 | } |
568 | return l; | 568 | return l; |
569 | } | 569 | } |
570 | 570 | ||
571 | encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 571 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) |
572 | { | 572 | { |
573 | encodedString*res=new encodedString; | 573 | encodedString*res=new encodedString; |
574 | int err; | 574 | int err; |
575 | mailimap_fetch_type *fetchType; | 575 | mailimap_fetch_type *fetchType; |
@@ -584,14 +584,14 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
584 | if (!m_imap) { | 584 | if (!m_imap) { |
585 | return res; | 585 | return res; |
586 | } | 586 | } |
587 | if (!internal_call) { | 587 | if (!internal_call) { |
588 | err = selectMbox(mail.getMbox()); | 588 | err = selectMbox(mail->getMbox()); |
589 | if ( err != MAILIMAP_NO_ERROR ) { | 589 | if ( err != MAILIMAP_NO_ERROR ) { |
590 | return res; | 590 | return res; |
591 | } | 591 | } |
592 | } | 592 | } |
593 | set = mailimap_set_new_single(mail.getNumber()); | 593 | set = mailimap_set_new_single(mail->getNumber()); |
594 | 594 | ||
595 | clist*id_list = 0; | 595 | clist*id_list = 0; |
596 | 596 | ||
597 | /* if path == empty then its a request for the whole rfc822 mail and generates | 597 | /* if path == empty then its a request for the whole rfc822 mail and generates |
@@ -640,9 +640,9 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
640 | } | 640 | } |
641 | 641 | ||
642 | /* current_recursion is for recursive calls. | 642 | /* current_recursion is for recursive calls. |
643 | current_count means the position inside the internal loop! */ | 643 | current_count means the position inside the internal loop! */ |
644 | void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, | 644 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body, |
645 | int current_recursion,QValueList<int>recList,int current_count) | 645 | int current_recursion,QValueList<int>recList,int current_count) |
646 | { | 646 | { |
647 | if (!body || current_recursion>=10) { | 647 | if (!body || current_recursion>=10) { |
648 | return; | 648 | return; |
@@ -868,9 +868,9 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
868 | target_part.setEncoding(encoding); | 868 | target_part.setEncoding(encoding); |
869 | target_part.setSize(which->bd_size); | 869 | target_part.setSize(which->bd_size); |
870 | } | 870 | } |
871 | 871 | ||
872 | void IMAPwrapper::deleteMail(const RecMail&mail) | 872 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
873 | { | 873 | { |
874 | mailimap_flag_list*flist; | 874 | mailimap_flag_list*flist; |
875 | mailimap_set *set; | 875 | mailimap_set *set; |
876 | mailimap_store_att_flags * store_flags; | 876 | mailimap_store_att_flags * store_flags; |
@@ -878,16 +878,16 @@ void IMAPwrapper::deleteMail(const RecMail&mail) | |||
878 | login(); | 878 | login(); |
879 | if (!m_imap) { | 879 | if (!m_imap) { |
880 | return; | 880 | return; |
881 | } | 881 | } |
882 | err = selectMbox(mail.getMbox()); | 882 | err = selectMbox(mail->getMbox()); |
883 | if ( err != MAILIMAP_NO_ERROR ) { | 883 | if ( err != MAILIMAP_NO_ERROR ) { |
884 | return; | 884 | return; |
885 | } | 885 | } |
886 | flist = mailimap_flag_list_new_empty(); | 886 | flist = mailimap_flag_list_new_empty(); |
887 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 887 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
888 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 888 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
889 | set = mailimap_set_new_single(mail.getNumber()); | 889 | set = mailimap_set_new_single(mail->getNumber()); |
890 | err = mailimap_store(m_imap,set,store_flags); | 890 | err = mailimap_store(m_imap,set,store_flags); |
891 | mailimap_set_free( set ); | 891 | mailimap_set_free( set ); |
892 | mailimap_store_att_flags_free(store_flags); | 892 | mailimap_store_att_flags_free(store_flags); |
893 | 893 | ||
@@ -903,9 +903,9 @@ void IMAPwrapper::deleteMail(const RecMail&mail) | |||
903 | } | 903 | } |
904 | qDebug("Delete successfull %s",m_imap->imap_response); | 904 | qDebug("Delete successfull %s",m_imap->imap_response); |
905 | } | 905 | } |
906 | 906 | ||
907 | void IMAPwrapper::answeredMail(const RecMail&mail) | 907 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
908 | { | 908 | { |
909 | mailimap_flag_list*flist; | 909 | mailimap_flag_list*flist; |
910 | mailimap_set *set; | 910 | mailimap_set *set; |
911 | mailimap_store_att_flags * store_flags; | 911 | mailimap_store_att_flags * store_flags; |
@@ -913,16 +913,16 @@ void IMAPwrapper::answeredMail(const RecMail&mail) | |||
913 | login(); | 913 | login(); |
914 | if (!m_imap) { | 914 | if (!m_imap) { |
915 | return; | 915 | return; |
916 | } | 916 | } |
917 | err = selectMbox(mail.getMbox()); | 917 | err = selectMbox(mail->getMbox()); |
918 | if ( err != MAILIMAP_NO_ERROR ) { | 918 | if ( err != MAILIMAP_NO_ERROR ) { |
919 | return; | 919 | return; |
920 | } | 920 | } |
921 | flist = mailimap_flag_list_new_empty(); | 921 | flist = mailimap_flag_list_new_empty(); |
922 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | 922 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); |
923 | store_flags = mailimap_store_att_flags_new_add_flags(flist); | 923 | store_flags = mailimap_store_att_flags_new_add_flags(flist); |
924 | set = mailimap_set_new_single(mail.getNumber()); | 924 | set = mailimap_set_new_single(mail->getNumber()); |
925 | err = mailimap_store(m_imap,set,store_flags); | 925 | err = mailimap_store(m_imap,set,store_flags); |
926 | mailimap_set_free( set ); | 926 | mailimap_set_free( set ); |
927 | mailimap_store_att_flags_free(store_flags); | 927 | mailimap_store_att_flags_free(store_flags); |
928 | 928 | ||
@@ -931,9 +931,9 @@ void IMAPwrapper::answeredMail(const RecMail&mail) | |||
931 | return; | 931 | return; |
932 | } | 932 | } |
933 | } | 933 | } |
934 | 934 | ||
935 | QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc) | 935 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) |
936 | { | 936 | { |
937 | QString body(""); | 937 | QString body(""); |
938 | encodedString*res = fetchRawPart(mail,path,internal_call); | 938 | encodedString*res = fetchRawPart(mail,path,internal_call); |
939 | encodedString*r = decode_String(res,enc); | 939 | encodedString*r = decode_String(res,enc); |
@@ -946,22 +946,22 @@ QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path | |||
946 | } | 946 | } |
947 | return body; | 947 | return body; |
948 | } | 948 | } |
949 | 949 | ||
950 | QString IMAPwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | 950 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) |
951 | { | 951 | { |
952 | return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); | 952 | return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); |
953 | } | 953 | } |
954 | 954 | ||
955 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&part) | 955 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part) |
956 | { | 956 | { |
957 | encodedString*res = fetchRawPart(mail,part.Positionlist(),false); | 957 | encodedString*res = fetchRawPart(mail,part.Positionlist(),false); |
958 | encodedString*r = decode_String(res,part.Encoding()); | 958 | encodedString*r = decode_String(res,part.Encoding()); |
959 | delete res; | 959 | delete res; |
960 | return r; | 960 | return r; |
961 | } | 961 | } |
962 | 962 | ||
963 | encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | 963 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) |
964 | { | 964 | { |
965 | return fetchRawPart(mail,part.Positionlist(),false); | 965 | return fetchRawPart(mail,part.Positionlist(),false); |
966 | } | 966 | } |
967 | 967 | ||
@@ -1054,9 +1054,8 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
1054 | mailimap_status_att_list * att_list =0; | 1054 | mailimap_status_att_list * att_list =0; |
1055 | mailimap_mailbox_data_status * status=0; | 1055 | mailimap_mailbox_data_status * status=0; |
1056 | clistiter * cur = 0; | 1056 | clistiter * cur = 0; |
1057 | int r = 0; | 1057 | int r = 0; |
1058 | int res = 0; | ||
1059 | target_stat.message_count = 0; | 1058 | target_stat.message_count = 0; |
1060 | target_stat.message_unseen = 0; | 1059 | target_stat.message_unseen = 0; |
1061 | target_stat.message_recent = 0; | 1060 | target_stat.message_recent = 0; |
1062 | login(); | 1061 | login(); |
@@ -1114,9 +1113,9 @@ const QString&IMAPwrapper::getName()const | |||
1114 | qDebug("Get name: %s",account->getAccountName().latin1()); | 1113 | qDebug("Get name: %s",account->getAccountName().latin1()); |
1115 | return account->getAccountName(); | 1114 | return account->getAccountName(); |
1116 | } | 1115 | } |
1117 | 1116 | ||
1118 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | 1117 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1119 | { | 1118 | { |
1120 | // dummy | 1119 | // dummy |
1121 | QValueList<int> path; | 1120 | QValueList<int> path; |
1122 | return fetchRawPart(mail,path,false); | 1121 | return fetchRawPart(mail,path,false); |
@@ -1153,9 +1152,9 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | |||
1153 | deleteAllMail(fromFolder); | 1152 | deleteAllMail(fromFolder); |
1154 | } | 1153 | } |
1155 | } | 1154 | } |
1156 | 1155 | ||
1157 | void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 1156 | void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
1158 | { | 1157 | { |
1159 | if (targetWrapper != this) { | 1158 | if (targetWrapper != this) { |
1160 | qDebug("Using generic"); | 1159 | qDebug("Using generic"); |
1161 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 1160 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
@@ -1165,13 +1164,13 @@ void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,Abstrac | |||
1165 | login(); | 1164 | login(); |
1166 | if (!m_imap) { | 1165 | if (!m_imap) { |
1167 | return; | 1166 | return; |
1168 | } | 1167 | } |
1169 | int err = selectMbox(mail.getMbox()); | 1168 | int err = selectMbox(mail->getMbox()); |
1170 | if ( err != MAILIMAP_NO_ERROR ) { | 1169 | if ( err != MAILIMAP_NO_ERROR ) { |
1171 | return; | 1170 | return; |
1172 | } | 1171 | } |
1173 | set = mailimap_set_new_single(mail.getNumber()); | 1172 | set = mailimap_set_new_single(mail->getNumber()); |
1174 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1173 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1175 | mailimap_set_free( set ); | 1174 | mailimap_set_free( set ); |
1176 | if ( err != MAILIMAP_NO_ERROR ) { | 1175 | if ( err != MAILIMAP_NO_ERROR ) { |
1177 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); | 1176 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); |