Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 1acc036..725dcc9 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,10 +1,11 @@ | |||
1 | 1 | ||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include "imapwrapper.h" | 4 | #include "imapwrapper.h" |
5 | #include "mailtypes.h" | ||
5 | #include <libetpan/mailimap.h> | 6 | #include <libetpan/mailimap.h> |
6 | 7 | ||
7 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 8 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
8 | { | 9 | { |
9 | account = a; | 10 | account = a; |
10 | m_imap = 0; | 11 | m_imap = 0; |
@@ -61,13 +62,13 @@ void IMAPwrapper::logout() | |||
61 | err = mailimap_logout( m_imap ); | 62 | err = mailimap_logout( m_imap ); |
62 | err = mailimap_close( m_imap ); | 63 | err = mailimap_close( m_imap ); |
63 | mailimap_free( m_imap ); | 64 | mailimap_free( m_imap ); |
64 | m_imap = 0; | 65 | m_imap = 0; |
65 | } | 66 | } |
66 | 67 | ||
67 | void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target ) | 68 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) |
68 | { | 69 | { |
69 | const char *mb; | 70 | const char *mb; |
70 | int err = MAILIMAP_NO_ERROR; | 71 | int err = MAILIMAP_NO_ERROR; |
71 | clist *result; | 72 | clist *result; |
72 | clistcell *current; | 73 | clistcell *current; |
73 | mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate; | 74 | mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate; |
@@ -326,15 +327,17 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
326 | m->setFlags(mFlags); | 327 | m->setFlags(mFlags); |
327 | } | 328 | } |
328 | return m; | 329 | return m; |
329 | } | 330 | } |
330 | 331 | ||
331 | #if 1 | 332 | #if 1 |
332 | QString IMAPwrapper::fetchBody(const RecMail&mail) | 333 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) |
333 | { | 334 | { |
334 | QString body = ""; | 335 | RecBody body; |
336 | QString body_text; | ||
337 | |||
335 | const char *mb; | 338 | const char *mb; |
336 | int err = MAILIMAP_NO_ERROR; | 339 | int err = MAILIMAP_NO_ERROR; |
337 | clist *result; | 340 | clist *result; |
338 | clistcell *current; | 341 | clistcell *current; |
339 | mailimap_fetch_att *fetchAtt; | 342 | mailimap_fetch_att *fetchAtt; |
340 | mailimap_fetch_type *fetchType; | 343 | mailimap_fetch_type *fetchType; |
@@ -365,13 +368,14 @@ QString IMAPwrapper::fetchBody(const RecMail&mail) | |||
365 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 368 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
366 | mailimap_msg_att * msg_att; | 369 | mailimap_msg_att * msg_att; |
367 | msg_att = (mailimap_msg_att*)current->data; | 370 | msg_att = (mailimap_msg_att*)current->data; |
368 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; | 371 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; |
369 | 372 | ||
370 | if (item->msg_att_static && item->msg_att_static->rfc822_text) { | 373 | if (item->msg_att_static && item->msg_att_static->rfc822_text) { |
371 | body = item->msg_att_static->rfc822_text; | 374 | body_text = item->msg_att_static->rfc822_text; |
375 | body.setBodytext(body_text); | ||
372 | } | 376 | } |
373 | } else { | 377 | } else { |
374 | qDebug("error fetching text: %s",m_imap->response); | 378 | qDebug("error fetching text: %s",m_imap->response); |
375 | } | 379 | } |
376 | 380 | ||
377 | clist_free(result); | 381 | clist_free(result); |