summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/imapwrapper.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp36
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>
mailimap_set *set;
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;
login();
@@ -481,5 +485,11 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
}
set = mailimap_set_new_single(mail.getNumber());
- clist*id_list=clist_new();
+
+ 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));
@@ -487,9 +497,10 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
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);
+ 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);
@@ -956,4 +967,5 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN);
r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status);
+ if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) {
for (cur = clist_begin(status->st_info_list);
cur != NULL ; cur = clist_next(cur)) {
@@ -972,6 +984,9 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
}
}
- mailimap_mailbox_data_status_free(status);
- mailimap_status_att_list_free(att_list);
+ } else {
+ qDebug("Error retrieving status");
+ }
+ if (status) mailimap_mailbox_data_status_free(status);
+ if (att_list) mailimap_status_att_list_free(att_list);
}
@@ -991,2 +1006,9 @@ const QString&IMAPwrapper::getType()const
return account->getType();
}
+
+encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
+{
+ // dummy
+ QValueList<int> path;
+ return fetchRawPart(mail,path,false);
+}