author | alwin <alwin> | 2003-12-30 00:14:47 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-30 00:14:47 (UTC) |
commit | b636d3d91e8456b22bc450b3d7f3a862b7f615a9 (patch) (unidiff) | |
tree | 2d7fe53175453a28e4e1d08496f6f611221c1936 /noncore/net/mail/genericwrapper.cpp | |
parent | 2ecab614a6b91658b1608c62134cd14e257e55b7 (diff) | |
download | opie-b636d3d91e8456b22bc450b3d7f3a862b7f615a9.zip opie-b636d3d91e8456b22bc450b3d7f3a862b7f615a9.tar.gz opie-b636d3d91e8456b22bc450b3d7f3a862b7f615a9.tar.bz2 |
re-worked pop3 (use the more generic interface)
shared some more functions between mbox and pop3
Diffstat (limited to 'noncore/net/mail/genericwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index c1b6e48..bef6ae5 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp | |||
@@ -1,4 +1,3 @@ | |||
1 | #include "genericwrapper.h" | 1 | #include "genericwrapper.h" |
2 | #include <libetpan/mailmime.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include <libetpan/data_message_driver.h> | ||
4 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
@@ -393 +392,67 @@ void Genericwrapper::cleanMimeCache() | |||
393 | } | 392 | } |
393 | |||
394 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) | ||
395 | { | ||
396 | int r; | ||
397 | mailmessage_list * env_list = 0; | ||
398 | r = mailsession_get_messages_list(session,&env_list); | ||
399 | if (r != MAIL_NO_ERROR) { | ||
400 | qDebug("Error message list"); | ||
401 | return; | ||
402 | } | ||
403 | r = mailsession_get_envelopes_list(session, env_list); | ||
404 | if (r != MAIL_NO_ERROR) { | ||
405 | qDebug("Error filling message list"); | ||
406 | if (env_list) { | ||
407 | mailmessage_list_free(env_list); | ||
408 | } | ||
409 | return; | ||
410 | } | ||
411 | mailimf_references * refs; | ||
412 | uint32_t i = 0; | ||
413 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | ||
414 | mailmessage * msg; | ||
415 | QBitArray mFlags(7); | ||
416 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | ||
417 | if (msg->msg_fields == NULL) { | ||
418 | qDebug("could not fetch envelope of message %i", i); | ||
419 | continue; | ||
420 | } | ||
421 | RecMail * mail = new RecMail(); | ||
422 | mail->setWrapper(this); | ||
423 | mail_flags * flag_result = 0; | ||
424 | r = mailmessage_get_flags(msg,&flag_result); | ||
425 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | ||
426 | mFlags.setBit(FLAG_SEEN); | ||
427 | } | ||
428 | mailimf_single_fields single_fields; | ||
429 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | ||
430 | mail->setMsgsize(msg->msg_size); | ||
431 | mail->setFlags(mFlags); | ||
432 | mail->setMbox(mailbox); | ||
433 | mail->setNumber(i+1); | ||
434 | if (single_fields.fld_subject) | ||
435 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | ||
436 | if (single_fields.fld_from) | ||
437 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | ||
438 | if (single_fields.fld_to) | ||
439 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | ||
440 | if (single_fields.fld_cc) | ||
441 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | ||
442 | if (single_fields.fld_bcc) | ||
443 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | ||
444 | if (single_fields.fld_orig_date) | ||
445 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | ||
446 | if (single_fields.fld_message_id->mid_value) | ||
447 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | ||
448 | refs = single_fields.fld_references; | ||
449 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
450 | char * text = (char*)refs->mid_list->first->data; | ||
451 | mail->setReplyto(QString(text)); | ||
452 | } | ||
453 | target.append(mail); | ||
454 | } | ||
455 | if (env_list) { | ||
456 | mailmessage_list_free(env_list); | ||
457 | } | ||
458 | } | ||