-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d9496af..93fb7de 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -375,300 +375,305 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
375 | */ | 375 | */ |
376 | mask = "*" ; | 376 | mask = "*" ; |
377 | path = account->getPrefix().latin1(); | 377 | path = account->getPrefix().latin1(); |
378 | if (!path) path = ""; | 378 | if (!path) path = ""; |
379 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 379 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
380 | if ( err == MAILIMAP_NO_ERROR ) { | 380 | if ( err == MAILIMAP_NO_ERROR ) { |
381 | current = result->first; | 381 | current = result->first; |
382 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | 382 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { |
383 | no_inferiors = false; | 383 | no_inferiors = false; |
384 | list = (mailimap_mailbox_list *) current->data; | 384 | list = (mailimap_mailbox_list *) current->data; |
385 | // it is better use the deep copy mechanism of qt itself | 385 | // it is better use the deep copy mechanism of qt itself |
386 | // instead of using strdup! | 386 | // instead of using strdup! |
387 | temp = list->mb_name; | 387 | temp = list->mb_name; |
388 | if (temp.lower()=="inbox") | 388 | if (temp.lower()=="inbox") |
389 | continue; | 389 | continue; |
390 | if (temp.lower()==account->getPrefix().lower()) | 390 | if (temp.lower()==account->getPrefix().lower()) |
391 | continue; | 391 | continue; |
392 | if ( (bflags = list->mb_flag) ) { | 392 | if ( (bflags = list->mb_flag) ) { |
393 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 393 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
394 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 394 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
395 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 395 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
396 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 396 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
397 | no_inferiors = true; | 397 | no_inferiors = true; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | } | 400 | } |
401 | del = list->mb_delimiter; | 401 | del = list->mb_delimiter; |
402 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 402 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
403 | } | 403 | } |
404 | } else { | 404 | } else { |
405 | qDebug("error fetching folders "); | 405 | qDebug("error fetching folders "); |
406 | 406 | ||
407 | } | 407 | } |
408 | if (result) mailimap_list_result_free( result ); | 408 | if (result) mailimap_list_result_free( result ); |
409 | return folders; | 409 | return folders; |
410 | } | 410 | } |
411 | 411 | ||
412 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 412 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
413 | { | 413 | { |
414 | RecMail * m = 0; | 414 | RecMail * m = 0; |
415 | mailimap_msg_att_item *item=0; | 415 | mailimap_msg_att_item *item=0; |
416 | clistcell *current,*c,*cf; | 416 | clistcell *current,*c,*cf; |
417 | mailimap_msg_att_dynamic*flist; | 417 | mailimap_msg_att_dynamic*flist; |
418 | mailimap_flag_fetch*cflag; | 418 | mailimap_flag_fetch*cflag; |
419 | int size = 0; | 419 | int size = 0; |
420 | QBitArray mFlags(7); | 420 | QBitArray mFlags(7); |
421 | QStringList addresslist; | 421 | QStringList addresslist; |
422 | 422 | ||
423 | if (!m_att) { | 423 | if (!m_att) { |
424 | return m; | 424 | return m; |
425 | } | 425 | } |
426 | m = new RecMail(); | 426 | m = new RecMail(); |
427 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 427 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
428 | current = c; | 428 | current = c; |
429 | size = 0; | 429 | size = 0; |
430 | item = (mailimap_msg_att_item*)current->data; | 430 | item = (mailimap_msg_att_item*)current->data; |
431 | if ( !item ) | 431 | if ( !item ) |
432 | continue; | 432 | continue; |
433 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 433 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
434 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; | 434 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; |
435 | if (!flist || !flist->att_list) { | 435 | if (!flist || !flist->att_list) { |
436 | continue; | 436 | continue; |
437 | } | 437 | } |
438 | cf = flist->att_list->first; | 438 | cf = flist->att_list->first; |
439 | if( ! cf ) | 439 | if( cf ) { |
440 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { | 440 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { |
441 | cflag = (mailimap_flag_fetch*)cf->data; | 441 | cflag = (mailimap_flag_fetch*)cf->data; |
442 | if( ! cflag ) | 442 | if( ! cflag ) |
443 | qDebug("imap:not cflag "); | 443 | qDebug("imap:NO cflag "); |
444 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { | 444 | else { |
445 | switch (cflag->fl_flag->fl_type) { | 445 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { |
446 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ | 446 | switch (cflag->fl_flag->fl_type) { |
447 | mFlags.setBit(FLAG_ANSWERED); | 447 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ |
448 | break; | 448 | mFlags.setBit(FLAG_ANSWERED); |
449 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ | 449 | break; |
450 | mFlags.setBit(FLAG_FLAGGED); | 450 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ |
451 | break; | 451 | mFlags.setBit(FLAG_FLAGGED); |
452 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ | 452 | break; |
453 | mFlags.setBit(FLAG_DELETED); | 453 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ |
454 | break; | 454 | mFlags.setBit(FLAG_DELETED); |
455 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ | 455 | break; |
456 | mFlags.setBit(FLAG_SEEN); | 456 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ |
457 | break; | 457 | mFlags.setBit(FLAG_SEEN); |
458 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ | 458 | break; |
459 | mFlags.setBit(FLAG_DRAFT); | 459 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ |
460 | break; | 460 | mFlags.setBit(FLAG_DRAFT); |
461 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ | 461 | break; |
462 | break; | 462 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ |
463 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 463 | break; |
464 | break; | 464 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
465 | default: | 465 | break; |
466 | break; | 466 | default: |
467 | break; | ||
468 | } | ||
469 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | ||
470 | mFlags.setBit(FLAG_RECENT); | ||
471 | } | ||
467 | } | 472 | } |
468 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | ||
469 | mFlags.setBit(FLAG_RECENT); | ||
470 | } | 473 | } |
471 | } | 474 | } |
475 | //qDebug(" continue"); | ||
472 | continue; | 476 | continue; |
473 | } | 477 | } |
474 | if ( item->att_data.att_static == NULL ) | 478 | if ( item->att_data.att_static == NULL ) |
475 | continue; | 479 | continue; |
476 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 480 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
477 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 481 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
478 | if ( head == NULL ) | 482 | if ( head == NULL ) |
479 | continue; | 483 | continue; |
480 | if ( head->env_date != NULL ) { | 484 | if ( head->env_date != NULL ) { |
481 | m->setDate(head->env_date); | 485 | m->setDate(head->env_date); |
482 | //struct mailimf_date_time result; | 486 | //struct mailimf_date_time result; |
483 | struct mailimf_date_time* date;// = &result; | 487 | struct mailimf_date_time* date;// = &result; |
484 | struct mailimf_date_time **re = &date; | 488 | struct mailimf_date_time **re = &date; |
485 | size_t length = m->getDate().length(); | 489 | size_t length = m->getDate().length(); |
486 | size_t index = 0; | 490 | size_t index = 0; |
487 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 491 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
492 | //qDebug("parseDateTime "); | ||
488 | QDateTime dt = Genericwrapper::parseDateTime( date ); | 493 | QDateTime dt = Genericwrapper::parseDateTime( date ); |
489 | QString ret; | 494 | QString ret; |
490 | if ( dt.date() == QDate::currentDate () ) | 495 | if ( dt.date() == QDate::currentDate () ) |
491 | ret = KGlobal::locale()->formatTime( dt.time(),true); | 496 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
492 | else { | 497 | else { |
493 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | 498 | ret = KGlobal::locale()->formatDateTime( dt,true,true); |
494 | } | 499 | } |
495 | m->setDate( ret ); | 500 | m->setDate( ret ); |
496 | char tmp[20]; | 501 | char tmp[20]; |
497 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | 502 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", |
498 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | 503 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); |
499 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); | 504 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); |
500 | m->setIsoDate( QString( tmp ) ); | 505 | m->setIsoDate( QString( tmp ) ); |
501 | mailimf_date_time_free ( date ); | 506 | mailimf_date_time_free ( date ); |
502 | } else { | 507 | } else { |
503 | m->setIsoDate(head->env_date); | 508 | m->setIsoDate(head->env_date); |
504 | } | 509 | } |
505 | } | 510 | } |
506 | if ( head->env_subject != NULL ) | 511 | if ( head->env_subject != NULL ) |
507 | m->setSubject(convert_String((const char*)head->env_subject)); | 512 | m->setSubject(convert_String((const char*)head->env_subject)); |
508 | //m->setSubject(head->env_subject); | 513 | //m->setSubject(head->env_subject); |
509 | if (head->env_from!=NULL) { | 514 | if (head->env_from!=NULL) { |
510 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 515 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
511 | if (addresslist.count()) { | 516 | if (addresslist.count()) { |
512 | m->setFrom(addresslist.first()); | 517 | m->setFrom(addresslist.first()); |
513 | } | 518 | } |
514 | } | 519 | } |
515 | if (head->env_to!=NULL) { | 520 | if (head->env_to!=NULL) { |
516 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 521 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
517 | m->setTo(addresslist); | 522 | m->setTo(addresslist); |
518 | } | 523 | } |
519 | if (head->env_cc!=NULL) { | 524 | if (head->env_cc!=NULL) { |
520 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 525 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
521 | m->setCC(addresslist); | 526 | m->setCC(addresslist); |
522 | } | 527 | } |
523 | if (head->env_bcc!=NULL) { | 528 | if (head->env_bcc!=NULL) { |
524 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 529 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
525 | m->setBcc(addresslist); | 530 | m->setBcc(addresslist); |
526 | } | 531 | } |
527 | /* reply to address, eg. email. */ | 532 | /* reply to address, eg. email. */ |
528 | if (head->env_reply_to!=NULL) { | 533 | if (head->env_reply_to!=NULL) { |
529 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 534 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
530 | if (addresslist.count()) { | 535 | if (addresslist.count()) { |
531 | m->setReplyto(addresslist.first()); | 536 | m->setReplyto(addresslist.first()); |
532 | } | 537 | } |
533 | } | 538 | } |
534 | if (head->env_in_reply_to!=NULL) { | 539 | if (head->env_in_reply_to!=NULL) { |
535 | QString h(head->env_in_reply_to); | 540 | QString h(head->env_in_reply_to); |
536 | while (h.length()>0 && h[0]=='<') { | 541 | while (h.length()>0 && h[0]=='<') { |
537 | h.remove(0,1); | 542 | h.remove(0,1); |
538 | } | 543 | } |
539 | while (h.length()>0 && h[h.length()-1]=='>') { | 544 | while (h.length()>0 && h[h.length()-1]=='>') { |
540 | h.remove(h.length()-1,1); | 545 | h.remove(h.length()-1,1); |
541 | } | 546 | } |
542 | if (h.length()>0) { | 547 | if (h.length()>0) { |
543 | m->setInreply(QStringList(h)); | 548 | m->setInreply(QStringList(h)); |
544 | } | 549 | } |
545 | } | 550 | } |
546 | if (head->env_message_id != NULL) { | 551 | if (head->env_message_id != NULL) { |
547 | m->setMsgid(QString(head->env_message_id)); | 552 | m->setMsgid(QString(head->env_message_id)); |
548 | } | 553 | } |
549 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 554 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
550 | #if 0 | 555 | #if 0 |
551 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 556 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
552 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 557 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
553 | qDebug("time %s ",da.toString().latin1() ); | 558 | qDebug("time %s ",da.toString().latin1() ); |
554 | #endif | 559 | #endif |
555 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 560 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
556 | size = item->att_data.att_static->att_data.att_rfc822_size; | 561 | size = item->att_data.att_static->att_data.att_rfc822_size; |
557 | } | 562 | } |
558 | } | 563 | } |
559 | /* msg is already deleted */ | 564 | /* msg is already deleted */ |
560 | if (mFlags.testBit(FLAG_DELETED) && m) { | 565 | if (mFlags.testBit(FLAG_DELETED) && m) { |
561 | delete m; | 566 | delete m; |
562 | m = 0; | 567 | m = 0; |
563 | } | 568 | } |
564 | if (m) { | 569 | if (m) { |
565 | m->setFlags(mFlags); | 570 | m->setFlags(mFlags); |
566 | m->setMsgsize(size); | 571 | m->setMsgsize(size); |
567 | } | 572 | } |
568 | return m; | 573 | return m; |
569 | } | 574 | } |
570 | 575 | ||
571 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | 576 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) |
572 | { | 577 | { |
573 | RecBodyP body = new RecBody(); | 578 | RecBodyP body = new RecBody(); |
574 | const char *mb; | 579 | const char *mb; |
575 | int err = MAILIMAP_NO_ERROR; | 580 | int err = MAILIMAP_NO_ERROR; |
576 | clist *result = 0; | 581 | clist *result = 0; |
577 | clistcell *current; | 582 | clistcell *current; |
578 | mailimap_fetch_att *fetchAtt = 0; | 583 | mailimap_fetch_att *fetchAtt = 0; |
579 | mailimap_fetch_type *fetchType = 0; | 584 | mailimap_fetch_type *fetchType = 0; |
580 | mailimap_set *set = 0; | 585 | mailimap_set *set = 0; |
581 | mailimap_body*body_desc = 0; | 586 | mailimap_body*body_desc = 0; |
582 | 587 | ||
583 | mb = mail->getMbox().latin1(); | 588 | mb = mail->getMbox().latin1(); |
584 | 589 | ||
585 | login(); | 590 | login(); |
586 | if (!m_imap) { | 591 | if (!m_imap) { |
587 | return body; | 592 | return body; |
588 | } | 593 | } |
589 | err = selectMbox(mail->getMbox()); | 594 | err = selectMbox(mail->getMbox()); |
590 | if ( err != MAILIMAP_NO_ERROR ) { | 595 | if ( err != MAILIMAP_NO_ERROR ) { |
591 | return body; | 596 | return body; |
592 | } | 597 | } |
593 | 598 | ||
594 | /* the range has to start at 1!!! not with 0!!!! */ | 599 | /* the range has to start at 1!!! not with 0!!!! */ |
595 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); | 600 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); |
596 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 601 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
597 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 602 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
598 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 603 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
599 | mailimap_set_free( set ); | 604 | mailimap_set_free( set ); |
600 | mailimap_fetch_type_free( fetchType ); | 605 | mailimap_fetch_type_free( fetchType ); |
601 | 606 | ||
602 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 607 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
603 | mailimap_msg_att * msg_att; | 608 | mailimap_msg_att * msg_att; |
604 | msg_att = (mailimap_msg_att*)current->data; | 609 | msg_att = (mailimap_msg_att*)current->data; |
605 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 610 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
606 | QValueList<int> path; | 611 | QValueList<int> path; |
607 | body_desc = item->att_data.att_static->att_data.att_body; | 612 | body_desc = item->att_data.att_static->att_data.att_body; |
608 | traverseBody(mail,body_desc,body,0,path); | 613 | traverseBody(mail,body_desc,body,0,path); |
609 | } else { | 614 | } else { |
610 | //odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; | 615 | qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response ); |
611 | } | 616 | } |
612 | if (result) mailimap_fetch_list_free(result); | 617 | if (result) mailimap_fetch_list_free(result); |
613 | return body; | 618 | return body; |
614 | } | 619 | } |
615 | 620 | ||
616 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 621 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
617 | { | 622 | { |
618 | QStringList l; | 623 | QStringList l; |
619 | QString from; | 624 | QString from; |
620 | bool named_from; | 625 | bool named_from; |
621 | clistcell *current = NULL; | 626 | clistcell *current = NULL; |
622 | mailimap_address * current_address=NULL; | 627 | mailimap_address * current_address=NULL; |
623 | if (!list) { | 628 | if (!list) { |
624 | return l; | 629 | return l; |
625 | } | 630 | } |
626 | unsigned int count = 0; | 631 | unsigned int count = 0; |
627 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 632 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
628 | from = ""; | 633 | from = ""; |
629 | named_from = false; | 634 | named_from = false; |
630 | current_address=(mailimap_address*)current->data; | 635 | current_address=(mailimap_address*)current->data; |
631 | if (current_address->ad_personal_name){ | 636 | if (current_address->ad_personal_name){ |
632 | from+=convert_String((const char*)current_address->ad_personal_name); | 637 | from+=convert_String((const char*)current_address->ad_personal_name); |
633 | from+=" "; | 638 | from+=" "; |
634 | named_from = true; | 639 | named_from = true; |
635 | } | 640 | } |
636 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 641 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
637 | from+="<"; | 642 | from+="<"; |
638 | } | 643 | } |
639 | if (current_address->ad_mailbox_name) { | 644 | if (current_address->ad_mailbox_name) { |
640 | from+=QString(current_address->ad_mailbox_name); | 645 | from+=QString(current_address->ad_mailbox_name); |
641 | from+="@"; | 646 | from+="@"; |
642 | } | 647 | } |
643 | if (current_address->ad_host_name) { | 648 | if (current_address->ad_host_name) { |
644 | from+=QString(current_address->ad_host_name); | 649 | from+=QString(current_address->ad_host_name); |
645 | } | 650 | } |
646 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 651 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
647 | from+=">"; | 652 | from+=">"; |
648 | } | 653 | } |
649 | l.append(QString(from)); | 654 | l.append(QString(from)); |
650 | if (++count > 99) { | 655 | if (++count > 99) { |
651 | break; | 656 | break; |
652 | } | 657 | } |
653 | } | 658 | } |
654 | return l; | 659 | return l; |
655 | } | 660 | } |
656 | 661 | ||
657 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) | 662 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) |
658 | { | 663 | { |
659 | encodedString*res=new encodedString; | 664 | encodedString*res=new encodedString; |
660 | int err; | 665 | int err; |
661 | mailimap_fetch_type *fetchType; | 666 | mailimap_fetch_type *fetchType; |
662 | mailimap_set *set; | 667 | mailimap_set *set; |
663 | clistcell*current,*cur; | 668 | clistcell*current,*cur; |
664 | mailimap_section_part * section_part = 0; | 669 | mailimap_section_part * section_part = 0; |
665 | mailimap_section_spec * section_spec = 0; | 670 | mailimap_section_spec * section_spec = 0; |
666 | mailimap_section * section = 0; | 671 | mailimap_section * section = 0; |
667 | mailimap_fetch_att * fetch_att = 0; | 672 | mailimap_fetch_att * fetch_att = 0; |
668 | 673 | ||
669 | login(); | 674 | login(); |
670 | if (!m_imap) { | 675 | if (!m_imap) { |
671 | return res; | 676 | return res; |
672 | } | 677 | } |
673 | if (!internal_call) { | 678 | if (!internal_call) { |
674 | err = selectMbox(mail->getMbox()); | 679 | err = selectMbox(mail->getMbox()); |