-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 1ed9f34..0b6adf7 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp | |||
@@ -331,69 +331,69 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | |||
331 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 331 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
332 | break; | 332 | break; |
333 | default: | 333 | default: |
334 | ; // odebug << "Generic: unkown mailimf address type" << oendl; | 334 | ; // odebug << "Generic: unkown mailimf address type" << oendl; |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | return result; | 339 | return result; |
340 | } | 340 | } |
341 | 341 | ||
342 | QString Genericwrapper::parseGroup( mailimf_group *group ) | 342 | QString Genericwrapper::parseGroup( mailimf_group *group ) |
343 | { | 343 | { |
344 | QString result( "" ); | 344 | QString result( "" ); |
345 | 345 | ||
346 | result.append( group->grp_display_name ); | 346 | result.append( group->grp_display_name ); |
347 | result.append( ": " ); | 347 | result.append( ": " ); |
348 | 348 | ||
349 | if ( group->grp_mb_list != NULL ) { | 349 | if ( group->grp_mb_list != NULL ) { |
350 | result.append( parseMailboxList( group->grp_mb_list ) ); | 350 | result.append( parseMailboxList( group->grp_mb_list ) ); |
351 | } | 351 | } |
352 | 352 | ||
353 | result.append( ";" ); | 353 | result.append( ";" ); |
354 | 354 | ||
355 | return result; | 355 | return result; |
356 | } | 356 | } |
357 | 357 | ||
358 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | 358 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) |
359 | { | 359 | { |
360 | QString result( "" ); | 360 | QString result( "" ); |
361 | 361 | ||
362 | if ( box->mb_display_name == NULL ) { | 362 | if ( box->mb_display_name == NULL ) { |
363 | result.append( box->mb_addr_spec ); | 363 | result.append( convert_String(box->mb_addr_spec) ); |
364 | } else { | 364 | } else { |
365 | result.append( convert_String(box->mb_display_name) ); | 365 | result.append( convert_String(box->mb_display_name) ); |
366 | result.append( " <" ); | 366 | result.append( " <" ); |
367 | result.append( box->mb_addr_spec ); | 367 | result.append( convert_String( box->mb_addr_spec) ); |
368 | result.append( ">" ); | 368 | result.append( ">" ); |
369 | } | 369 | } |
370 | 370 | ||
371 | return result; | 371 | return result; |
372 | } | 372 | } |
373 | 373 | ||
374 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | 374 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) |
375 | { | 375 | { |
376 | QString result( "" ); | 376 | QString result( "" ); |
377 | 377 | ||
378 | bool first = true; | 378 | bool first = true; |
379 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | 379 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { |
380 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | 380 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; |
381 | 381 | ||
382 | if ( !first ) { | 382 | if ( !first ) { |
383 | result.append( "," ); | 383 | result.append( "," ); |
384 | } else { | 384 | } else { |
385 | first = false; | 385 | first = false; |
386 | } | 386 | } |
387 | 387 | ||
388 | result.append( parseMailbox( box ) ); | 388 | result.append( parseMailbox( box ) ); |
389 | } | 389 | } |
390 | 390 | ||
391 | return result; | 391 | return result; |
392 | } | 392 | } |
393 | 393 | ||
394 | encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) | 394 | encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) |
395 | { | 395 | { |
396 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); | 396 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); |
397 | if (it==bodyCache.end()) return new encodedString(); | 397 | if (it==bodyCache.end()) return new encodedString(); |
398 | encodedString*t = decode_String(it.data(),part->Encoding()); | 398 | encodedString*t = decode_String(it.data(),part->Encoding()); |
399 | return t; | 399 | return t; |
@@ -461,66 +461,67 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
461 | ; // odebug << "Error filling message list" << oendl; | 461 | ; // odebug << "Error filling message list" << oendl; |
462 | if (env_list) { | 462 | if (env_list) { |
463 | mailmessage_list_free(env_list); | 463 | mailmessage_list_free(env_list); |
464 | } | 464 | } |
465 | return; | 465 | return; |
466 | } | 466 | } |
467 | mailimf_references * refs = 0; | 467 | mailimf_references * refs = 0; |
468 | mailimf_in_reply_to * in_replies = 0; | 468 | mailimf_in_reply_to * in_replies = 0; |
469 | uint32_t i = 0; | 469 | uint32_t i = 0; |
470 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 470 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
471 | mailmessage * msg; | 471 | mailmessage * msg; |
472 | QBitArray mFlags(7); | 472 | QBitArray mFlags(7); |
473 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 473 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
474 | if (msg->msg_fields == NULL) { | 474 | if (msg->msg_fields == NULL) { |
475 | //; // odebug << "could not fetch envelope of message " << i << "" << oendl; | 475 | //; // odebug << "could not fetch envelope of message " << i << "" << oendl; |
476 | continue; | 476 | continue; |
477 | } | 477 | } |
478 | RecMailP mail = new RecMail(); | 478 | RecMailP mail = new RecMail(); |
479 | mail->setWrapper(this); | 479 | mail->setWrapper(this); |
480 | mail_flags * flag_result = 0; | 480 | mail_flags * flag_result = 0; |
481 | r = mailmessage_get_flags(msg,&flag_result); | 481 | r = mailmessage_get_flags(msg,&flag_result); |
482 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 482 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
483 | mFlags.setBit(FLAG_SEEN); | 483 | mFlags.setBit(FLAG_SEEN); |
484 | } | 484 | } |
485 | mailimf_single_fields single_fields; | 485 | mailimf_single_fields single_fields; |
486 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 486 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
487 | mail->setMsgsize(msg->msg_size); | 487 | mail->setMsgsize(msg->msg_size); |
488 | mail->setFlags(mFlags); | 488 | mail->setFlags(mFlags); |
489 | mail->setMbox(mailbox); | 489 | mail->setMbox(mailbox); |
490 | mail->setNumber(msg->msg_index); | 490 | mail->setNumber(msg->msg_index); |
491 | if (single_fields.fld_subject) | 491 | if (single_fields.fld_subject) |
492 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 492 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
493 | if (single_fields.fld_from) | 493 | if (single_fields.fld_from) { |
494 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 494 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
495 | } | ||
495 | if (!mbox_as_to) { | 496 | if (!mbox_as_to) { |
496 | if (single_fields.fld_to) | 497 | if (single_fields.fld_to) |
497 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 498 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
498 | } else { | 499 | } else { |
499 | mail->setTo(mailbox); | 500 | mail->setTo(mailbox); |
500 | } | 501 | } |
501 | if (single_fields.fld_cc) | 502 | if (single_fields.fld_cc) |
502 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 503 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
503 | if (single_fields.fld_bcc) | 504 | if (single_fields.fld_bcc) |
504 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 505 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
505 | if (single_fields.fld_orig_date) { | 506 | if (single_fields.fld_orig_date) { |
506 | QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); | 507 | QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); |
507 | QString ret; | 508 | QString ret; |
508 | if ( dt.date() == QDate::currentDate () ) | 509 | if ( dt.date() == QDate::currentDate () ) |
509 | ret = KGlobal::locale()->formatTime( dt.time(),true); | 510 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
510 | else { | 511 | else { |
511 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | 512 | ret = KGlobal::locale()->formatDateTime( dt,true,true); |
512 | } | 513 | } |
513 | mail->setDate( ret ); | 514 | mail->setDate( ret ); |
514 | char tmp[20]; | 515 | char tmp[20]; |
515 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | 516 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", |
516 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | 517 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); |
517 | //qDebug(" iso %s ", tmp); | 518 | //qDebug(" iso %s ", tmp); |
518 | mail->setIsoDate( QString( tmp ) ); | 519 | mail->setIsoDate( QString( tmp ) ); |
519 | } | 520 | } |
520 | // crashes when accessing pop3 account? | 521 | // crashes when accessing pop3 account? |
521 | if (single_fields.fld_message_id) { | 522 | if (single_fields.fld_message_id) { |
522 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 523 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
523 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; | 524 | ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; |
524 | } | 525 | } |
525 | if (single_fields.fld_reply_to) { | 526 | if (single_fields.fld_reply_to) { |
526 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 527 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |