author | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
commit | c8d0dd53a75b7142a5ce924e4afbea77b86e56b0 (patch) (unidiff) | |
tree | 2845e68c4a3ee0daa7f732a29fefd81d47c90f9d /noncore/net/mail/libmailwrapper/imapwrapper.cpp | |
parent | 07278dd6ba68e3ff55d22acc76a28956b06d5d9c (diff) | |
download | opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.zip opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.gz opie-c8d0dd53a75b7142a5ce924e4afbea77b86e56b0.tar.bz2 |
bugfix in imapwrapper
storemail for all possible mail-accounts
raw body fetch in all wrappers
unified public interface
dialog for selecting a target mailbox started
Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 95b317a..d252159 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -465,8 +465,12 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
465 | int err; | 465 | int err; |
466 | mailimap_fetch_type *fetchType; | 466 | mailimap_fetch_type *fetchType; |
467 | mailimap_set *set; | 467 | mailimap_set *set; |
468 | clistcell*current,*cur; | 468 | clistcell*current,*cur; |
469 | mailimap_section_part * section_part = 0; | ||
470 | mailimap_section_spec * section_spec = 0; | ||
471 | mailimap_section * section = 0; | ||
472 | mailimap_fetch_att * fetch_att = 0; | ||
469 | 473 | ||
470 | login(); | 474 | login(); |
471 | if (!m_imap) { | 475 | if (!m_imap) { |
472 | return res; | 476 | return res; |
@@ -479,19 +483,26 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
479 | return res; | 483 | return res; |
480 | } | 484 | } |
481 | } | 485 | } |
482 | set = mailimap_set_new_single(mail.getNumber()); | 486 | set = mailimap_set_new_single(mail.getNumber()); |
483 | clist*id_list=clist_new(); | ||
484 | for (unsigned j=0; j < path.count();++j) { | ||
485 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
486 | *p_id = path[j]; | ||
487 | clist_append(id_list,p_id); | ||
488 | } | ||
489 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | ||
490 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
491 | mailimap_section * section = mailimap_section_new(section_spec); | ||
492 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | ||
493 | 487 | ||
488 | clist*id_list = 0; | ||
489 | |||
490 | /* if path == empty then its a request for the whole rfc822 mail and generates | ||
491 | a "fetch <id> (body[])" statement on imap server */ | ||
492 | if (path.count()>0 ) { | ||
493 | id_list = clist_new(); | ||
494 | for (unsigned j=0; j < path.count();++j) { | ||
495 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
496 | *p_id = path[j]; | ||
497 | clist_append(id_list,p_id); | ||
498 | } | ||
499 | section_part = mailimap_section_part_new(id_list); | ||
500 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
501 | } | ||
502 | |||
503 | section = mailimap_section_new(section_spec); | ||
504 | fetch_att = mailimap_fetch_att_new_body_section(section); | ||
494 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 505 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
495 | 506 | ||
496 | clist*result = 0; | 507 | clist*result = 0; |
497 | 508 | ||
@@ -954,26 +965,30 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
954 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); | 965 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); |
955 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); | 966 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); |
956 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); | 967 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); |
957 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); | 968 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); |
958 | for (cur = clist_begin(status->st_info_list); | 969 | if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { |
959 | cur != NULL ; cur = clist_next(cur)) { | 970 | for (cur = clist_begin(status->st_info_list); |
960 | mailimap_status_info * status_info; | 971 | cur != NULL ; cur = clist_next(cur)) { |
961 | status_info = (mailimap_status_info *)clist_content(cur); | 972 | mailimap_status_info * status_info; |
962 | switch (status_info->st_att) { | 973 | status_info = (mailimap_status_info *)clist_content(cur); |
963 | case MAILIMAP_STATUS_ATT_MESSAGES: | 974 | switch (status_info->st_att) { |
964 | target_stat.message_count = status_info->st_value; | 975 | case MAILIMAP_STATUS_ATT_MESSAGES: |
965 | break; | 976 | target_stat.message_count = status_info->st_value; |
966 | case MAILIMAP_STATUS_ATT_RECENT: | 977 | break; |
967 | target_stat.message_recent = status_info->st_value; | 978 | case MAILIMAP_STATUS_ATT_RECENT: |
968 | break; | 979 | target_stat.message_recent = status_info->st_value; |
969 | case MAILIMAP_STATUS_ATT_UNSEEN: | 980 | break; |
970 | target_stat.message_unseen = status_info->st_value; | 981 | case MAILIMAP_STATUS_ATT_UNSEEN: |
971 | break; | 982 | target_stat.message_unseen = status_info->st_value; |
983 | break; | ||
984 | } | ||
972 | } | 985 | } |
986 | } else { | ||
987 | qDebug("Error retrieving status"); | ||
973 | } | 988 | } |
974 | mailimap_mailbox_data_status_free(status); | 989 | if (status) mailimap_mailbox_data_status_free(status); |
975 | mailimap_status_att_list_free(att_list); | 990 | if (att_list) mailimap_status_att_list_free(att_list); |
976 | } | 991 | } |
977 | 992 | ||
978 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 993 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
979 | { | 994 | { |
@@ -989,4 +1004,11 @@ void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
989 | const QString&IMAPwrapper::getType()const | 1004 | const QString&IMAPwrapper::getType()const |
990 | { | 1005 | { |
991 | return account->getType(); | 1006 | return account->getType(); |
992 | } | 1007 | } |
1008 | |||
1009 | encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) | ||
1010 | { | ||
1011 | // dummy | ||
1012 | QValueList<int> path; | ||
1013 | return fetchRawPart(mail,path,false); | ||
1014 | } | ||