Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 36 |
1 files changed, 29 insertions, 7 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 | |||
@@ -467,4 +467,8 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
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(); |
@@ -481,5 +485,11 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
481 | } | 485 | } |
482 | set = mailimap_set_new_single(mail.getNumber()); | 486 | set = mailimap_set_new_single(mail.getNumber()); |
483 | clist*id_list=clist_new(); | 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(); | ||
484 | for (unsigned j=0; j < path.count();++j) { | 494 | for (unsigned j=0; j < path.count();++j) { |
485 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 495 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
@@ -487,9 +497,10 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> | |||
487 | clist_append(id_list,p_id); | 497 | clist_append(id_list,p_id); |
488 | } | 498 | } |
489 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | 499 | 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); | 500 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
491 | mailimap_section * section = mailimap_section_new(section_spec); | 501 | } |
492 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | ||
493 | 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 | ||
@@ -956,4 +967,5 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
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); |
969 | if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { | ||
958 | for (cur = clist_begin(status->st_info_list); | 970 | for (cur = clist_begin(status->st_info_list); |
959 | cur != NULL ; cur = clist_next(cur)) { | 971 | cur != NULL ; cur = clist_next(cur)) { |
@@ -972,6 +984,9 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
972 | } | 984 | } |
973 | } | 985 | } |
974 | mailimap_mailbox_data_status_free(status); | 986 | } else { |
975 | mailimap_status_att_list_free(att_list); | 987 | qDebug("Error retrieving status"); |
988 | } | ||
989 | if (status) mailimap_mailbox_data_status_free(status); | ||
990 | if (att_list) mailimap_status_att_list_free(att_list); | ||
976 | } | 991 | } |
977 | 992 | ||
@@ -991,2 +1006,9 @@ const QString&IMAPwrapper::getType()const | |||
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 | } | ||