author | alwin <alwin> | 2003-12-19 19:30:47 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-19 19:30:47 (UTC) |
commit | 00a0c8cf03fe746c1e3ba608bf298c8e66d065f9 (patch) (unidiff) | |
tree | 15cd3d961b3f974945f63e86dd314a12eb183575 | |
parent | b66e2d718769a3ac1ae6bc1fc135c04f532bdbf3 (diff) | |
download | opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.zip opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.tar.gz opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.tar.bz2 |
receiving and splitting a mail finished
next step: setup unique ids for attachmenst if not given an cache them.
Note: this could can used later for MH access, too. Means, pop3 and
MH wrapper should get a baseclass for the parsing funs.
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 1 |
4 files changed, 52 insertions, 16 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 2c2a42a..65cd4ba 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -425,61 +425,56 @@ void POP3wrapper::answeredMail(const RecMail&) | |||
425 | } | 425 | } |
426 | 426 | ||
427 | encodedString* POP3wrapper::fetchDecodedPart(const RecMail&,const RecPart&) | 427 | encodedString* POP3wrapper::fetchDecodedPart(const RecMail&,const RecPart&) |
428 | { | 428 | { |
429 | return new encodedString(); | 429 | return new encodedString(); |
430 | } | 430 | } |
431 | 431 | ||
432 | encodedString* POP3wrapper::fetchRawPart(const RecMail&,const RecPart&) | 432 | encodedString* POP3wrapper::fetchRawPart(const RecMail&,const RecPart&) |
433 | { | 433 | { |
434 | return new encodedString(); | 434 | return new encodedString(); |
435 | } | 435 | } |
436 | 436 | ||
437 | void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) | 437 | void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) |
438 | { | 438 | { |
439 | if (current_rec >= 10) { | 439 | if (current_rec >= 10) { |
440 | qDebug("too deep recursion!"); | 440 | qDebug("too deep recursion!"); |
441 | } | 441 | } |
442 | if (!message || !mime) { | 442 | if (!message || !mime) { |
443 | return; | 443 | return; |
444 | } | 444 | } |
445 | int r; | 445 | int r; |
446 | char*data = 0; | 446 | char*data = 0; |
447 | size_t len; | 447 | size_t len; |
448 | clistiter * cur = 0; | 448 | clistiter * cur = 0; |
449 | mailmime_single_fields fields; | ||
450 | int res; | 449 | int res; |
451 | QString b; | 450 | QString b; |
452 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
453 | RecPart part; | 451 | RecPart part; |
454 | 452 | ||
455 | if (mime->mm_mime_fields != NULL) { | ||
456 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
457 | mime->mm_content_type); | ||
458 | } | ||
459 | switch (mime->mm_type) { | 453 | switch (mime->mm_type) { |
460 | case MAILMIME_SINGLE: | 454 | case MAILMIME_SINGLE: |
461 | r = mailmessage_fetch_section(message,mime,&data,&len); | 455 | r = mailmessage_fetch_section(message,mime,&data,&len); |
456 | part.setSize(len); | ||
462 | fillSingleBody(part,message,mime); | 457 | fillSingleBody(part,message,mime); |
463 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 458 | if (part.Type()=="text" && target.Bodytext().isNull()) { |
464 | encodedString*r = new encodedString(); | 459 | encodedString*r = new encodedString(); |
465 | r->setContent(data,len); | 460 | r->setContent(data,len); |
466 | encodedString*res = decode_String(r,part.Encoding()); | 461 | encodedString*res = decode_String(r,part.Encoding()); |
467 | b = QString(res->Content()); | 462 | b = QString(res->Content()); |
468 | delete r; | 463 | delete r; |
469 | delete res; | 464 | delete res; |
470 | target.setBodytext(b); | 465 | target.setBodytext(b); |
471 | target.setDescription(part); | 466 | target.setDescription(part); |
472 | } else { | 467 | } else { |
473 | /* TODO: Add the content to a list and store it for later use */ | 468 | /* TODO: Add the content to a list and store it for later use */ |
474 | if (data) free(data); | 469 | if (data) free(data); |
475 | target.addPart(part); | 470 | target.addPart(part); |
476 | } | 471 | } |
477 | break; | 472 | break; |
478 | case MAILMIME_MULTIPLE: | 473 | case MAILMIME_MULTIPLE: |
479 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 474 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
480 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); | 475 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); |
481 | } | 476 | } |
482 | break; | 477 | break; |
483 | case MAILMIME_MESSAGE: | 478 | case MAILMIME_MESSAGE: |
484 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 479 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
485 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); | 480 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); |
@@ -502,76 +497,98 @@ QString POP3wrapper::getencoding(mailmime_mechanism*aEnc) | |||
502 | case MAILMIME_MECHANISM_BINARY: | 497 | case MAILMIME_MECHANISM_BINARY: |
503 | enc = "binary"; | 498 | enc = "binary"; |
504 | break; | 499 | break; |
505 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: | 500 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: |
506 | enc = "quoted-printable"; | 501 | enc = "quoted-printable"; |
507 | break; | 502 | break; |
508 | case MAILMIME_MECHANISM_BASE64: | 503 | case MAILMIME_MECHANISM_BASE64: |
509 | enc = "base64"; | 504 | enc = "base64"; |
510 | break; | 505 | break; |
511 | case MAILMIME_MECHANISM_TOKEN: | 506 | case MAILMIME_MECHANISM_TOKEN: |
512 | default: | 507 | default: |
513 | if (aEnc->enc_token) { | 508 | if (aEnc->enc_token) { |
514 | enc = QString(aEnc->enc_token); | 509 | enc = QString(aEnc->enc_token); |
515 | } | 510 | } |
516 | break; | 511 | break; |
517 | } | 512 | } |
518 | return enc; | 513 | return enc; |
519 | } | 514 | } |
520 | 515 | ||
521 | void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | 516 | void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) |
522 | { | 517 | { |
523 | if (!mime) { | 518 | if (!mime) { |
524 | return; | 519 | return; |
525 | } | 520 | } |
526 | mailmime_content*type = mime->mm_content_type; | ||
527 | mailmime_field*field = 0; | 521 | mailmime_field*field = 0; |
522 | mailmime_single_fields fields; | ||
523 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
524 | if (mime->mm_mime_fields != NULL) { | ||
525 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
526 | mime->mm_content_type); | ||
527 | } | ||
528 | |||
529 | mailmime_content*type = fields.fld_content; | ||
528 | clistcell*current; | 530 | clistcell*current; |
529 | if (!type) { | 531 | if (!type) { |
530 | target.setType("text"); | 532 | target.setType("text"); |
531 | target.setSubtype("plain"); | 533 | target.setSubtype("plain"); |
532 | } else { | 534 | } else { |
533 | target.setSubtype(type->ct_subtype); | 535 | target.setSubtype(type->ct_subtype); |
534 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | 536 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { |
535 | case MAILMIME_DISCRETE_TYPE_TEXT: | 537 | case MAILMIME_DISCRETE_TYPE_TEXT: |
536 | target.setType("text"); | 538 | target.setType("text"); |
537 | break; | 539 | break; |
538 | case MAILMIME_DISCRETE_TYPE_IMAGE: | 540 | case MAILMIME_DISCRETE_TYPE_IMAGE: |
539 | target.setType("image"); | 541 | target.setType("image"); |
540 | break; | 542 | break; |
541 | case MAILMIME_DISCRETE_TYPE_AUDIO: | 543 | case MAILMIME_DISCRETE_TYPE_AUDIO: |
542 | target.setType("audio"); | 544 | target.setType("audio"); |
543 | break; | 545 | break; |
544 | case MAILMIME_DISCRETE_TYPE_VIDEO: | 546 | case MAILMIME_DISCRETE_TYPE_VIDEO: |
545 | target.setType("video"); | 547 | target.setType("video"); |
546 | break; | 548 | break; |
547 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | 549 | case MAILMIME_DISCRETE_TYPE_APPLICATION: |
548 | target.setType("application"); | 550 | target.setType("application"); |
549 | break; | 551 | break; |
550 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | 552 | case MAILMIME_DISCRETE_TYPE_EXTENSION: |
551 | default: | 553 | default: |
552 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { | 554 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { |
553 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); | 555 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); |
554 | } | 556 | } |
555 | break; | 557 | break; |
556 | } | 558 | } |
559 | if (type->ct_parameters) { | ||
560 | fillParameters(target,type->ct_parameters); | ||
561 | } | ||
557 | } | 562 | } |
558 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { | 563 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { |
559 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { | 564 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { |
560 | field = (mailmime_field*)current->data; | 565 | field = (mailmime_field*)current->data; |
561 | switch(field->fld_type) { | 566 | switch(field->fld_type) { |
562 | case MAILMIME_FIELD_TRANSFER_ENCODING: | 567 | case MAILMIME_FIELD_TRANSFER_ENCODING: |
563 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); | 568 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); |
564 | break; | 569 | break; |
565 | case MAILMIME_FIELD_ID: | 570 | case MAILMIME_FIELD_ID: |
566 | target.setIdentifier(field->fld_data.fld_id); | 571 | target.setIdentifier(field->fld_data.fld_id); |
567 | break; | 572 | break; |
568 | case MAILMIME_FIELD_DESCRIPTION: | 573 | case MAILMIME_FIELD_DESCRIPTION: |
569 | target.setDescription(field->fld_data.fld_description); | 574 | target.setDescription(field->fld_data.fld_description); |
570 | break; | 575 | break; |
571 | default: | 576 | default: |
572 | break; | 577 | break; |
573 | } | 578 | } |
574 | } | 579 | } |
575 | } | 580 | } |
576 | // TODO search the parameter list for unique id and so on | 581 | } |
582 | |||
583 | void POP3wrapper::fillParameters(RecPart&target,clist*parameters) | ||
584 | { | ||
585 | if (!parameters) {return;} | ||
586 | clistcell*current=0; | ||
587 | mailmime_parameter*param; | ||
588 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { | ||
589 | param = (mailmime_parameter*)current->data; | ||
590 | if (param) { | ||
591 | target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
592 | } | ||
593 | } | ||
577 | } | 594 | } |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 4171a76..b17928e 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -25,33 +25,34 @@ public: | |||
25 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 25 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
26 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 26 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
27 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 27 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
28 | 28 | ||
29 | virtual void deleteMail(const RecMail&mail); | 29 | virtual void deleteMail(const RecMail&mail); |
30 | virtual void answeredMail(const RecMail&mail); | 30 | virtual void answeredMail(const RecMail&mail); |
31 | 31 | ||
32 | RecBody fetchBody( const RecMail &mail ); | 32 | RecBody fetchBody( const RecMail &mail ); |
33 | static void pop3_progress( size_t current, size_t maximum ); | 33 | static void pop3_progress( size_t current, size_t maximum ); |
34 | 34 | ||
35 | protected: | 35 | protected: |
36 | void login(); | 36 | void login(); |
37 | void logout(); | 37 | void logout(); |
38 | 38 | ||
39 | RecMail *parseHeader( const char *header ); | 39 | RecMail *parseHeader( const char *header ); |
40 | RecBody parseMail( char *message ); | 40 | RecBody parseMail( char *message ); |
41 | QString parseMailboxList( mailimf_mailbox_list *list ); | 41 | QString parseMailboxList( mailimf_mailbox_list *list ); |
42 | QString parseMailbox( mailimf_mailbox *box ); | 42 | QString parseMailbox( mailimf_mailbox *box ); |
43 | QString parseGroup( mailimf_group *group ); | 43 | QString parseGroup( mailimf_group *group ); |
44 | QString parseAddressList( mailimf_address_list *list ); | 44 | QString parseAddressList( mailimf_address_list *list ); |
45 | QString parseDateTime( mailimf_date_time *date ); | 45 | QString parseDateTime( mailimf_date_time *date ); |
46 | 46 | ||
47 | static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); | 47 | static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); |
48 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 48 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
49 | static void fillParameters(RecPart&target,clist*parameters); | ||
49 | static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); | 50 | static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); |
50 | 51 | ||
51 | POP3account *account; | 52 | POP3account *account; |
52 | mailpop3 *m_pop3; | 53 | mailpop3 *m_pop3; |
53 | QString msgTempName; | 54 | QString msgTempName; |
54 | unsigned int last_msg_id; | 55 | unsigned int last_msg_id; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | #endif | 58 | #endif |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 2c2a42a..65cd4ba 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -425,61 +425,56 @@ void POP3wrapper::answeredMail(const RecMail&) | |||
425 | } | 425 | } |
426 | 426 | ||
427 | encodedString* POP3wrapper::fetchDecodedPart(const RecMail&,const RecPart&) | 427 | encodedString* POP3wrapper::fetchDecodedPart(const RecMail&,const RecPart&) |
428 | { | 428 | { |
429 | return new encodedString(); | 429 | return new encodedString(); |
430 | } | 430 | } |
431 | 431 | ||
432 | encodedString* POP3wrapper::fetchRawPart(const RecMail&,const RecPart&) | 432 | encodedString* POP3wrapper::fetchRawPart(const RecMail&,const RecPart&) |
433 | { | 433 | { |
434 | return new encodedString(); | 434 | return new encodedString(); |
435 | } | 435 | } |
436 | 436 | ||
437 | void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) | 437 | void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) |
438 | { | 438 | { |
439 | if (current_rec >= 10) { | 439 | if (current_rec >= 10) { |
440 | qDebug("too deep recursion!"); | 440 | qDebug("too deep recursion!"); |
441 | } | 441 | } |
442 | if (!message || !mime) { | 442 | if (!message || !mime) { |
443 | return; | 443 | return; |
444 | } | 444 | } |
445 | int r; | 445 | int r; |
446 | char*data = 0; | 446 | char*data = 0; |
447 | size_t len; | 447 | size_t len; |
448 | clistiter * cur = 0; | 448 | clistiter * cur = 0; |
449 | mailmime_single_fields fields; | ||
450 | int res; | 449 | int res; |
451 | QString b; | 450 | QString b; |
452 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
453 | RecPart part; | 451 | RecPart part; |
454 | 452 | ||
455 | if (mime->mm_mime_fields != NULL) { | ||
456 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
457 | mime->mm_content_type); | ||
458 | } | ||
459 | switch (mime->mm_type) { | 453 | switch (mime->mm_type) { |
460 | case MAILMIME_SINGLE: | 454 | case MAILMIME_SINGLE: |
461 | r = mailmessage_fetch_section(message,mime,&data,&len); | 455 | r = mailmessage_fetch_section(message,mime,&data,&len); |
456 | part.setSize(len); | ||
462 | fillSingleBody(part,message,mime); | 457 | fillSingleBody(part,message,mime); |
463 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 458 | if (part.Type()=="text" && target.Bodytext().isNull()) { |
464 | encodedString*r = new encodedString(); | 459 | encodedString*r = new encodedString(); |
465 | r->setContent(data,len); | 460 | r->setContent(data,len); |
466 | encodedString*res = decode_String(r,part.Encoding()); | 461 | encodedString*res = decode_String(r,part.Encoding()); |
467 | b = QString(res->Content()); | 462 | b = QString(res->Content()); |
468 | delete r; | 463 | delete r; |
469 | delete res; | 464 | delete res; |
470 | target.setBodytext(b); | 465 | target.setBodytext(b); |
471 | target.setDescription(part); | 466 | target.setDescription(part); |
472 | } else { | 467 | } else { |
473 | /* TODO: Add the content to a list and store it for later use */ | 468 | /* TODO: Add the content to a list and store it for later use */ |
474 | if (data) free(data); | 469 | if (data) free(data); |
475 | target.addPart(part); | 470 | target.addPart(part); |
476 | } | 471 | } |
477 | break; | 472 | break; |
478 | case MAILMIME_MULTIPLE: | 473 | case MAILMIME_MULTIPLE: |
479 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 474 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
480 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); | 475 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); |
481 | } | 476 | } |
482 | break; | 477 | break; |
483 | case MAILMIME_MESSAGE: | 478 | case MAILMIME_MESSAGE: |
484 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 479 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
485 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); | 480 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); |
@@ -502,76 +497,98 @@ QString POP3wrapper::getencoding(mailmime_mechanism*aEnc) | |||
502 | case MAILMIME_MECHANISM_BINARY: | 497 | case MAILMIME_MECHANISM_BINARY: |
503 | enc = "binary"; | 498 | enc = "binary"; |
504 | break; | 499 | break; |
505 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: | 500 | case MAILMIME_MECHANISM_QUOTED_PRINTABLE: |
506 | enc = "quoted-printable"; | 501 | enc = "quoted-printable"; |
507 | break; | 502 | break; |
508 | case MAILMIME_MECHANISM_BASE64: | 503 | case MAILMIME_MECHANISM_BASE64: |
509 | enc = "base64"; | 504 | enc = "base64"; |
510 | break; | 505 | break; |
511 | case MAILMIME_MECHANISM_TOKEN: | 506 | case MAILMIME_MECHANISM_TOKEN: |
512 | default: | 507 | default: |
513 | if (aEnc->enc_token) { | 508 | if (aEnc->enc_token) { |
514 | enc = QString(aEnc->enc_token); | 509 | enc = QString(aEnc->enc_token); |
515 | } | 510 | } |
516 | break; | 511 | break; |
517 | } | 512 | } |
518 | return enc; | 513 | return enc; |
519 | } | 514 | } |
520 | 515 | ||
521 | void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | 516 | void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) |
522 | { | 517 | { |
523 | if (!mime) { | 518 | if (!mime) { |
524 | return; | 519 | return; |
525 | } | 520 | } |
526 | mailmime_content*type = mime->mm_content_type; | ||
527 | mailmime_field*field = 0; | 521 | mailmime_field*field = 0; |
522 | mailmime_single_fields fields; | ||
523 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
524 | if (mime->mm_mime_fields != NULL) { | ||
525 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
526 | mime->mm_content_type); | ||
527 | } | ||
528 | |||
529 | mailmime_content*type = fields.fld_content; | ||
528 | clistcell*current; | 530 | clistcell*current; |
529 | if (!type) { | 531 | if (!type) { |
530 | target.setType("text"); | 532 | target.setType("text"); |
531 | target.setSubtype("plain"); | 533 | target.setSubtype("plain"); |
532 | } else { | 534 | } else { |
533 | target.setSubtype(type->ct_subtype); | 535 | target.setSubtype(type->ct_subtype); |
534 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | 536 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { |
535 | case MAILMIME_DISCRETE_TYPE_TEXT: | 537 | case MAILMIME_DISCRETE_TYPE_TEXT: |
536 | target.setType("text"); | 538 | target.setType("text"); |
537 | break; | 539 | break; |
538 | case MAILMIME_DISCRETE_TYPE_IMAGE: | 540 | case MAILMIME_DISCRETE_TYPE_IMAGE: |
539 | target.setType("image"); | 541 | target.setType("image"); |
540 | break; | 542 | break; |
541 | case MAILMIME_DISCRETE_TYPE_AUDIO: | 543 | case MAILMIME_DISCRETE_TYPE_AUDIO: |
542 | target.setType("audio"); | 544 | target.setType("audio"); |
543 | break; | 545 | break; |
544 | case MAILMIME_DISCRETE_TYPE_VIDEO: | 546 | case MAILMIME_DISCRETE_TYPE_VIDEO: |
545 | target.setType("video"); | 547 | target.setType("video"); |
546 | break; | 548 | break; |
547 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | 549 | case MAILMIME_DISCRETE_TYPE_APPLICATION: |
548 | target.setType("application"); | 550 | target.setType("application"); |
549 | break; | 551 | break; |
550 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | 552 | case MAILMIME_DISCRETE_TYPE_EXTENSION: |
551 | default: | 553 | default: |
552 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { | 554 | if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { |
553 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); | 555 | target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); |
554 | } | 556 | } |
555 | break; | 557 | break; |
556 | } | 558 | } |
559 | if (type->ct_parameters) { | ||
560 | fillParameters(target,type->ct_parameters); | ||
561 | } | ||
557 | } | 562 | } |
558 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { | 563 | if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { |
559 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { | 564 | for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { |
560 | field = (mailmime_field*)current->data; | 565 | field = (mailmime_field*)current->data; |
561 | switch(field->fld_type) { | 566 | switch(field->fld_type) { |
562 | case MAILMIME_FIELD_TRANSFER_ENCODING: | 567 | case MAILMIME_FIELD_TRANSFER_ENCODING: |
563 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); | 568 | target.setEncoding(getencoding(field->fld_data.fld_encoding)); |
564 | break; | 569 | break; |
565 | case MAILMIME_FIELD_ID: | 570 | case MAILMIME_FIELD_ID: |
566 | target.setIdentifier(field->fld_data.fld_id); | 571 | target.setIdentifier(field->fld_data.fld_id); |
567 | break; | 572 | break; |
568 | case MAILMIME_FIELD_DESCRIPTION: | 573 | case MAILMIME_FIELD_DESCRIPTION: |
569 | target.setDescription(field->fld_data.fld_description); | 574 | target.setDescription(field->fld_data.fld_description); |
570 | break; | 575 | break; |
571 | default: | 576 | default: |
572 | break; | 577 | break; |
573 | } | 578 | } |
574 | } | 579 | } |
575 | } | 580 | } |
576 | // TODO search the parameter list for unique id and so on | 581 | } |
582 | |||
583 | void POP3wrapper::fillParameters(RecPart&target,clist*parameters) | ||
584 | { | ||
585 | if (!parameters) {return;} | ||
586 | clistcell*current=0; | ||
587 | mailmime_parameter*param; | ||
588 | for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { | ||
589 | param = (mailmime_parameter*)current->data; | ||
590 | if (param) { | ||
591 | target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | ||
592 | } | ||
593 | } | ||
577 | } | 594 | } |
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index 4171a76..b17928e 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h | |||
@@ -25,33 +25,34 @@ public: | |||
25 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); | 25 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); |
26 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); | 26 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); |
27 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); | 27 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); |
28 | 28 | ||
29 | virtual void deleteMail(const RecMail&mail); | 29 | virtual void deleteMail(const RecMail&mail); |
30 | virtual void answeredMail(const RecMail&mail); | 30 | virtual void answeredMail(const RecMail&mail); |
31 | 31 | ||
32 | RecBody fetchBody( const RecMail &mail ); | 32 | RecBody fetchBody( const RecMail &mail ); |
33 | static void pop3_progress( size_t current, size_t maximum ); | 33 | static void pop3_progress( size_t current, size_t maximum ); |
34 | 34 | ||
35 | protected: | 35 | protected: |
36 | void login(); | 36 | void login(); |
37 | void logout(); | 37 | void logout(); |
38 | 38 | ||
39 | RecMail *parseHeader( const char *header ); | 39 | RecMail *parseHeader( const char *header ); |
40 | RecBody parseMail( char *message ); | 40 | RecBody parseMail( char *message ); |
41 | QString parseMailboxList( mailimf_mailbox_list *list ); | 41 | QString parseMailboxList( mailimf_mailbox_list *list ); |
42 | QString parseMailbox( mailimf_mailbox *box ); | 42 | QString parseMailbox( mailimf_mailbox *box ); |
43 | QString parseGroup( mailimf_group *group ); | 43 | QString parseGroup( mailimf_group *group ); |
44 | QString parseAddressList( mailimf_address_list *list ); | 44 | QString parseAddressList( mailimf_address_list *list ); |
45 | QString parseDateTime( mailimf_date_time *date ); | 45 | QString parseDateTime( mailimf_date_time *date ); |
46 | 46 | ||
47 | static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); | 47 | static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); |
48 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 48 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
49 | static void fillParameters(RecPart&target,clist*parameters); | ||
49 | static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); | 50 | static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); |
50 | 51 | ||
51 | POP3account *account; | 52 | POP3account *account; |
52 | mailpop3 *m_pop3; | 53 | mailpop3 *m_pop3; |
53 | QString msgTempName; | 54 | QString msgTempName; |
54 | unsigned int last_msg_id; | 55 | unsigned int last_msg_id; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | #endif | 58 | #endif |