-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 14 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 14 |
2 files changed, 16 insertions, 12 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index da5974c..7b75ffa 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -396,298 +396,300 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
396 | target_body.setBodytext(""); | 396 | target_body.setBodytext(""); |
397 | target_body.addPart(singlePart); | 397 | target_body.addPart(singlePart); |
398 | break; | 398 | break; |
399 | default: | 399 | default: |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | 402 | ||
403 | return; | 403 | return; |
404 | } | 404 | } |
405 | 405 | ||
406 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 406 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
407 | { | 407 | { |
408 | QStringList l; | 408 | QStringList l; |
409 | QString from; | 409 | QString from; |
410 | bool named_from; | 410 | bool named_from; |
411 | clistcell *current = NULL; | 411 | clistcell *current = NULL; |
412 | mailimap_address * current_address=NULL; | 412 | mailimap_address * current_address=NULL; |
413 | if (!list) { | 413 | if (!list) { |
414 | return l; | 414 | return l; |
415 | } | 415 | } |
416 | unsigned int count = 0; | 416 | unsigned int count = 0; |
417 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 417 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
418 | from = ""; | 418 | from = ""; |
419 | named_from = false; | 419 | named_from = false; |
420 | current_address=(mailimap_address*)current->data; | 420 | current_address=(mailimap_address*)current->data; |
421 | if (current_address->ad_personal_name){ | 421 | if (current_address->ad_personal_name){ |
422 | from+=QString(current_address->ad_personal_name); | 422 | from+=QString(current_address->ad_personal_name); |
423 | from+=" "; | 423 | from+=" "; |
424 | named_from = true; | 424 | named_from = true; |
425 | } | 425 | } |
426 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 426 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
427 | from+="<"; | 427 | from+="<"; |
428 | } | 428 | } |
429 | if (current_address->ad_mailbox_name) { | 429 | if (current_address->ad_mailbox_name) { |
430 | from+=QString(current_address->ad_mailbox_name); | 430 | from+=QString(current_address->ad_mailbox_name); |
431 | from+="@"; | 431 | from+="@"; |
432 | } | 432 | } |
433 | if (current_address->ad_host_name) { | 433 | if (current_address->ad_host_name) { |
434 | from+=QString(current_address->ad_host_name); | 434 | from+=QString(current_address->ad_host_name); |
435 | } | 435 | } |
436 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 436 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
437 | from+=">"; | 437 | from+=">"; |
438 | } | 438 | } |
439 | l.append(QString(from)); | 439 | l.append(QString(from)); |
440 | if (++count > 99) { | 440 | if (++count > 99) { |
441 | break; | 441 | break; |
442 | } | 442 | } |
443 | } | 443 | } |
444 | return l; | 444 | return l; |
445 | } | 445 | } |
446 | 446 | ||
447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) |
448 | { | 448 | { |
449 | QString body(""); | 449 | QString body(""); |
450 | const char*mb; | 450 | const char*mb; |
451 | int err; | 451 | int err; |
452 | mailimap_fetch_type *fetchType; | 452 | mailimap_fetch_type *fetchType; |
453 | mailimap_set *set; | 453 | mailimap_set *set; |
454 | clistcell*current,*cur; | 454 | clistcell*current,*cur; |
455 | 455 | ||
456 | login(); | 456 | login(); |
457 | if (!m_imap) { | 457 | if (!m_imap) { |
458 | return body; | 458 | return body; |
459 | } | 459 | } |
460 | if (!internal_call) { | 460 | if (!internal_call) { |
461 | mb = mail.getMbox().latin1(); | 461 | mb = mail.getMbox().latin1(); |
462 | /* select mailbox READONLY for operations */ | 462 | /* select mailbox READONLY for operations */ |
463 | err = mailimap_examine( m_imap, (char*)mb); | 463 | err = mailimap_examine( m_imap, (char*)mb); |
464 | if ( err != MAILIMAP_NO_ERROR ) { | 464 | if ( err != MAILIMAP_NO_ERROR ) { |
465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
466 | return body; | 466 | return body; |
467 | } | 467 | } |
468 | } | 468 | } |
469 | set = mailimap_set_new_single(mail.getNumber()); | 469 | set = mailimap_set_new_single(mail.getNumber()); |
470 | clist*id_list=clist_new(); | 470 | clist*id_list=clist_new(); |
471 | for (unsigned j=0; j < path.count();++j) { | 471 | for (unsigned j=0; j < path.count();++j) { |
472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
473 | *p_id = path[j]; | 473 | *p_id = path[j]; |
474 | clist_append(id_list,p_id); | 474 | clist_append(id_list,p_id); |
475 | } | 475 | } |
476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | 476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); |
477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
478 | mailimap_section * section = mailimap_section_new(section_spec); | 478 | mailimap_section * section = mailimap_section_new(section_spec); |
479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
480 | 480 | ||
481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
482 | 482 | ||
483 | clist*result = clist_new(); | 483 | clist*result = clist_new(); |
484 | 484 | ||
485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
486 | mailimap_set_free( set ); | 486 | mailimap_set_free( set ); |
487 | mailimap_fetch_type_free( fetchType ); | 487 | mailimap_fetch_type_free( fetchType ); |
488 | 488 | ||
489 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 489 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
490 | mailimap_msg_att * msg_att; | 490 | mailimap_msg_att * msg_att; |
491 | msg_att = (mailimap_msg_att*)current->data; | 491 | msg_att = (mailimap_msg_att*)current->data; |
492 | mailimap_msg_att_item*msg_att_item; | 492 | mailimap_msg_att_item*msg_att_item; |
493 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 493 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
494 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 494 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
495 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 495 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
496 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 496 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
497 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 497 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
498 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 498 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
499 | if (text) { | 499 | if (text) { |
500 | body = QString(text); | 500 | body = QString(text); |
501 | free(text); | 501 | free(text); |
502 | } else { | 502 | } else { |
503 | body = ""; | 503 | body = ""; |
504 | } | 504 | } |
505 | } | 505 | } |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | } else { | 509 | } else { |
510 | qDebug("error fetching text: %s",m_imap->imap_response); | 510 | qDebug("error fetching text: %s",m_imap->imap_response); |
511 | } | 511 | } |
512 | mailimap_fetch_list_free(result); | 512 | mailimap_fetch_list_free(result); |
513 | return body; | 513 | return body; |
514 | } | 514 | } |
515 | 515 | ||
516 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | 516 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) |
517 | { | 517 | { |
518 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | 518 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ |
519 | if (!mailDescription||current_recursion==10) { | 519 | if (!mailDescription||current_recursion==10) { |
520 | return; | 520 | return; |
521 | } | 521 | } |
522 | clistcell*current; | 522 | clistcell*current; |
523 | mailimap_body*current_body; | 523 | mailimap_body*current_body; |
524 | unsigned int count = 0; | 524 | unsigned int count = 0; |
525 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 525 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
526 | /* the point in the message */ | 526 | /* the point in the message */ |
527 | ++count; | 527 | ++count; |
528 | current_body = (mailimap_body*)current->data; | 528 | current_body = (mailimap_body*)current->data; |
529 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 529 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
530 | QValueList<int>clist = recList; | 530 | QValueList<int>clist = recList; |
531 | clist.append(count); | 531 | clist.append(count); |
532 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); | 532 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); |
533 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | 533 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ |
534 | RecPart currentPart; | 534 | RecPart currentPart; |
535 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | 535 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); |
536 | QValueList<int>clist = recList; | 536 | QValueList<int>clist = recList; |
537 | clist.append(count); | 537 | clist.append(count); |
538 | /* important: Check for is NULL 'cause a body can be empty! */ | 538 | /* important: Check for is NULL 'cause a body can be empty! */ |
539 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { | 539 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { |
540 | QString body_text = fetchPart(mail,clist,true); | 540 | QString body_text = fetchPart(mail,clist,true); |
541 | target_body.setDescription(currentPart); | 541 | target_body.setDescription(currentPart); |
542 | target_body.setBodytext(body_text); | 542 | target_body.setBodytext(body_text); |
543 | } else { | 543 | } else { |
544 | QString id(""); | 544 | QString id(""); |
545 | for (unsigned int j = 0; j < clist.count();++j) { | 545 | for (unsigned int j = 0; j < clist.count();++j) { |
546 | id+=(j>0?" ":""); | 546 | id+=(j>0?" ":""); |
547 | id+=QString("%1").arg(clist[j]); | 547 | id+=QString("%1").arg(clist[j]); |
548 | } | 548 | } |
549 | qDebug("ID= %s",id.latin1()); | 549 | qDebug("ID= %s",id.latin1()); |
550 | currentPart.setIdentifier(id); | 550 | currentPart.setIdentifier(id); |
551 | currentPart.setPositionlist(clist); | 551 | currentPart.setPositionlist(clist); |
552 | target_body.addPart(currentPart); | 552 | target_body.addPart(currentPart); |
553 | } | 553 | } |
554 | } | 554 | } |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 558 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) |
559 | { | 559 | { |
560 | if (!Description) { | 560 | if (!Description) { |
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | switch (Description->bd_type) { | 563 | switch (Description->bd_type) { |
564 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 564 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
565 | target_part.setType("text"); | 565 | target_part.setType("text"); |
566 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 566 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
567 | break; | 567 | break; |
568 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 568 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
569 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 569 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
570 | break; | 570 | break; |
571 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 571 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
572 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 572 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
573 | break; | 573 | break; |
574 | default: | 574 | default: |
575 | break; | 575 | break; |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | 579 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) |
580 | { | 580 | { |
581 | if (!which) { | 581 | if (!which) { |
582 | return; | 582 | return; |
583 | } | 583 | } |
584 | QString sub; | 584 | QString sub; |
585 | sub = which->bd_media_text; | 585 | sub = which->bd_media_text; |
586 | target_part.setSubtype(sub.lower()); | 586 | target_part.setSubtype(sub.lower()); |
587 | target_part.setLines(which->bd_lines); | 587 | target_part.setLines(which->bd_lines); |
588 | fillBodyFields(target_part,which->bd_fields); | 588 | fillBodyFields(target_part,which->bd_fields); |
589 | } | 589 | } |
590 | 590 | ||
591 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) | 591 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) |
592 | { | 592 | { |
593 | if (!which) { | 593 | if (!which) { |
594 | return; | 594 | return; |
595 | } | 595 | } |
596 | // QString sub; | 596 | // QString sub; |
597 | // sub = which->bd_media_text; | 597 | // sub = which->bd_media_text; |
598 | // target_part.setSubtype(sub.lower()); | 598 | // target_part.setSubtype(sub.lower()); |
599 | qDebug("Message part"); | 599 | qDebug("Message part"); |
600 | /* we set this type to text/plain */ | 600 | /* we set this type to text/plain */ |
601 | target_part.setType("text"); | 601 | target_part.setType("text"); |
602 | target_part.setSubtype("plain"); | 602 | target_part.setSubtype("plain"); |
603 | target_part.setLines(which->bd_lines); | 603 | target_part.setLines(which->bd_lines); |
604 | fillBodyFields(target_part,which->bd_fields); | 604 | fillBodyFields(target_part,which->bd_fields); |
605 | } | 605 | } |
606 | 606 | ||
607 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | 607 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) |
608 | { | 608 | { |
609 | if (!which) { | 609 | if (!which) { |
610 | return; | 610 | return; |
611 | } | 611 | } |
612 | QString type,sub; | 612 | QString type,sub; |
613 | switch (which->bd_media_basic->med_type) { | 613 | switch (which->bd_media_basic->med_type) { |
614 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | 614 | case MAILIMAP_MEDIA_BASIC_APPLICATION: |
615 | type = "application"; | 615 | type = "application"; |
616 | break; | 616 | break; |
617 | case MAILIMAP_MEDIA_BASIC_AUDIO: | 617 | case MAILIMAP_MEDIA_BASIC_AUDIO: |
618 | type = "audio"; | 618 | type = "audio"; |
619 | break; | 619 | break; |
620 | case MAILIMAP_MEDIA_BASIC_IMAGE: | 620 | case MAILIMAP_MEDIA_BASIC_IMAGE: |
621 | type = "image"; | 621 | type = "image"; |
622 | break; | 622 | break; |
623 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | 623 | case MAILIMAP_MEDIA_BASIC_MESSAGE: |
624 | type = "message"; | 624 | type = "message"; |
625 | break; | 625 | break; |
626 | case MAILIMAP_MEDIA_BASIC_VIDEO: | 626 | case MAILIMAP_MEDIA_BASIC_VIDEO: |
627 | type = "video"; | 627 | type = "video"; |
628 | break; | 628 | break; |
629 | case MAILIMAP_MEDIA_BASIC_OTHER: | 629 | case MAILIMAP_MEDIA_BASIC_OTHER: |
630 | default: | 630 | default: |
631 | if (which->bd_media_basic->med_basic_type) { | 631 | if (which->bd_media_basic->med_basic_type) { |
632 | type = which->bd_media_basic->med_basic_type; | 632 | type = which->bd_media_basic->med_basic_type; |
633 | } else { | 633 | } else { |
634 | type = ""; | 634 | type = ""; |
635 | } | 635 | } |
636 | break; | 636 | break; |
637 | } | 637 | } |
638 | if (which->bd_media_basic->med_subtype) { | 638 | if (which->bd_media_basic->med_subtype) { |
639 | sub = which->bd_media_basic->med_subtype; | 639 | sub = which->bd_media_basic->med_subtype; |
640 | } else { | 640 | } else { |
641 | sub = ""; | 641 | sub = ""; |
642 | } | 642 | } |
643 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 643 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
644 | target_part.setType(type.lower()); | 644 | target_part.setType(type.lower()); |
645 | target_part.setSubtype(sub.lower()); | 645 | target_part.setSubtype(sub.lower()); |
646 | fillBodyFields(target_part,which->bd_fields); | 646 | fillBodyFields(target_part,which->bd_fields); |
647 | } | 647 | } |
648 | 648 | ||
649 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 649 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
650 | { | 650 | { |
651 | if (!which) return; | 651 | if (!which) return; |
652 | clistcell*cur; | 652 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
653 | mailimap_single_body_fld_param*param; | 653 | clistcell*cur; |
654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 654 | mailimap_single_body_fld_param*param=0; |
655 | param = (mailimap_single_body_fld_param*)cur->data; | 655 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
656 | if (param) { | 656 | param = (mailimap_single_body_fld_param*)cur->data; |
657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 657 | if (param) { |
658 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
659 | } | ||
658 | } | 660 | } |
659 | } | 661 | } |
660 | mailimap_body_fld_enc*enc = which->bd_encoding; | 662 | mailimap_body_fld_enc*enc = which->bd_encoding; |
661 | QString encoding(""); | 663 | QString encoding(""); |
662 | switch (enc->enc_type) { | 664 | switch (enc->enc_type) { |
663 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 665 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
664 | encoding = "7bit"; | 666 | encoding = "7bit"; |
665 | break; | 667 | break; |
666 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 668 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
667 | encoding = "8bit"; | 669 | encoding = "8bit"; |
668 | break; | 670 | break; |
669 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 671 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
670 | encoding="binary"; | 672 | encoding="binary"; |
671 | break; | 673 | break; |
672 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 674 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
673 | encoding="base64"; | 675 | encoding="base64"; |
674 | break; | 676 | break; |
675 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 677 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
676 | encoding="quoted-printable"; | 678 | encoding="quoted-printable"; |
677 | break; | 679 | break; |
678 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 680 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
679 | default: | 681 | default: |
680 | if (enc->enc_value) { | 682 | if (enc->enc_value) { |
681 | char*t=enc->enc_value; | 683 | char*t=enc->enc_value; |
682 | encoding=QString(enc->enc_value); | 684 | encoding=QString(enc->enc_value); |
683 | enc->enc_value=0L; | 685 | enc->enc_value=0L; |
684 | free(t); | 686 | free(t); |
685 | } | 687 | } |
686 | } | 688 | } |
687 | target_part.setEncoding(encoding); | 689 | target_part.setEncoding(encoding); |
688 | } | 690 | } |
689 | 691 | ||
690 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 692 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
691 | { | 693 | { |
692 | return fetchPart(mail,part.Positionlist(),false); | 694 | return fetchPart(mail,part.Positionlist(),false); |
693 | } | 695 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index da5974c..7b75ffa 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -396,298 +396,300 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
396 | target_body.setBodytext(""); | 396 | target_body.setBodytext(""); |
397 | target_body.addPart(singlePart); | 397 | target_body.addPart(singlePart); |
398 | break; | 398 | break; |
399 | default: | 399 | default: |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | 402 | ||
403 | return; | 403 | return; |
404 | } | 404 | } |
405 | 405 | ||
406 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 406 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
407 | { | 407 | { |
408 | QStringList l; | 408 | QStringList l; |
409 | QString from; | 409 | QString from; |
410 | bool named_from; | 410 | bool named_from; |
411 | clistcell *current = NULL; | 411 | clistcell *current = NULL; |
412 | mailimap_address * current_address=NULL; | 412 | mailimap_address * current_address=NULL; |
413 | if (!list) { | 413 | if (!list) { |
414 | return l; | 414 | return l; |
415 | } | 415 | } |
416 | unsigned int count = 0; | 416 | unsigned int count = 0; |
417 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 417 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
418 | from = ""; | 418 | from = ""; |
419 | named_from = false; | 419 | named_from = false; |
420 | current_address=(mailimap_address*)current->data; | 420 | current_address=(mailimap_address*)current->data; |
421 | if (current_address->ad_personal_name){ | 421 | if (current_address->ad_personal_name){ |
422 | from+=QString(current_address->ad_personal_name); | 422 | from+=QString(current_address->ad_personal_name); |
423 | from+=" "; | 423 | from+=" "; |
424 | named_from = true; | 424 | named_from = true; |
425 | } | 425 | } |
426 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 426 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
427 | from+="<"; | 427 | from+="<"; |
428 | } | 428 | } |
429 | if (current_address->ad_mailbox_name) { | 429 | if (current_address->ad_mailbox_name) { |
430 | from+=QString(current_address->ad_mailbox_name); | 430 | from+=QString(current_address->ad_mailbox_name); |
431 | from+="@"; | 431 | from+="@"; |
432 | } | 432 | } |
433 | if (current_address->ad_host_name) { | 433 | if (current_address->ad_host_name) { |
434 | from+=QString(current_address->ad_host_name); | 434 | from+=QString(current_address->ad_host_name); |
435 | } | 435 | } |
436 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 436 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
437 | from+=">"; | 437 | from+=">"; |
438 | } | 438 | } |
439 | l.append(QString(from)); | 439 | l.append(QString(from)); |
440 | if (++count > 99) { | 440 | if (++count > 99) { |
441 | break; | 441 | break; |
442 | } | 442 | } |
443 | } | 443 | } |
444 | return l; | 444 | return l; |
445 | } | 445 | } |
446 | 446 | ||
447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) | 447 | QString IMAPwrapper::fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) |
448 | { | 448 | { |
449 | QString body(""); | 449 | QString body(""); |
450 | const char*mb; | 450 | const char*mb; |
451 | int err; | 451 | int err; |
452 | mailimap_fetch_type *fetchType; | 452 | mailimap_fetch_type *fetchType; |
453 | mailimap_set *set; | 453 | mailimap_set *set; |
454 | clistcell*current,*cur; | 454 | clistcell*current,*cur; |
455 | 455 | ||
456 | login(); | 456 | login(); |
457 | if (!m_imap) { | 457 | if (!m_imap) { |
458 | return body; | 458 | return body; |
459 | } | 459 | } |
460 | if (!internal_call) { | 460 | if (!internal_call) { |
461 | mb = mail.getMbox().latin1(); | 461 | mb = mail.getMbox().latin1(); |
462 | /* select mailbox READONLY for operations */ | 462 | /* select mailbox READONLY for operations */ |
463 | err = mailimap_examine( m_imap, (char*)mb); | 463 | err = mailimap_examine( m_imap, (char*)mb); |
464 | if ( err != MAILIMAP_NO_ERROR ) { | 464 | if ( err != MAILIMAP_NO_ERROR ) { |
465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 465 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
466 | return body; | 466 | return body; |
467 | } | 467 | } |
468 | } | 468 | } |
469 | set = mailimap_set_new_single(mail.getNumber()); | 469 | set = mailimap_set_new_single(mail.getNumber()); |
470 | clist*id_list=clist_new(); | 470 | clist*id_list=clist_new(); |
471 | for (unsigned j=0; j < path.count();++j) { | 471 | for (unsigned j=0; j < path.count();++j) { |
472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 472 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
473 | *p_id = path[j]; | 473 | *p_id = path[j]; |
474 | clist_append(id_list,p_id); | 474 | clist_append(id_list,p_id); |
475 | } | 475 | } |
476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | 476 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); |
477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 477 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
478 | mailimap_section * section = mailimap_section_new(section_spec); | 478 | mailimap_section * section = mailimap_section_new(section_spec); |
479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | 479 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); |
480 | 480 | ||
481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 481 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
482 | 482 | ||
483 | clist*result = clist_new(); | 483 | clist*result = clist_new(); |
484 | 484 | ||
485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 485 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
486 | mailimap_set_free( set ); | 486 | mailimap_set_free( set ); |
487 | mailimap_fetch_type_free( fetchType ); | 487 | mailimap_fetch_type_free( fetchType ); |
488 | 488 | ||
489 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 489 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
490 | mailimap_msg_att * msg_att; | 490 | mailimap_msg_att * msg_att; |
491 | msg_att = (mailimap_msg_att*)current->data; | 491 | msg_att = (mailimap_msg_att*)current->data; |
492 | mailimap_msg_att_item*msg_att_item; | 492 | mailimap_msg_att_item*msg_att_item; |
493 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 493 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
494 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 494 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
495 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 495 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
496 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 496 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
497 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 497 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
498 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 498 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
499 | if (text) { | 499 | if (text) { |
500 | body = QString(text); | 500 | body = QString(text); |
501 | free(text); | 501 | free(text); |
502 | } else { | 502 | } else { |
503 | body = ""; | 503 | body = ""; |
504 | } | 504 | } |
505 | } | 505 | } |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | } else { | 509 | } else { |
510 | qDebug("error fetching text: %s",m_imap->imap_response); | 510 | qDebug("error fetching text: %s",m_imap->imap_response); |
511 | } | 511 | } |
512 | mailimap_fetch_list_free(result); | 512 | mailimap_fetch_list_free(result); |
513 | return body; | 513 | return body; |
514 | } | 514 | } |
515 | 515 | ||
516 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | 516 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) |
517 | { | 517 | { |
518 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | 518 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ |
519 | if (!mailDescription||current_recursion==10) { | 519 | if (!mailDescription||current_recursion==10) { |
520 | return; | 520 | return; |
521 | } | 521 | } |
522 | clistcell*current; | 522 | clistcell*current; |
523 | mailimap_body*current_body; | 523 | mailimap_body*current_body; |
524 | unsigned int count = 0; | 524 | unsigned int count = 0; |
525 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 525 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
526 | /* the point in the message */ | 526 | /* the point in the message */ |
527 | ++count; | 527 | ++count; |
528 | current_body = (mailimap_body*)current->data; | 528 | current_body = (mailimap_body*)current->data; |
529 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 529 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
530 | QValueList<int>clist = recList; | 530 | QValueList<int>clist = recList; |
531 | clist.append(count); | 531 | clist.append(count); |
532 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); | 532 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); |
533 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | 533 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ |
534 | RecPart currentPart; | 534 | RecPart currentPart; |
535 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | 535 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); |
536 | QValueList<int>clist = recList; | 536 | QValueList<int>clist = recList; |
537 | clist.append(count); | 537 | clist.append(count); |
538 | /* important: Check for is NULL 'cause a body can be empty! */ | 538 | /* important: Check for is NULL 'cause a body can be empty! */ |
539 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { | 539 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { |
540 | QString body_text = fetchPart(mail,clist,true); | 540 | QString body_text = fetchPart(mail,clist,true); |
541 | target_body.setDescription(currentPart); | 541 | target_body.setDescription(currentPart); |
542 | target_body.setBodytext(body_text); | 542 | target_body.setBodytext(body_text); |
543 | } else { | 543 | } else { |
544 | QString id(""); | 544 | QString id(""); |
545 | for (unsigned int j = 0; j < clist.count();++j) { | 545 | for (unsigned int j = 0; j < clist.count();++j) { |
546 | id+=(j>0?" ":""); | 546 | id+=(j>0?" ":""); |
547 | id+=QString("%1").arg(clist[j]); | 547 | id+=QString("%1").arg(clist[j]); |
548 | } | 548 | } |
549 | qDebug("ID= %s",id.latin1()); | 549 | qDebug("ID= %s",id.latin1()); |
550 | currentPart.setIdentifier(id); | 550 | currentPart.setIdentifier(id); |
551 | currentPart.setPositionlist(clist); | 551 | currentPart.setPositionlist(clist); |
552 | target_body.addPart(currentPart); | 552 | target_body.addPart(currentPart); |
553 | } | 553 | } |
554 | } | 554 | } |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 558 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) |
559 | { | 559 | { |
560 | if (!Description) { | 560 | if (!Description) { |
561 | return; | 561 | return; |
562 | } | 562 | } |
563 | switch (Description->bd_type) { | 563 | switch (Description->bd_type) { |
564 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 564 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
565 | target_part.setType("text"); | 565 | target_part.setType("text"); |
566 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 566 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
567 | break; | 567 | break; |
568 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 568 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
569 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 569 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
570 | break; | 570 | break; |
571 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 571 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
572 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 572 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
573 | break; | 573 | break; |
574 | default: | 574 | default: |
575 | break; | 575 | break; |
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | 579 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) |
580 | { | 580 | { |
581 | if (!which) { | 581 | if (!which) { |
582 | return; | 582 | return; |
583 | } | 583 | } |
584 | QString sub; | 584 | QString sub; |
585 | sub = which->bd_media_text; | 585 | sub = which->bd_media_text; |
586 | target_part.setSubtype(sub.lower()); | 586 | target_part.setSubtype(sub.lower()); |
587 | target_part.setLines(which->bd_lines); | 587 | target_part.setLines(which->bd_lines); |
588 | fillBodyFields(target_part,which->bd_fields); | 588 | fillBodyFields(target_part,which->bd_fields); |
589 | } | 589 | } |
590 | 590 | ||
591 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) | 591 | void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) |
592 | { | 592 | { |
593 | if (!which) { | 593 | if (!which) { |
594 | return; | 594 | return; |
595 | } | 595 | } |
596 | // QString sub; | 596 | // QString sub; |
597 | // sub = which->bd_media_text; | 597 | // sub = which->bd_media_text; |
598 | // target_part.setSubtype(sub.lower()); | 598 | // target_part.setSubtype(sub.lower()); |
599 | qDebug("Message part"); | 599 | qDebug("Message part"); |
600 | /* we set this type to text/plain */ | 600 | /* we set this type to text/plain */ |
601 | target_part.setType("text"); | 601 | target_part.setType("text"); |
602 | target_part.setSubtype("plain"); | 602 | target_part.setSubtype("plain"); |
603 | target_part.setLines(which->bd_lines); | 603 | target_part.setLines(which->bd_lines); |
604 | fillBodyFields(target_part,which->bd_fields); | 604 | fillBodyFields(target_part,which->bd_fields); |
605 | } | 605 | } |
606 | 606 | ||
607 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | 607 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) |
608 | { | 608 | { |
609 | if (!which) { | 609 | if (!which) { |
610 | return; | 610 | return; |
611 | } | 611 | } |
612 | QString type,sub; | 612 | QString type,sub; |
613 | switch (which->bd_media_basic->med_type) { | 613 | switch (which->bd_media_basic->med_type) { |
614 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | 614 | case MAILIMAP_MEDIA_BASIC_APPLICATION: |
615 | type = "application"; | 615 | type = "application"; |
616 | break; | 616 | break; |
617 | case MAILIMAP_MEDIA_BASIC_AUDIO: | 617 | case MAILIMAP_MEDIA_BASIC_AUDIO: |
618 | type = "audio"; | 618 | type = "audio"; |
619 | break; | 619 | break; |
620 | case MAILIMAP_MEDIA_BASIC_IMAGE: | 620 | case MAILIMAP_MEDIA_BASIC_IMAGE: |
621 | type = "image"; | 621 | type = "image"; |
622 | break; | 622 | break; |
623 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | 623 | case MAILIMAP_MEDIA_BASIC_MESSAGE: |
624 | type = "message"; | 624 | type = "message"; |
625 | break; | 625 | break; |
626 | case MAILIMAP_MEDIA_BASIC_VIDEO: | 626 | case MAILIMAP_MEDIA_BASIC_VIDEO: |
627 | type = "video"; | 627 | type = "video"; |
628 | break; | 628 | break; |
629 | case MAILIMAP_MEDIA_BASIC_OTHER: | 629 | case MAILIMAP_MEDIA_BASIC_OTHER: |
630 | default: | 630 | default: |
631 | if (which->bd_media_basic->med_basic_type) { | 631 | if (which->bd_media_basic->med_basic_type) { |
632 | type = which->bd_media_basic->med_basic_type; | 632 | type = which->bd_media_basic->med_basic_type; |
633 | } else { | 633 | } else { |
634 | type = ""; | 634 | type = ""; |
635 | } | 635 | } |
636 | break; | 636 | break; |
637 | } | 637 | } |
638 | if (which->bd_media_basic->med_subtype) { | 638 | if (which->bd_media_basic->med_subtype) { |
639 | sub = which->bd_media_basic->med_subtype; | 639 | sub = which->bd_media_basic->med_subtype; |
640 | } else { | 640 | } else { |
641 | sub = ""; | 641 | sub = ""; |
642 | } | 642 | } |
643 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 643 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
644 | target_part.setType(type.lower()); | 644 | target_part.setType(type.lower()); |
645 | target_part.setSubtype(sub.lower()); | 645 | target_part.setSubtype(sub.lower()); |
646 | fillBodyFields(target_part,which->bd_fields); | 646 | fillBodyFields(target_part,which->bd_fields); |
647 | } | 647 | } |
648 | 648 | ||
649 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 649 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
650 | { | 650 | { |
651 | if (!which) return; | 651 | if (!which) return; |
652 | clistcell*cur; | 652 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
653 | mailimap_single_body_fld_param*param; | 653 | clistcell*cur; |
654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 654 | mailimap_single_body_fld_param*param=0; |
655 | param = (mailimap_single_body_fld_param*)cur->data; | 655 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
656 | if (param) { | 656 | param = (mailimap_single_body_fld_param*)cur->data; |
657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 657 | if (param) { |
658 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
659 | } | ||
658 | } | 660 | } |
659 | } | 661 | } |
660 | mailimap_body_fld_enc*enc = which->bd_encoding; | 662 | mailimap_body_fld_enc*enc = which->bd_encoding; |
661 | QString encoding(""); | 663 | QString encoding(""); |
662 | switch (enc->enc_type) { | 664 | switch (enc->enc_type) { |
663 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 665 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
664 | encoding = "7bit"; | 666 | encoding = "7bit"; |
665 | break; | 667 | break; |
666 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 668 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
667 | encoding = "8bit"; | 669 | encoding = "8bit"; |
668 | break; | 670 | break; |
669 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 671 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
670 | encoding="binary"; | 672 | encoding="binary"; |
671 | break; | 673 | break; |
672 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 674 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
673 | encoding="base64"; | 675 | encoding="base64"; |
674 | break; | 676 | break; |
675 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 677 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
676 | encoding="quoted-printable"; | 678 | encoding="quoted-printable"; |
677 | break; | 679 | break; |
678 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 680 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
679 | default: | 681 | default: |
680 | if (enc->enc_value) { | 682 | if (enc->enc_value) { |
681 | char*t=enc->enc_value; | 683 | char*t=enc->enc_value; |
682 | encoding=QString(enc->enc_value); | 684 | encoding=QString(enc->enc_value); |
683 | enc->enc_value=0L; | 685 | enc->enc_value=0L; |
684 | free(t); | 686 | free(t); |
685 | } | 687 | } |
686 | } | 688 | } |
687 | target_part.setEncoding(encoding); | 689 | target_part.setEncoding(encoding); |
688 | } | 690 | } |
689 | 691 | ||
690 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 692 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
691 | { | 693 | { |
692 | return fetchPart(mail,part.Positionlist(),false); | 694 | return fetchPart(mail,part.Positionlist(),false); |
693 | } | 695 | } |