author | jgf <jgf> | 2004-01-07 00:24:52 (UTC) |
---|---|---|
committer | jgf <jgf> | 2004-01-07 00:24:52 (UTC) |
commit | 656e80e7b35c4aefd49ffe7756d895f4e7370de1 (patch) (unidiff) | |
tree | 41448111df3e76f9185203f97405b141e830d9e6 | |
parent | a0ea0a96c91d95aa379a086238de18075ee5e4b5 (diff) | |
download | opie-656e80e7b35c4aefd49ffe7756d895f4e7370de1.zip opie-656e80e7b35c4aefd49ffe7756d895f4e7370de1.tar.gz opie-656e80e7b35c4aefd49ffe7756d895f4e7370de1.tar.bz2 |
pop3 crash - quick fix
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 714396b..2d1596d 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -395,109 +395,110 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | |||
395 | } | 395 | } |
396 | 396 | ||
397 | result.append( parseMailbox( box ) ); | 397 | result.append( parseMailbox( box ) ); |
398 | } | 398 | } |
399 | 399 | ||
400 | return result; | 400 | return result; |
401 | } | 401 | } |
402 | 402 | ||
403 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | 403 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) |
404 | { | 404 | { |
405 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 405 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
406 | if (it==bodyCache.end()) return new encodedString(); | 406 | if (it==bodyCache.end()) return new encodedString(); |
407 | encodedString*t = decode_String(it.data(),part.Encoding()); | 407 | encodedString*t = decode_String(it.data(),part.Encoding()); |
408 | return t; | 408 | return t; |
409 | } | 409 | } |
410 | 410 | ||
411 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | 411 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) |
412 | { | 412 | { |
413 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 413 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
414 | if (it==bodyCache.end()) return new encodedString(); | 414 | if (it==bodyCache.end()) return new encodedString(); |
415 | encodedString*t = it.data(); | 415 | encodedString*t = it.data(); |
416 | return t; | 416 | return t; |
417 | } | 417 | } |
418 | 418 | ||
419 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | 419 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) |
420 | { | 420 | { |
421 | encodedString*t = fetchDecodedPart(mail,part); | 421 | encodedString*t = fetchDecodedPart(mail,part); |
422 | QString text=t->Content(); | 422 | QString text=t->Content(); |
423 | delete t; | 423 | delete t; |
424 | return text; | 424 | return text; |
425 | } | 425 | } |
426 | 426 | ||
427 | void Genericwrapper::cleanMimeCache() | 427 | void Genericwrapper::cleanMimeCache() |
428 | { | 428 | { |
429 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 429 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
430 | for (;it!=bodyCache.end();++it) { | 430 | for (;it!=bodyCache.end();++it) { |
431 | encodedString*t = it.data(); | 431 | encodedString*t = it.data(); |
432 | //it.setValue(0); | 432 | //it.setValue(0); |
433 | if (t) delete t; | 433 | if (t) delete t; |
434 | } | 434 | } |
435 | bodyCache.clear(); | 435 | bodyCache.clear(); |
436 | qDebug("Genericwrapper: cache cleaned"); | 436 | qDebug("Genericwrapper: cache cleaned"); |
437 | } | 437 | } |
438 | 438 | ||
439 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) | 439 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) |
440 | { | 440 | { |
441 | int r; | 441 | int r; |
442 | mailmessage_list * env_list = 0; | 442 | mailmessage_list * env_list = 0; |
443 | r = mailsession_get_messages_list(session,&env_list); | 443 | r = mailsession_get_messages_list(session,&env_list); |
444 | if (r != MAIL_NO_ERROR) { | 444 | if (r != MAIL_NO_ERROR) { |
445 | qDebug("Error message list"); | 445 | qDebug("Error message list"); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | r = mailsession_get_envelopes_list(session, env_list); | 448 | r = mailsession_get_envelopes_list(session, env_list); |
449 | if (r != MAIL_NO_ERROR) { | 449 | if (r != MAIL_NO_ERROR) { |
450 | qDebug("Error filling message list"); | 450 | qDebug("Error filling message list"); |
451 | if (env_list) { | 451 | if (env_list) { |
452 | mailmessage_list_free(env_list); | 452 | mailmessage_list_free(env_list); |
453 | } | 453 | } |
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | mailimf_references * refs; | 456 | mailimf_references * refs; |
457 | uint32_t i = 0; | 457 | uint32_t i = 0; |
458 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 458 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
459 | mailmessage * msg; | 459 | mailmessage * msg; |
460 | QBitArray mFlags(7); | 460 | QBitArray mFlags(7); |
461 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 461 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
462 | if (msg->msg_fields == NULL) { | 462 | if (msg->msg_fields == NULL) { |
463 | qDebug("could not fetch envelope of message %i", i); | 463 | qDebug("could not fetch envelope of message %i", i); |
464 | continue; | 464 | continue; |
465 | } | 465 | } |
466 | RecMail * mail = new RecMail(); | 466 | RecMail * mail = new RecMail(); |
467 | mail->setWrapper(this); | 467 | mail->setWrapper(this); |
468 | mail_flags * flag_result = 0; | 468 | mail_flags * flag_result = 0; |
469 | r = mailmessage_get_flags(msg,&flag_result); | 469 | r = mailmessage_get_flags(msg,&flag_result); |
470 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 470 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
471 | mFlags.setBit(FLAG_SEEN); | 471 | mFlags.setBit(FLAG_SEEN); |
472 | } | 472 | } |
473 | mailimf_single_fields single_fields; | 473 | mailimf_single_fields single_fields; |
474 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 474 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
475 | mail->setMsgsize(msg->msg_size); | 475 | mail->setMsgsize(msg->msg_size); |
476 | mail->setFlags(mFlags); | 476 | mail->setFlags(mFlags); |
477 | mail->setMbox(mailbox); | 477 | mail->setMbox(mailbox); |
478 | mail->setNumber(msg->msg_index); | 478 | mail->setNumber(msg->msg_index); |
479 | if (single_fields.fld_subject) | 479 | if (single_fields.fld_subject) |
480 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 480 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
481 | if (single_fields.fld_from) | 481 | if (single_fields.fld_from) |
482 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 482 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
483 | if (single_fields.fld_to) | 483 | if (single_fields.fld_to) |
484 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 484 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
485 | if (single_fields.fld_cc) | 485 | if (single_fields.fld_cc) |
486 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 486 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
487 | if (single_fields.fld_bcc) | 487 | if (single_fields.fld_bcc) |
488 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 488 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
489 | if (single_fields.fld_orig_date) | 489 | if (single_fields.fld_orig_date) |
490 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 490 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
491 | if (single_fields.fld_message_id->mid_value) | 491 | // crashes when accessing pop3 account |
492 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 492 | // if (single_fields.fld_message_id->mid_value) |
493 | // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | ||
493 | refs = single_fields.fld_references; | 494 | refs = single_fields.fld_references; |
494 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 495 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
495 | char * text = (char*)refs->mid_list->first->data; | 496 | char * text = (char*)refs->mid_list->first->data; |
496 | mail->setReplyto(QString(text)); | 497 | mail->setReplyto(QString(text)); |
497 | } | 498 | } |
498 | target.append(mail); | 499 | target.append(mail); |
499 | } | 500 | } |
500 | if (env_list) { | 501 | if (env_list) { |
501 | mailmessage_list_free(env_list); | 502 | mailmessage_list_free(env_list); |
502 | } | 503 | } |
503 | } | 504 | } |