Diffstat (limited to 'noncore/net/mail/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 1acc036..725dcc9 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp @@ -1,16 +1,17 @@ #include <stdlib.h> #include "imapwrapper.h" +#include "mailtypes.h" #include <libetpan/mailimap.h> IMAPwrapper::IMAPwrapper( IMAPaccount *a ) { account = a; m_imap = 0; } IMAPwrapper::~IMAPwrapper() { logout(); } @@ -55,25 +56,25 @@ void IMAPwrapper::login() } void IMAPwrapper::logout() { int err = MAILIMAP_NO_ERROR; if (!m_imap) return; err = mailimap_logout( m_imap ); err = mailimap_close( m_imap ); mailimap_free( m_imap ); m_imap = 0; } -void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target ) +void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) { const char *mb; int err = MAILIMAP_NO_ERROR; clist *result; clistcell *current; mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate; mailimap_fetch_type *fetchType; mailimap_set *set; mb = mailbox.latin1(); login(); if (!m_imap) { @@ -320,27 +321,29 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) /* msg is already deleted */ if (mFlags.testBit(FLAG_DELETED) && m) { delete m; m = 0; } if (m) { m->setFlags(mFlags); } return m; } #if 1 -QString IMAPwrapper::fetchBody(const RecMail&mail) +RecBody IMAPwrapper::fetchBody(const RecMail&mail) { - QString body = ""; + RecBody body; + QString body_text; + const char *mb; int err = MAILIMAP_NO_ERROR; clist *result; clistcell *current; mailimap_fetch_att *fetchAtt; mailimap_fetch_type *fetchType; mailimap_set *set; mb = mail.getMbox().latin1(); login(); if (!m_imap) { @@ -359,25 +362,26 @@ QString IMAPwrapper::fetchBody(const RecMail&mail) fetchAtt = mailimap_fetch_att_new_rfc822_text(); fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); err = mailimap_fetch( m_imap, set, fetchType, &result ); mailimap_set_free( set ); mailimap_fetch_type_free( fetchType ); if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { mailimap_msg_att * msg_att; msg_att = (mailimap_msg_att*)current->data; mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; if (item->msg_att_static && item->msg_att_static->rfc822_text) { - body = item->msg_att_static->rfc822_text; + body_text = item->msg_att_static->rfc822_text; + body.setBodytext(body_text); } } else { qDebug("error fetching text: %s",m_imap->response); } clist_free(result); logout(); return body; } #else QString IMAPwrapper::fetchBody(const RecMail&mail) |