author | alwin <alwin> | 2004-03-08 21:43:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 21:43:14 (UTC) |
commit | 25434cbbcd2d2473c9cd3d486cec7a96a6a6323e (patch) (unidiff) | |
tree | 31cfa6ceaebe0e2e1e0094e4905d05509e778364 /noncore/net/mail/libmailwrapper/genericwrapper.cpp | |
parent | f3f2b2b3389d62af0f1a3aabac87f6c3cf147379 (diff) | |
download | opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.zip opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.tar.gz opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.tar.bz2 |
some required code restructuring in preparation of new features
Diffstat (limited to 'noncore/net/mail/libmailwrapper/genericwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index eb2c031..137a6ef 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -364,12 +364,32 @@ void Genericwrapper::cleanMimeCache() | |||
364 | if (t) delete t; | 364 | if (t) delete t; |
365 | } | 365 | } |
366 | bodyCache.clear(); | 366 | bodyCache.clear(); |
367 | qDebug("Genericwrapper: cache cleaned"); | 367 | qDebug("Genericwrapper: cache cleaned"); |
368 | } | 368 | } |
369 | 369 | ||
370 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | ||
371 | { | ||
372 | QStringList res; | ||
373 | if (!in_replies || !in_replies->mid_list) return res; | ||
374 | clistiter * current = 0; | ||
375 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { | ||
376 | QString h((char*)current->data); | ||
377 | while (h.length()>0 && h[0]=='<') { | ||
378 | h.remove(0,1); | ||
379 | } | ||
380 | while (h.length()>0 && h[h.length()-1]=='>') { | ||
381 | h.remove(h.length()-1,1); | ||
382 | } | ||
383 | if (h.length()>0) { | ||
384 | res.append(h); | ||
385 | } | ||
386 | } | ||
387 | return res; | ||
388 | } | ||
389 | |||
370 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 390 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
371 | { | 391 | { |
372 | int r; | 392 | int r; |
373 | mailmessage_list * env_list = 0; | 393 | mailmessage_list * env_list = 0; |
374 | r = mailsession_get_messages_list(session,&env_list); | 394 | r = mailsession_get_messages_list(session,&env_list); |
375 | if (r != MAIL_NO_ERROR) { | 395 | if (r != MAIL_NO_ERROR) { |
@@ -381,13 +401,14 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
381 | qDebug("Error filling message list"); | 401 | qDebug("Error filling message list"); |
382 | if (env_list) { | 402 | if (env_list) { |
383 | mailmessage_list_free(env_list); | 403 | mailmessage_list_free(env_list); |
384 | } | 404 | } |
385 | return; | 405 | return; |
386 | } | 406 | } |
387 | mailimf_references * refs; | 407 | mailimf_references * refs = 0; |
408 | mailimf_in_reply_to * in_replies = 0; | ||
388 | uint32_t i = 0; | 409 | uint32_t i = 0; |
389 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 410 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
390 | mailmessage * msg; | 411 | mailmessage * msg; |
391 | QBitArray mFlags(7); | 412 | QBitArray mFlags(7); |
392 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 413 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
393 | if (msg->msg_fields == NULL) { | 414 | if (msg->msg_fields == NULL) { |
@@ -423,19 +444,24 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
423 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 444 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
424 | if (single_fields.fld_orig_date) | 445 | if (single_fields.fld_orig_date) |
425 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 446 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
426 | // crashes when accessing pop3 account? | 447 | // crashes when accessing pop3 account? |
427 | if (single_fields.fld_message_id->mid_value) { | 448 | if (single_fields.fld_message_id->mid_value) { |
428 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 449 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
429 | qDebug("Msqgid == %s",mail->Msgid().latin1()); | 450 | qDebug("Msgid == %s",mail->Msgid().latin1()); |
430 | } | 451 | } |
452 | |||
431 | refs = single_fields.fld_references; | 453 | refs = single_fields.fld_references; |
432 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 454 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
433 | char * text = (char*)refs->mid_list->first->data; | 455 | char * text = (char*)refs->mid_list->first->data; |
434 | mail->setReplyto(QString(text)); | 456 | mail->setReplyto(QString(text)); |
435 | } | 457 | } |
458 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && | ||
459 | clist_count(single_fields.fld_in_reply_to->mid_list)) { | ||
460 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); | ||
461 | } | ||
436 | target.append(mail); | 462 | target.append(mail); |
437 | } | 463 | } |
438 | if (env_list) { | 464 | if (env_list) { |
439 | mailmessage_list_free(env_list); | 465 | mailmessage_list_free(env_list); |
440 | } | 466 | } |
441 | } | 467 | } |