author | alwin <alwin> | 2003-12-12 09:12:48 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-12 09:12:48 (UTC) |
commit | 77299749e119436aab7af82e065357fca0cead96 (patch) (unidiff) | |
tree | 0f51b6faa069d88e0cb0c297b761eef0e5c50f3d /noncore/net | |
parent | f6ff7965fe62f42fcb0fb1cdb93585e0c6ed80fe (diff) | |
download | opie-77299749e119436aab7af82e065357fca0cead96.zip opie-77299749e119436aab7af82e065357fca0cead96.tar.gz opie-77299749e119436aab7af82e065357fca0cead96.tar.bz2 |
retrieving a body structure of a multipart mail mostly finished
the first occurence of a part of type "text/xxx" will be interpreted
as body text.
ToDo: fetch the parameters for a mime-part like encoding and so on.
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 113 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 113 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 3 |
4 files changed, 196 insertions, 36 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 27f1410..fa967da 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -353,13 +353,13 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
354 | body_desc = item->att_data.att_static->att_data.att_body; | 354 | body_desc = item->att_data.att_static->att_data.att_body; |
355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { | 355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { |
356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | 358 | qDebug("Mulitpart mail"); |
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body,0); | 359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); |
360 | } | 360 | } |
361 | } else { | 361 | } else { |
362 | qDebug("error fetching body: %s",m_imap->imap_response); | 362 | qDebug("error fetching body: %s",m_imap->imap_response); |
363 | } | 363 | } |
364 | mailimap_fetch_list_free(result); | 364 | mailimap_fetch_list_free(result); |
365 | return body; | 365 | return body; |
@@ -487,34 +487,121 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
487 | break; | 487 | break; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | return l; | 490 | return l; |
491 | } | 491 | } |
492 | 492 | ||
493 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion) | 493 | QString IMAPwrapper::fetchPart(const RecMail&mail,QValueList<int>&path,bool internal_call) |
494 | { | ||
495 | QString body(""); | ||
496 | const char*mb; | ||
497 | int err; | ||
498 | mailimap_fetch_type *fetchType; | ||
499 | mailimap_set *set; | ||
500 | clistcell*current,*cur; | ||
501 | |||
502 | login(); | ||
503 | if (!m_imap) { | ||
504 | return body; | ||
505 | } | ||
506 | if (!internal_call) { | ||
507 | mb = mail.getMbox().latin1(); | ||
508 | /* select mailbox READONLY for operations */ | ||
509 | err = mailimap_examine( m_imap, (char*)mb); | ||
510 | if ( err != MAILIMAP_NO_ERROR ) { | ||
511 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | ||
512 | return body; | ||
513 | } | ||
514 | } | ||
515 | set = mailimap_set_new_single(mail.getNumber()); | ||
516 | clist*id_list=clist_new(); | ||
517 | for (unsigned j=0; j < path.count();++j) { | ||
518 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
519 | *p_id = path[j]; | ||
520 | clist_append(id_list,p_id); | ||
521 | } | ||
522 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | ||
523 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
524 | mailimap_section * section = mailimap_section_new(section_spec); | ||
525 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | ||
526 | |||
527 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | ||
528 | |||
529 | clist*result = clist_new(); | ||
530 | |||
531 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | ||
532 | mailimap_set_free( set ); | ||
533 | mailimap_fetch_type_free( fetchType ); | ||
534 | |||
535 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | ||
536 | mailimap_msg_att * msg_att; | ||
537 | msg_att = (mailimap_msg_att*)current->data; | ||
538 | mailimap_msg_att_item*msg_att_item; | ||
539 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | ||
540 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | ||
541 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | ||
542 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | ||
543 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | ||
544 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | ||
545 | if (text) { | ||
546 | body = QString(text); | ||
547 | free(text); | ||
548 | } else { | ||
549 | body = ""; | ||
550 | } | ||
551 | } | ||
552 | } | ||
553 | } | ||
554 | |||
555 | } else { | ||
556 | qDebug("error fetching text: %s",m_imap->imap_response); | ||
557 | } | ||
558 | mailimap_fetch_list_free(result); | ||
559 | return body; | ||
560 | } | ||
561 | |||
562 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | ||
494 | { | 563 | { |
495 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | 564 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ |
496 | if (!mailDescription||current_recursion==2) { | 565 | if (!mailDescription||current_recursion==10) { |
497 | return; | 566 | return; |
498 | } | 567 | } |
499 | qDebug("Mediatype: %s",mailDescription->bd_media_subtype); | ||
500 | clistcell*current; | 568 | clistcell*current; |
501 | mailimap_body*current_body; | 569 | mailimap_body*current_body; |
570 | unsigned int count = 0; | ||
502 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 571 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
572 | /* the point in the message */ | ||
573 | ++count; | ||
503 | current_body = (mailimap_body*)current->data; | 574 | current_body = (mailimap_body*)current->data; |
504 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 575 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
505 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1); | 576 | QValueList<int>clist = recList; |
577 | clist.append(count); | ||
578 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); | ||
506 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | 579 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ |
507 | RecPart currentPart; | 580 | RecPart currentPart; |
508 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | 581 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); |
509 | target_body.addPart(currentPart); | 582 | QValueList<int>clist = recList; |
583 | clist.append(count); | ||
584 | /* important: Check for is NULL 'cause a body can be empty! */ | ||
585 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { | ||
586 | QString body_text = fetchPart(mail,clist,true); | ||
587 | target_body.setBodytext(body_text); | ||
588 | target_body.setType(currentPart.Type()); | ||
589 | target_body.setSubtype(currentPart.Subtype()); | ||
590 | } else { | ||
591 | QString id(""); | ||
592 | for (unsigned int j = 0; j < clist.count();++j) { | ||
593 | id+=(j>0?".":""); | ||
594 | id+=QString("%1").arg(clist[j]); | ||
595 | } | ||
596 | qDebug("ID= %s",id.latin1()); | ||
597 | currentPart.setIdentifier(id); | ||
598 | target_body.addPart(currentPart); | ||
599 | } | ||
510 | } | 600 | } |
511 | } | 601 | } |
512 | if (current_recursion==0) { | ||
513 | |||
514 | } | ||
515 | } | 602 | } |
516 | 603 | ||
517 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 604 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) |
518 | { | 605 | { |
519 | if (!Description) { | 606 | if (!Description) { |
520 | return; | 607 | return; |
@@ -586,20 +673,12 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
586 | fillBodyFields(target_part,which->bd_fields); | 673 | fillBodyFields(target_part,which->bd_fields); |
587 | } | 674 | } |
588 | 675 | ||
589 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 676 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
590 | { | 677 | { |
591 | if (!which) return; | 678 | if (!which) return; |
592 | if (which->bd_id) { | ||
593 | qDebug("Part ID = %s",which->bd_id); | ||
594 | target_part.setIdentifier(which->bd_id); | ||
595 | } else { | ||
596 | qDebug("ID empty"); | ||
597 | target_part.setIdentifier(""); | ||
598 | } | ||
599 | |||
600 | clistcell*cur; | 679 | clistcell*cur; |
601 | mailimap_single_body_fld_param*param; | 680 | mailimap_single_body_fld_param*param; |
602 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 681 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
603 | param = (mailimap_single_body_fld_param*)cur->data; | 682 | param = (mailimap_single_body_fld_param*)cur->data; |
604 | } | 683 | } |
605 | } | 684 | } |
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h index f809edb..5ea45f3 100644 --- a/noncore/net/mail/imapwrapper.h +++ b/noncore/net/mail/imapwrapper.h | |||
@@ -22,21 +22,22 @@ class IMAPwrapper : public QObject | |||
22 | public: | 22 | public: |
23 | IMAPwrapper( IMAPaccount *a ); | 23 | IMAPwrapper( IMAPaccount *a ); |
24 | virtual ~IMAPwrapper(); | 24 | virtual ~IMAPwrapper(); |
25 | QList<IMAPFolder>* listFolders(); | 25 | QList<IMAPFolder>* listFolders(); |
26 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 26 | void listMessages(const QString & mailbox,QList<RecMail>&target ); |
27 | RecBody fetchBody(const RecMail&mail); | 27 | RecBody fetchBody(const RecMail&mail); |
28 | QString fetchPart(const RecMail&mail,QValueList<int>&path,bool internal_call=false); | ||
28 | static void imap_progress( size_t current, size_t maximum ); | 29 | static void imap_progress( size_t current, size_t maximum ); |
29 | 30 | ||
30 | protected: | 31 | protected: |
31 | RecMail*parse_list_result(mailimap_msg_att*); | 32 | RecMail*parse_list_result(mailimap_msg_att*); |
32 | void login(); | 33 | void login(); |
33 | void logout(); | 34 | void logout(); |
34 | 35 | ||
35 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 36 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
36 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion); | 37 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion=0,QValueList<int>recList=QValueList<int>()); |
37 | 38 | ||
38 | void fillPlainBody(const RecMail&mail,RecBody&target_body); | 39 | void fillPlainBody(const RecMail&mail,RecBody&target_body); |
39 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 40 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
40 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 41 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
41 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 42 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
42 | 43 | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 27f1410..fa967da 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -353,13 +353,13 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 353 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
354 | body_desc = item->att_data.att_static->att_data.att_body; | 354 | body_desc = item->att_data.att_static->att_data.att_body; |
355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { | 355 | if (body_desc->bd_type==MAILIMAP_BODY_1PART) { |
356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | 358 | qDebug("Mulitpart mail"); |
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body,0); | 359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body); |
360 | } | 360 | } |
361 | } else { | 361 | } else { |
362 | qDebug("error fetching body: %s",m_imap->imap_response); | 362 | qDebug("error fetching body: %s",m_imap->imap_response); |
363 | } | 363 | } |
364 | mailimap_fetch_list_free(result); | 364 | mailimap_fetch_list_free(result); |
365 | return body; | 365 | return body; |
@@ -487,34 +487,121 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
487 | break; | 487 | break; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | return l; | 490 | return l; |
491 | } | 491 | } |
492 | 492 | ||
493 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion) | 493 | QString IMAPwrapper::fetchPart(const RecMail&mail,QValueList<int>&path,bool internal_call) |
494 | { | ||
495 | QString body(""); | ||
496 | const char*mb; | ||
497 | int err; | ||
498 | mailimap_fetch_type *fetchType; | ||
499 | mailimap_set *set; | ||
500 | clistcell*current,*cur; | ||
501 | |||
502 | login(); | ||
503 | if (!m_imap) { | ||
504 | return body; | ||
505 | } | ||
506 | if (!internal_call) { | ||
507 | mb = mail.getMbox().latin1(); | ||
508 | /* select mailbox READONLY for operations */ | ||
509 | err = mailimap_examine( m_imap, (char*)mb); | ||
510 | if ( err != MAILIMAP_NO_ERROR ) { | ||
511 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | ||
512 | return body; | ||
513 | } | ||
514 | } | ||
515 | set = mailimap_set_new_single(mail.getNumber()); | ||
516 | clist*id_list=clist_new(); | ||
517 | for (unsigned j=0; j < path.count();++j) { | ||
518 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | ||
519 | *p_id = path[j]; | ||
520 | clist_append(id_list,p_id); | ||
521 | } | ||
522 | mailimap_section_part * section_part = mailimap_section_part_new(id_list); | ||
523 | mailimap_section_spec * section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | ||
524 | mailimap_section * section = mailimap_section_new(section_spec); | ||
525 | mailimap_fetch_att * fetch_att = mailimap_fetch_att_new_body_section(section); | ||
526 | |||
527 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | ||
528 | |||
529 | clist*result = clist_new(); | ||
530 | |||
531 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | ||
532 | mailimap_set_free( set ); | ||
533 | mailimap_fetch_type_free( fetchType ); | ||
534 | |||
535 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | ||
536 | mailimap_msg_att * msg_att; | ||
537 | msg_att = (mailimap_msg_att*)current->data; | ||
538 | mailimap_msg_att_item*msg_att_item; | ||
539 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | ||
540 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | ||
541 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | ||
542 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | ||
543 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | ||
544 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | ||
545 | if (text) { | ||
546 | body = QString(text); | ||
547 | free(text); | ||
548 | } else { | ||
549 | body = ""; | ||
550 | } | ||
551 | } | ||
552 | } | ||
553 | } | ||
554 | |||
555 | } else { | ||
556 | qDebug("error fetching text: %s",m_imap->imap_response); | ||
557 | } | ||
558 | mailimap_fetch_list_free(result); | ||
559 | return body; | ||
560 | } | ||
561 | |||
562 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion,QValueList<int>recList) | ||
494 | { | 563 | { |
495 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | 564 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ |
496 | if (!mailDescription||current_recursion==2) { | 565 | if (!mailDescription||current_recursion==10) { |
497 | return; | 566 | return; |
498 | } | 567 | } |
499 | qDebug("Mediatype: %s",mailDescription->bd_media_subtype); | ||
500 | clistcell*current; | 568 | clistcell*current; |
501 | mailimap_body*current_body; | 569 | mailimap_body*current_body; |
570 | unsigned int count = 0; | ||
502 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 571 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
572 | /* the point in the message */ | ||
573 | ++count; | ||
503 | current_body = (mailimap_body*)current->data; | 574 | current_body = (mailimap_body*)current->data; |
504 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 575 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
505 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1); | 576 | QValueList<int>clist = recList; |
577 | clist.append(count); | ||
578 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1,clist); | ||
506 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | 579 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ |
507 | RecPart currentPart; | 580 | RecPart currentPart; |
508 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | 581 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); |
509 | target_body.addPart(currentPart); | 582 | QValueList<int>clist = recList; |
583 | clist.append(count); | ||
584 | /* important: Check for is NULL 'cause a body can be empty! */ | ||
585 | if (currentPart.Type()=="text" && target_body.Bodytext().isNull() ) { | ||
586 | QString body_text = fetchPart(mail,clist,true); | ||
587 | target_body.setBodytext(body_text); | ||
588 | target_body.setType(currentPart.Type()); | ||
589 | target_body.setSubtype(currentPart.Subtype()); | ||
590 | } else { | ||
591 | QString id(""); | ||
592 | for (unsigned int j = 0; j < clist.count();++j) { | ||
593 | id+=(j>0?".":""); | ||
594 | id+=QString("%1").arg(clist[j]); | ||
595 | } | ||
596 | qDebug("ID= %s",id.latin1()); | ||
597 | currentPart.setIdentifier(id); | ||
598 | target_body.addPart(currentPart); | ||
599 | } | ||
510 | } | 600 | } |
511 | } | 601 | } |
512 | if (current_recursion==0) { | ||
513 | |||
514 | } | ||
515 | } | 602 | } |
516 | 603 | ||
517 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | 604 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) |
518 | { | 605 | { |
519 | if (!Description) { | 606 | if (!Description) { |
520 | return; | 607 | return; |
@@ -586,20 +673,12 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
586 | fillBodyFields(target_part,which->bd_fields); | 673 | fillBodyFields(target_part,which->bd_fields); |
587 | } | 674 | } |
588 | 675 | ||
589 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 676 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
590 | { | 677 | { |
591 | if (!which) return; | 678 | if (!which) return; |
592 | if (which->bd_id) { | ||
593 | qDebug("Part ID = %s",which->bd_id); | ||
594 | target_part.setIdentifier(which->bd_id); | ||
595 | } else { | ||
596 | qDebug("ID empty"); | ||
597 | target_part.setIdentifier(""); | ||
598 | } | ||
599 | |||
600 | clistcell*cur; | 679 | clistcell*cur; |
601 | mailimap_single_body_fld_param*param; | 680 | mailimap_single_body_fld_param*param; |
602 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 681 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
603 | param = (mailimap_single_body_fld_param*)cur->data; | 682 | param = (mailimap_single_body_fld_param*)cur->data; |
604 | } | 683 | } |
605 | } | 684 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index f809edb..5ea45f3 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -22,21 +22,22 @@ class IMAPwrapper : public QObject | |||
22 | public: | 22 | public: |
23 | IMAPwrapper( IMAPaccount *a ); | 23 | IMAPwrapper( IMAPaccount *a ); |
24 | virtual ~IMAPwrapper(); | 24 | virtual ~IMAPwrapper(); |
25 | QList<IMAPFolder>* listFolders(); | 25 | QList<IMAPFolder>* listFolders(); |
26 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 26 | void listMessages(const QString & mailbox,QList<RecMail>&target ); |
27 | RecBody fetchBody(const RecMail&mail); | 27 | RecBody fetchBody(const RecMail&mail); |
28 | QString fetchPart(const RecMail&mail,QValueList<int>&path,bool internal_call=false); | ||
28 | static void imap_progress( size_t current, size_t maximum ); | 29 | static void imap_progress( size_t current, size_t maximum ); |
29 | 30 | ||
30 | protected: | 31 | protected: |
31 | RecMail*parse_list_result(mailimap_msg_att*); | 32 | RecMail*parse_list_result(mailimap_msg_att*); |
32 | void login(); | 33 | void login(); |
33 | void logout(); | 34 | void logout(); |
34 | 35 | ||
35 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 36 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
36 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion); | 37 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion=0,QValueList<int>recList=QValueList<int>()); |
37 | 38 | ||
38 | void fillPlainBody(const RecMail&mail,RecBody&target_body); | 39 | void fillPlainBody(const RecMail&mail,RecBody&target_body); |
39 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | 40 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); |
40 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | 41 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); |
41 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | 42 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); |
42 | 43 | ||