author | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-05 22:21:41 (UTC) |
commit | c8d0dd53a75b7142a5ce924e4afbea77b86e56b0 (patch) (side-by-side diff) | |
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 @@ -468,2 +468,6 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> clistcell*current,*cur; + mailimap_section_part * section_part = 0; + mailimap_section_spec * section_spec = 0; + mailimap_section * section = 0; + mailimap_fetch_att * fetch_att = 0; @@ -482,13 +486,20 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> set = mailimap_set_new_single(mail.getNumber()); - clist*id_list=clist_new(); - for (unsigned j=0; j < path.count();++j) { - uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); - *p_id = path[j]; - clist_append(id_list,p_id); - } - mailimap_section_part * section_part = mailimap_section_part_new(id_list); - mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); - mailimap_section * section = mailimap_section_new(section_spec); - mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); + clist*id_list = 0; + + /* if path == empty then its a request for the whole rfc822 mail and generates + a "fetch <id> (body[])" statement on imap server */ + if (path.count()>0 ) { + id_list = clist_new(); + for (unsigned j=0; j < path.count();++j) { + uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); + *p_id = path[j]; + clist_append(id_list,p_id); + } + section_part = mailimap_section_part_new(id_list); + section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); + } + + section = mailimap_section_new(section_spec); + fetch_att = mailimap_fetch_att_new_body_section(section); fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); @@ -957,20 +968,24 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); - for (cur = clist_begin(status->st_info_list); - cur != NULL ; cur = clist_next(cur)) { - mailimap_status_info * status_info; - status_info = (mailimap_status_info *)clist_content(cur); - switch (status_info->st_att) { - case MAILIMAP_STATUS_ATT_MESSAGES: - target_stat.message_count = status_info->st_value; - break; - case MAILIMAP_STATUS_ATT_RECENT: - target_stat.message_recent = status_info->st_value; - break; - case MAILIMAP_STATUS_ATT_UNSEEN: - target_stat.message_unseen = status_info->st_value; - break; + if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { + for (cur = clist_begin(status->st_info_list); + cur != NULL ; cur = clist_next(cur)) { + mailimap_status_info * status_info; + status_info = (mailimap_status_info *)clist_content(cur); + switch (status_info->st_att) { + case MAILIMAP_STATUS_ATT_MESSAGES: + target_stat.message_count = status_info->st_value; + break; + case MAILIMAP_STATUS_ATT_RECENT: + target_stat.message_recent = status_info->st_value; + break; + case MAILIMAP_STATUS_ATT_UNSEEN: + target_stat.message_unseen = status_info->st_value; + break; + } } + } else { + qDebug("Error retrieving status"); } - mailimap_mailbox_data_status_free(status); - mailimap_status_att_list_free(att_list); + if (status) mailimap_mailbox_data_status_free(status); + if (att_list) mailimap_status_att_list_free(att_list); } @@ -992 +1007,8 @@ const QString&IMAPwrapper::getType()const } + +encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) +{ + // dummy + QValueList<int> path; + return fetchRawPart(mail,path,false); +} |