author | alwin <alwin> | 2003-12-11 21:34:46 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-11 21:34:46 (UTC) |
commit | 615651f5081d60c0d83faa7118adbda884489def (patch) (unidiff) | |
tree | 01250f0d1df8054a35114b942e7f04615d5b3700 /noncore/net | |
parent | 5a1ec1c24a3265cf9511af81509bf80e6bfaeb7f (diff) | |
download | opie-615651f5081d60c0d83faa7118adbda884489def.zip opie-615651f5081d60c0d83faa7118adbda884489def.tar.gz opie-615651f5081d60c0d83faa7118adbda884489def.tar.bz2 |
reading of body structure most part finished
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 214 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.h | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 214 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 39 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 16 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 39 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 16 |
8 files changed, 456 insertions, 112 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index e6e9fc9..27f1410 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -25,3 +25,2 @@ void IMAPwrapper::login() | |||
25 | { | 25 | { |
26 | logout(); | ||
27 | const char *server, *user, *pass; | 26 | const char *server, *user, *pass; |
@@ -30,2 +29,7 @@ void IMAPwrapper::login() | |||
30 | 29 | ||
30 | /* we are connected this moment */ | ||
31 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | ||
32 | if (m_imap) { | ||
33 | return; | ||
34 | } | ||
31 | server = account->getServer().latin1(); | 35 | server = account->getServer().latin1(); |
@@ -37,4 +41,3 @@ void IMAPwrapper::login() | |||
37 | /* connect */ | 41 | /* connect */ |
38 | // err = mailimap_socket_connect( m_imap, (char*)server, port ); | 42 | if (account->getSSL()) { |
39 | if (account->getSSL()) { | ||
40 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 43 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
@@ -79,3 +82,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
79 | clistcell *current; | 82 | clistcell *current; |
80 | mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate; | 83 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
81 | mailimap_fetch_type *fetchType; | 84 | mailimap_fetch_type *fetchType; |
@@ -92,3 +95,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
92 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 95 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
93 | logout(); | ||
94 | return; | 96 | return; |
@@ -100,3 +102,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
100 | qDebug("mailbox has no mails"); | 102 | qDebug("mailbox has no mails"); |
101 | logout(); | ||
102 | return; | 103 | return; |
@@ -107,11 +108,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
107 | set = mailimap_set_new_interval( 1, last ); | 108 | set = mailimap_set_new_interval( 1, last ); |
108 | fetchAtt = mailimap_fetch_att_new_envelope(); | ||
109 | fetchAttFlags = mailimap_fetch_att_new_flags(); | ||
110 | fetchAttDate = mailimap_fetch_att_new_internaldate(); | ||
111 | |||
112 | //fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | ||
113 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 109 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
114 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAtt); | 110 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
115 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAttFlags); | 111 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
116 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAttDate); | 112 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
113 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | ||
117 | 114 | ||
@@ -119,3 +116,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
119 | mailimap_set_free( set ); | 116 | mailimap_set_free( set ); |
120 | /* cleans up the fetch_att's too! */ | ||
121 | mailimap_fetch_type_free( fetchType ); | 117 | mailimap_fetch_type_free( fetchType ); |
@@ -125,6 +121,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
125 | if ( err == MAILIMAP_NO_ERROR ) { | 121 | if ( err == MAILIMAP_NO_ERROR ) { |
126 | current = clist_begin(result); | 122 | |
127 | mailimap_msg_att * msg_att; | 123 | mailimap_msg_att * msg_att; |
128 | int i = 0; | 124 | int i = 0; |
129 | while ( current != 0 ) { | 125 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
130 | ++i; | 126 | ++i; |
@@ -137,3 +133,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
137 | } | 133 | } |
138 | current = current->next; | ||
139 | } | 134 | } |
@@ -142,4 +137,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
142 | } | 137 | } |
143 | logout(); | 138 | mailimap_fetch_list_free(result); |
144 | clist_free(result); | ||
145 | } | 139 | } |
@@ -221,2 +215,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
221 | mailimap_flag_fetch*cflag; | 215 | mailimap_flag_fetch*cflag; |
216 | int size; | ||
222 | QBitArray mFlags(7); | 217 | QBitArray mFlags(7); |
@@ -227,7 +222,6 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
227 | } | 222 | } |
228 | 223 | m = new RecMail(); | |
229 | c = clist_begin(m_att->att_list); | 224 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
230 | while ( c ) { | ||
231 | current = c; | 225 | current = c; |
232 | c = c->next; | 226 | size = 0; |
233 | item = (mailimap_msg_att_item*)current->data; | 227 | item = (mailimap_msg_att_item*)current->data; |
@@ -239,3 +233,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
239 | cf = flist->att_list->first; | 233 | cf = flist->att_list->first; |
240 | while (cf) { | 234 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { |
241 | cflag = (mailimap_flag_fetch*)cf->data; | 235 | cflag = (mailimap_flag_fetch*)cf->data; |
@@ -268,3 +262,2 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
268 | } | 262 | } |
269 | cf = cf->next; | ||
270 | } | 263 | } |
@@ -272,7 +265,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
272 | } | 265 | } |
273 | if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { | 266 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
274 | qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header ); | ||
275 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | ||
276 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 267 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
277 | m = new RecMail(); | ||
278 | m->setDate(head->env_date); | 268 | m->setDate(head->env_date); |
@@ -309,4 +299,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
309 | qDebug(da.toString()); | 299 | qDebug(da.toString()); |
310 | } else { | 300 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
311 | qDebug("Another type"); | 301 | size = item->att_data.att_static->att_data.att_rfc822_size; |
312 | } | 302 | } |
@@ -320,2 +310,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
320 | m->setFlags(mFlags); | 310 | m->setFlags(mFlags); |
311 | m->setMsgsize(size); | ||
321 | } | 312 | } |
@@ -346,5 +337,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
346 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
347 | logout(); | ||
348 | return body; | 338 | return body; |
349 | } | 339 | } |
340 | |||
350 | result = clist_new(); | 341 | result = clist_new(); |
@@ -352,3 +343,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
352 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
353 | fetchAtt = mailimap_fetch_att_new_body(); | 344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
354 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
@@ -365,5 +356,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
365 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
366 | } else { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | ||
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body,0); | ||
367 | } | 360 | } |
368 | |||
369 | } else { | 361 | } else { |
@@ -371,5 +363,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
371 | } | 363 | } |
372 | 364 | mailimap_fetch_list_free(result); | |
373 | clist_free(result); | ||
374 | logout(); | ||
375 | return body; | 365 | return body; |
@@ -377,2 +367,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
377 | 367 | ||
368 | /* this routine is just called when the mail has only ONE part. | ||
369 | for filling the parts of a multi-part-message there are other | ||
370 | routines 'cause we can not simply fetch the whole body. */ | ||
378 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body) | 371 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body) |
@@ -382,5 +375,16 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
382 | } | 375 | } |
376 | QString sub; | ||
383 | switch (mailDescription->bd_type) { | 377 | switch (mailDescription->bd_type) { |
378 | case MAILIMAP_BODY_TYPE_1PART_MSG: | ||
379 | target_body.setType("text"); | ||
380 | sub = mailDescription->bd_data.bd_type_text->bd_media_text; | ||
381 | target_body.setSubtype(sub.lower()); | ||
382 | fillPlainBody(mail,target_body); | ||
383 | break; | ||
384 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 384 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
385 | fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text); | 385 | qDebug("Mediatype single: %s",mailDescription->bd_data.bd_type_text->bd_media_text); |
386 | target_body.setType("text"); | ||
387 | sub = mailDescription->bd_data.bd_type_text->bd_media_text; | ||
388 | target_body.setSubtype(sub.lower()); | ||
389 | fillPlainBody(mail,target_body); | ||
386 | break; | 390 | break; |
@@ -392,3 +396,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
392 | 396 | ||
393 | void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd) | 397 | void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body) |
394 | { | 398 | { |
@@ -428,6 +432,9 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
428 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 432 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
429 | int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length; | ||
430 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 433 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
431 | body = QString(text); | 434 | if (text) { |
432 | free(text); | 435 | body = QString(text); |
436 | free(text); | ||
437 | } else { | ||
438 | body = ""; | ||
439 | } | ||
433 | } | 440 | } |
@@ -439,3 +446,2 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
439 | } | 446 | } |
440 | //clist_free(result); | ||
441 | mailimap_fetch_list_free(result); | 447 | mailimap_fetch_list_free(result); |
@@ -455,5 +461,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
455 | } | 461 | } |
456 | current = clist_begin(list); | ||
457 | unsigned int count = 0; | 462 | unsigned int count = 0; |
458 | while (current!= NULL) { | 463 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
459 | from = ""; | 464 | from = ""; |
@@ -461,3 +466,2 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
461 | current_address=(mailimap_address*)current->data; | 466 | current_address=(mailimap_address*)current->data; |
462 | current = current->next; | ||
463 | if (current_address->ad_personal_name){ | 467 | if (current_address->ad_personal_name){ |
@@ -487 +491,115 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
487 | } | 491 | } |
492 | |||
493 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion) | ||
494 | { | ||
495 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | ||
496 | if (!mailDescription||current_recursion==2) { | ||
497 | return; | ||
498 | } | ||
499 | qDebug("Mediatype: %s",mailDescription->bd_media_subtype); | ||
500 | clistcell*current; | ||
501 | mailimap_body*current_body; | ||
502 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | ||
503 | current_body = (mailimap_body*)current->data; | ||
504 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | ||
505 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1); | ||
506 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | ||
507 | RecPart currentPart; | ||
508 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | ||
509 | target_body.addPart(currentPart); | ||
510 | } | ||
511 | } | ||
512 | if (current_recursion==0) { | ||
513 | |||
514 | } | ||
515 | } | ||
516 | |||
517 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | ||
518 | { | ||
519 | if (!Description) { | ||
520 | return; | ||
521 | } | ||
522 | switch (Description->bd_type) { | ||
523 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | ||
524 | target_part.setType("text"); | ||
525 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | ||
526 | break; | ||
527 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | ||
528 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | ||
529 | break; | ||
530 | default: | ||
531 | break; | ||
532 | } | ||
533 | } | ||
534 | |||
535 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | ||
536 | { | ||
537 | if (!which) { | ||
538 | return; | ||
539 | } | ||
540 | QString sub; | ||
541 | sub = which->bd_media_text; | ||
542 | target_part.setSubtype(sub.lower()); | ||
543 | target_part.setLines(which->bd_lines); | ||
544 | fillBodyFields(target_part,which->bd_fields); | ||
545 | } | ||
546 | |||
547 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | ||
548 | { | ||
549 | if (!which) { | ||
550 | return; | ||
551 | } | ||
552 | QString type,sub; | ||
553 | switch (which->bd_media_basic->med_type) { | ||
554 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | ||
555 | type = "application"; | ||
556 | break; | ||
557 | case MAILIMAP_MEDIA_BASIC_AUDIO: | ||
558 | type = "audio"; | ||
559 | break; | ||
560 | case MAILIMAP_MEDIA_BASIC_IMAGE: | ||
561 | type = "image"; | ||
562 | break; | ||
563 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | ||
564 | type = "message"; | ||
565 | break; | ||
566 | case MAILIMAP_MEDIA_BASIC_VIDEO: | ||
567 | type = "video"; | ||
568 | break; | ||
569 | case MAILIMAP_MEDIA_BASIC_OTHER: | ||
570 | default: | ||
571 | if (which->bd_media_basic->med_basic_type) { | ||
572 | type = which->bd_media_basic->med_basic_type; | ||
573 | } else { | ||
574 | type = ""; | ||
575 | } | ||
576 | break; | ||
577 | } | ||
578 | if (which->bd_media_basic->med_subtype) { | ||
579 | sub = which->bd_media_basic->med_subtype; | ||
580 | } else { | ||
581 | sub = ""; | ||
582 | } | ||
583 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | ||
584 | target_part.setType(type.lower()); | ||
585 | target_part.setSubtype(sub.lower()); | ||
586 | fillBodyFields(target_part,which->bd_fields); | ||
587 | } | ||
588 | |||
589 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | ||
590 | { | ||
591 | 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; | ||
601 | mailimap_single_body_fld_param*param; | ||
602 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | ||
603 | param = (mailimap_single_body_fld_param*)cur->data; | ||
604 | } | ||
605 | } | ||
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h index 90f3004..f809edb 100644 --- a/noncore/net/mail/imapwrapper.h +++ b/noncore/net/mail/imapwrapper.h | |||
@@ -9,2 +9,5 @@ struct mailimap_body_type_1part; | |||
9 | struct mailimap_body_type_text; | 9 | struct mailimap_body_type_text; |
10 | struct mailimap_body_type_basic; | ||
11 | struct mailimap_body_type_mpart; | ||
12 | struct mailimap_body_fields; | ||
10 | struct mailimap_msg_att; | 13 | struct mailimap_msg_att; |
@@ -12,2 +15,3 @@ class RecMail; | |||
12 | class RecBody; | 15 | class RecBody; |
16 | class RecPart; | ||
13 | 17 | ||
@@ -29,4 +33,13 @@ protected: | |||
29 | void logout(); | 33 | void logout(); |
34 | |||
30 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 35 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
31 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); | 36 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion); |
37 | |||
38 | void fillPlainBody(const RecMail&mail,RecBody&target_body); | ||
39 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | ||
40 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | ||
41 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | ||
42 | |||
43 | /* just helpers */ | ||
44 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | ||
32 | static QStringList address_list_to_stringlist(clist*list); | 45 | static QStringList address_list_to_stringlist(clist*list); |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index e6e9fc9..27f1410 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -25,3 +25,2 @@ void IMAPwrapper::login() | |||
25 | { | 25 | { |
26 | logout(); | ||
27 | const char *server, *user, *pass; | 26 | const char *server, *user, *pass; |
@@ -30,2 +29,7 @@ void IMAPwrapper::login() | |||
30 | 29 | ||
30 | /* we are connected this moment */ | ||
31 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | ||
32 | if (m_imap) { | ||
33 | return; | ||
34 | } | ||
31 | server = account->getServer().latin1(); | 35 | server = account->getServer().latin1(); |
@@ -37,4 +41,3 @@ void IMAPwrapper::login() | |||
37 | /* connect */ | 41 | /* connect */ |
38 | // err = mailimap_socket_connect( m_imap, (char*)server, port ); | 42 | if (account->getSSL()) { |
39 | if (account->getSSL()) { | ||
40 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 43 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
@@ -79,3 +82,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
79 | clistcell *current; | 82 | clistcell *current; |
80 | mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate; | 83 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
81 | mailimap_fetch_type *fetchType; | 84 | mailimap_fetch_type *fetchType; |
@@ -92,3 +95,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
92 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 95 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
93 | logout(); | ||
94 | return; | 96 | return; |
@@ -100,3 +102,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
100 | qDebug("mailbox has no mails"); | 102 | qDebug("mailbox has no mails"); |
101 | logout(); | ||
102 | return; | 103 | return; |
@@ -107,11 +108,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
107 | set = mailimap_set_new_interval( 1, last ); | 108 | set = mailimap_set_new_interval( 1, last ); |
108 | fetchAtt = mailimap_fetch_att_new_envelope(); | ||
109 | fetchAttFlags = mailimap_fetch_att_new_flags(); | ||
110 | fetchAttDate = mailimap_fetch_att_new_internaldate(); | ||
111 | |||
112 | //fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | ||
113 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 109 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
114 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAtt); | 110 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
115 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAttFlags); | 111 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
116 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAttDate); | 112 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
113 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | ||
117 | 114 | ||
@@ -119,3 +116,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
119 | mailimap_set_free( set ); | 116 | mailimap_set_free( set ); |
120 | /* cleans up the fetch_att's too! */ | ||
121 | mailimap_fetch_type_free( fetchType ); | 117 | mailimap_fetch_type_free( fetchType ); |
@@ -125,6 +121,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
125 | if ( err == MAILIMAP_NO_ERROR ) { | 121 | if ( err == MAILIMAP_NO_ERROR ) { |
126 | current = clist_begin(result); | 122 | |
127 | mailimap_msg_att * msg_att; | 123 | mailimap_msg_att * msg_att; |
128 | int i = 0; | 124 | int i = 0; |
129 | while ( current != 0 ) { | 125 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
130 | ++i; | 126 | ++i; |
@@ -137,3 +133,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
137 | } | 133 | } |
138 | current = current->next; | ||
139 | } | 134 | } |
@@ -142,4 +137,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
142 | } | 137 | } |
143 | logout(); | 138 | mailimap_fetch_list_free(result); |
144 | clist_free(result); | ||
145 | } | 139 | } |
@@ -221,2 +215,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
221 | mailimap_flag_fetch*cflag; | 215 | mailimap_flag_fetch*cflag; |
216 | int size; | ||
222 | QBitArray mFlags(7); | 217 | QBitArray mFlags(7); |
@@ -227,7 +222,6 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
227 | } | 222 | } |
228 | 223 | m = new RecMail(); | |
229 | c = clist_begin(m_att->att_list); | 224 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
230 | while ( c ) { | ||
231 | current = c; | 225 | current = c; |
232 | c = c->next; | 226 | size = 0; |
233 | item = (mailimap_msg_att_item*)current->data; | 227 | item = (mailimap_msg_att_item*)current->data; |
@@ -239,3 +233,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
239 | cf = flist->att_list->first; | 233 | cf = flist->att_list->first; |
240 | while (cf) { | 234 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { |
241 | cflag = (mailimap_flag_fetch*)cf->data; | 235 | cflag = (mailimap_flag_fetch*)cf->data; |
@@ -268,3 +262,2 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
268 | } | 262 | } |
269 | cf = cf->next; | ||
270 | } | 263 | } |
@@ -272,7 +265,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
272 | } | 265 | } |
273 | if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { | 266 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
274 | qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header ); | ||
275 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | ||
276 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 267 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
277 | m = new RecMail(); | ||
278 | m->setDate(head->env_date); | 268 | m->setDate(head->env_date); |
@@ -309,4 +299,4 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
309 | qDebug(da.toString()); | 299 | qDebug(da.toString()); |
310 | } else { | 300 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
311 | qDebug("Another type"); | 301 | size = item->att_data.att_static->att_data.att_rfc822_size; |
312 | } | 302 | } |
@@ -320,2 +310,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
320 | m->setFlags(mFlags); | 310 | m->setFlags(mFlags); |
311 | m->setMsgsize(size); | ||
321 | } | 312 | } |
@@ -346,5 +337,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
346 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 337 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
347 | logout(); | ||
348 | return body; | 338 | return body; |
349 | } | 339 | } |
340 | |||
350 | result = clist_new(); | 341 | result = clist_new(); |
@@ -352,3 +343,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
352 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 343 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
353 | fetchAtt = mailimap_fetch_att_new_body(); | 344 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
354 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 345 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
@@ -365,5 +356,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
365 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); | 356 | searchBodyText(mail,body_desc->bd_data.bd_body_1part,body); |
366 | } else { | 357 | } else if (body_desc->bd_type==MAILIMAP_BODY_MPART) { |
358 | qDebug("Mulitpart mail"); | ||
359 | searchBodyText(mail,body_desc->bd_data.bd_body_mpart,body,0); | ||
367 | } | 360 | } |
368 | |||
369 | } else { | 361 | } else { |
@@ -371,5 +363,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
371 | } | 363 | } |
372 | 364 | mailimap_fetch_list_free(result); | |
373 | clist_free(result); | ||
374 | logout(); | ||
375 | return body; | 365 | return body; |
@@ -377,2 +367,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) | |||
377 | 367 | ||
368 | /* this routine is just called when the mail has only ONE part. | ||
369 | for filling the parts of a multi-part-message there are other | ||
370 | routines 'cause we can not simply fetch the whole body. */ | ||
378 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body) | 371 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body) |
@@ -382,5 +375,16 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
382 | } | 375 | } |
376 | QString sub; | ||
383 | switch (mailDescription->bd_type) { | 377 | switch (mailDescription->bd_type) { |
378 | case MAILIMAP_BODY_TYPE_1PART_MSG: | ||
379 | target_body.setType("text"); | ||
380 | sub = mailDescription->bd_data.bd_type_text->bd_media_text; | ||
381 | target_body.setSubtype(sub.lower()); | ||
382 | fillPlainBody(mail,target_body); | ||
383 | break; | ||
384 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 384 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
385 | fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text); | 385 | qDebug("Mediatype single: %s",mailDescription->bd_data.bd_type_text->bd_media_text); |
386 | target_body.setType("text"); | ||
387 | sub = mailDescription->bd_data.bd_type_text->bd_media_text; | ||
388 | target_body.setSubtype(sub.lower()); | ||
389 | fillPlainBody(mail,target_body); | ||
386 | break; | 390 | break; |
@@ -392,3 +396,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai | |||
392 | 396 | ||
393 | void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd) | 397 | void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body) |
394 | { | 398 | { |
@@ -428,6 +432,9 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
428 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 432 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
429 | int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length; | ||
430 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 433 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
431 | body = QString(text); | 434 | if (text) { |
432 | free(text); | 435 | body = QString(text); |
436 | free(text); | ||
437 | } else { | ||
438 | body = ""; | ||
439 | } | ||
433 | } | 440 | } |
@@ -439,3 +446,2 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap | |||
439 | } | 446 | } |
440 | //clist_free(result); | ||
441 | mailimap_fetch_list_free(result); | 447 | mailimap_fetch_list_free(result); |
@@ -455,5 +461,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
455 | } | 461 | } |
456 | current = clist_begin(list); | ||
457 | unsigned int count = 0; | 462 | unsigned int count = 0; |
458 | while (current!= NULL) { | 463 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
459 | from = ""; | 464 | from = ""; |
@@ -461,3 +466,2 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
461 | current_address=(mailimap_address*)current->data; | 466 | current_address=(mailimap_address*)current->data; |
462 | current = current->next; | ||
463 | if (current_address->ad_personal_name){ | 467 | if (current_address->ad_personal_name){ |
@@ -487 +491,115 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | |||
487 | } | 491 | } |
492 | |||
493 | void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion) | ||
494 | { | ||
495 | /* current_recursion is for avoiding ugly mails which has a to deep body-structure */ | ||
496 | if (!mailDescription||current_recursion==2) { | ||
497 | return; | ||
498 | } | ||
499 | qDebug("Mediatype: %s",mailDescription->bd_media_subtype); | ||
500 | clistcell*current; | ||
501 | mailimap_body*current_body; | ||
502 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | ||
503 | current_body = (mailimap_body*)current->data; | ||
504 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | ||
505 | searchBodyText(mail,current_body->bd_data.bd_body_mpart,target_body,current_recursion+1); | ||
506 | } else if (current_body->bd_type==MAILIMAP_BODY_1PART){ | ||
507 | RecPart currentPart; | ||
508 | fillSinglePart(currentPart,current_body->bd_data.bd_body_1part); | ||
509 | target_body.addPart(currentPart); | ||
510 | } | ||
511 | } | ||
512 | if (current_recursion==0) { | ||
513 | |||
514 | } | ||
515 | } | ||
516 | |||
517 | void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) | ||
518 | { | ||
519 | if (!Description) { | ||
520 | return; | ||
521 | } | ||
522 | switch (Description->bd_type) { | ||
523 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | ||
524 | target_part.setType("text"); | ||
525 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | ||
526 | break; | ||
527 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | ||
528 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | ||
529 | break; | ||
530 | default: | ||
531 | break; | ||
532 | } | ||
533 | } | ||
534 | |||
535 | void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) | ||
536 | { | ||
537 | if (!which) { | ||
538 | return; | ||
539 | } | ||
540 | QString sub; | ||
541 | sub = which->bd_media_text; | ||
542 | target_part.setSubtype(sub.lower()); | ||
543 | target_part.setLines(which->bd_lines); | ||
544 | fillBodyFields(target_part,which->bd_fields); | ||
545 | } | ||
546 | |||
547 | void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) | ||
548 | { | ||
549 | if (!which) { | ||
550 | return; | ||
551 | } | ||
552 | QString type,sub; | ||
553 | switch (which->bd_media_basic->med_type) { | ||
554 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | ||
555 | type = "application"; | ||
556 | break; | ||
557 | case MAILIMAP_MEDIA_BASIC_AUDIO: | ||
558 | type = "audio"; | ||
559 | break; | ||
560 | case MAILIMAP_MEDIA_BASIC_IMAGE: | ||
561 | type = "image"; | ||
562 | break; | ||
563 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | ||
564 | type = "message"; | ||
565 | break; | ||
566 | case MAILIMAP_MEDIA_BASIC_VIDEO: | ||
567 | type = "video"; | ||
568 | break; | ||
569 | case MAILIMAP_MEDIA_BASIC_OTHER: | ||
570 | default: | ||
571 | if (which->bd_media_basic->med_basic_type) { | ||
572 | type = which->bd_media_basic->med_basic_type; | ||
573 | } else { | ||
574 | type = ""; | ||
575 | } | ||
576 | break; | ||
577 | } | ||
578 | if (which->bd_media_basic->med_subtype) { | ||
579 | sub = which->bd_media_basic->med_subtype; | ||
580 | } else { | ||
581 | sub = ""; | ||
582 | } | ||
583 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | ||
584 | target_part.setType(type.lower()); | ||
585 | target_part.setSubtype(sub.lower()); | ||
586 | fillBodyFields(target_part,which->bd_fields); | ||
587 | } | ||
588 | |||
589 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | ||
590 | { | ||
591 | 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; | ||
601 | mailimap_single_body_fld_param*param; | ||
602 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | ||
603 | param = (mailimap_single_body_fld_param*)cur->data; | ||
604 | } | ||
605 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 90f3004..f809edb 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -9,2 +9,5 @@ struct mailimap_body_type_1part; | |||
9 | struct mailimap_body_type_text; | 9 | struct mailimap_body_type_text; |
10 | struct mailimap_body_type_basic; | ||
11 | struct mailimap_body_type_mpart; | ||
12 | struct mailimap_body_fields; | ||
10 | struct mailimap_msg_att; | 13 | struct mailimap_msg_att; |
@@ -12,2 +15,3 @@ class RecMail; | |||
12 | class RecBody; | 15 | class RecBody; |
16 | class RecPart; | ||
13 | 17 | ||
@@ -29,4 +33,13 @@ protected: | |||
29 | void logout(); | 33 | void logout(); |
34 | |||
30 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); | 35 | void searchBodyText(const RecMail&mail,mailimap_body_type_1part*mailDescription,RecBody&target_body); |
31 | void fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body); | 36 | void searchBodyText(const RecMail&mail,mailimap_body_type_mpart*mailDescription,RecBody&target_body,int current_recursion); |
37 | |||
38 | void fillPlainBody(const RecMail&mail,RecBody&target_body); | ||
39 | void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); | ||
40 | void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); | ||
41 | void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); | ||
42 | |||
43 | /* just helpers */ | ||
44 | static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); | ||
32 | static QStringList address_list_to_stringlist(clist*list); | 45 | static QStringList address_list_to_stringlist(clist*list); |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index f9e5794..0e3174d 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -4,3 +4,3 @@ | |||
4 | RecMail::RecMail() | 4 | RecMail::RecMail() |
5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
6 | { | 6 | { |
@@ -23,2 +23,3 @@ void RecMail::copy_old(const RecMail&old) | |||
23 | msg_id = old.msg_id; | 23 | msg_id = old.msg_id; |
24 | msg_size = old.msg_size; | ||
24 | msg_number = old.msg_number; | 25 | msg_number = old.msg_number; |
@@ -69,3 +70,3 @@ const QStringList& RecMail::Bcc()const | |||
69 | RecPart::RecPart() | 70 | RecPart::RecPart() |
70 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding("") | 71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0) |
71 | { | 72 | { |
@@ -73,4 +74,4 @@ RecPart::RecPart() | |||
73 | 74 | ||
74 | RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding) | 75 | RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding,unsigned int lines) |
75 | : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding) | 76 | : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding),m_lines(lines) |
76 | { | 77 | { |
@@ -82,2 +83,12 @@ RecPart::~RecPart() | |||
82 | 83 | ||
84 | void RecPart::setLines(unsigned int lines) | ||
85 | { | ||
86 | m_lines = lines; | ||
87 | } | ||
88 | |||
89 | const unsigned int RecPart::Lines()const | ||
90 | { | ||
91 | return m_lines; | ||
92 | } | ||
93 | |||
83 | const QString& RecPart::Type()const | 94 | const QString& RecPart::Type()const |
@@ -158 +169,21 @@ void RecBody::addPart(const RecPart& part) | |||
158 | } | 169 | } |
170 | |||
171 | void RecBody::setType(const QString&type) | ||
172 | { | ||
173 | m_type = type; | ||
174 | } | ||
175 | |||
176 | const QString& RecBody::Type()const | ||
177 | { | ||
178 | return m_type; | ||
179 | } | ||
180 | |||
181 | void RecBody::setSubtype(const QString&type) | ||
182 | { | ||
183 | m_subtype = type; | ||
184 | } | ||
185 | |||
186 | const QString& RecBody::Subtype()const | ||
187 | { | ||
188 | return m_subtype; | ||
189 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 6d6b080..900f10a 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -48,2 +48,4 @@ public: | |||
48 | const QString&Replyto()const{return replyto;} | 48 | const QString&Replyto()const{return replyto;} |
49 | void setMsgsize(int size){msg_size = size;} | ||
50 | const int Msgsize()const{return msg_size;} | ||
49 | 51 | ||
@@ -61,3 +63,3 @@ protected: | |||
61 | QString subject,date,from,mbox,msg_id,replyto; | 63 | QString subject,date,from,mbox,msg_id,replyto; |
62 | int msg_number; | 64 | int msg_number,msg_size; |
63 | QBitArray msg_flags; | 65 | QBitArray msg_flags; |
@@ -72,5 +74,6 @@ protected: | |||
72 | QString m_type,m_subtype,m_identifier,m_encoding; | 74 | QString m_type,m_subtype,m_identifier,m_encoding; |
75 | unsigned int m_lines; | ||
73 | public: | 76 | public: |
74 | RecPart(); | 77 | RecPart(); |
75 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); | 78 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64",unsigned int lines=0); |
76 | virtual ~RecPart(); | 79 | virtual ~RecPart(); |
@@ -85,2 +88,4 @@ public: | |||
85 | void setEncoding(const QString&encoding); | 88 | void setEncoding(const QString&encoding); |
89 | void setLines(unsigned int lines); | ||
90 | const unsigned int Lines()const; | ||
86 | }; | 91 | }; |
@@ -90,3 +95,3 @@ class RecBody | |||
90 | protected: | 95 | protected: |
91 | QString m_BodyText; | 96 | QString m_BodyText,m_type,m_subtype; |
92 | QList<RecPart> m_PartsList; | 97 | QList<RecPart> m_PartsList; |
@@ -98,2 +103,7 @@ public: | |||
98 | const QString& Bodytext()const; | 103 | const QString& Bodytext()const; |
104 | void setType(const QString&); | ||
105 | const QString&Type()const; | ||
106 | void setSubtype(const QString&); | ||
107 | const QString&Subtype()const; | ||
108 | |||
99 | 109 | ||
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp index f9e5794..0e3174d 100644 --- a/noncore/net/mail/mailtypes.cpp +++ b/noncore/net/mail/mailtypes.cpp | |||
@@ -4,3 +4,3 @@ | |||
4 | RecMail::RecMail() | 4 | RecMail::RecMail() |
5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
6 | { | 6 | { |
@@ -23,2 +23,3 @@ void RecMail::copy_old(const RecMail&old) | |||
23 | msg_id = old.msg_id; | 23 | msg_id = old.msg_id; |
24 | msg_size = old.msg_size; | ||
24 | msg_number = old.msg_number; | 25 | msg_number = old.msg_number; |
@@ -69,3 +70,3 @@ const QStringList& RecMail::Bcc()const | |||
69 | RecPart::RecPart() | 70 | RecPart::RecPart() |
70 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding("") | 71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0) |
71 | { | 72 | { |
@@ -73,4 +74,4 @@ RecPart::RecPart() | |||
73 | 74 | ||
74 | RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding) | 75 | RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding,unsigned int lines) |
75 | : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding) | 76 | : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding),m_lines(lines) |
76 | { | 77 | { |
@@ -82,2 +83,12 @@ RecPart::~RecPart() | |||
82 | 83 | ||
84 | void RecPart::setLines(unsigned int lines) | ||
85 | { | ||
86 | m_lines = lines; | ||
87 | } | ||
88 | |||
89 | const unsigned int RecPart::Lines()const | ||
90 | { | ||
91 | return m_lines; | ||
92 | } | ||
93 | |||
83 | const QString& RecPart::Type()const | 94 | const QString& RecPart::Type()const |
@@ -158 +169,21 @@ void RecBody::addPart(const RecPart& part) | |||
158 | } | 169 | } |
170 | |||
171 | void RecBody::setType(const QString&type) | ||
172 | { | ||
173 | m_type = type; | ||
174 | } | ||
175 | |||
176 | const QString& RecBody::Type()const | ||
177 | { | ||
178 | return m_type; | ||
179 | } | ||
180 | |||
181 | void RecBody::setSubtype(const QString&type) | ||
182 | { | ||
183 | m_subtype = type; | ||
184 | } | ||
185 | |||
186 | const QString& RecBody::Subtype()const | ||
187 | { | ||
188 | return m_subtype; | ||
189 | } | ||
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h index 6d6b080..900f10a 100644 --- a/noncore/net/mail/mailtypes.h +++ b/noncore/net/mail/mailtypes.h | |||
@@ -48,2 +48,4 @@ public: | |||
48 | const QString&Replyto()const{return replyto;} | 48 | const QString&Replyto()const{return replyto;} |
49 | void setMsgsize(int size){msg_size = size;} | ||
50 | const int Msgsize()const{return msg_size;} | ||
49 | 51 | ||
@@ -61,3 +63,3 @@ protected: | |||
61 | QString subject,date,from,mbox,msg_id,replyto; | 63 | QString subject,date,from,mbox,msg_id,replyto; |
62 | int msg_number; | 64 | int msg_number,msg_size; |
63 | QBitArray msg_flags; | 65 | QBitArray msg_flags; |
@@ -72,5 +74,6 @@ protected: | |||
72 | QString m_type,m_subtype,m_identifier,m_encoding; | 74 | QString m_type,m_subtype,m_identifier,m_encoding; |
75 | unsigned int m_lines; | ||
73 | public: | 76 | public: |
74 | RecPart(); | 77 | RecPart(); |
75 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64"); | 78 | RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64",unsigned int lines=0); |
76 | virtual ~RecPart(); | 79 | virtual ~RecPart(); |
@@ -85,2 +88,4 @@ public: | |||
85 | void setEncoding(const QString&encoding); | 88 | void setEncoding(const QString&encoding); |
89 | void setLines(unsigned int lines); | ||
90 | const unsigned int Lines()const; | ||
86 | }; | 91 | }; |
@@ -90,3 +95,3 @@ class RecBody | |||
90 | protected: | 95 | protected: |
91 | QString m_BodyText; | 96 | QString m_BodyText,m_type,m_subtype; |
92 | QList<RecPart> m_PartsList; | 97 | QList<RecPart> m_PartsList; |
@@ -98,2 +103,7 @@ public: | |||
98 | const QString& Bodytext()const; | 103 | const QString& Bodytext()const; |
104 | void setType(const QString&); | ||
105 | const QString&Type()const; | ||
106 | void setSubtype(const QString&); | ||
107 | const QString&Subtype()const; | ||
108 | |||
99 | 109 | ||