author | alwin <alwin> | 2004-01-02 14:46:42 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-02 14:46:42 (UTC) |
commit | f238d6cc096cd1baf3e821af80ecd51917d615ad (patch) (unidiff) | |
tree | 28ea5754277dad74a01adba74c5bf0336fa075f5 | |
parent | eac3f38c7d1c56a1800894a488e9ce35ddeb396c (diff) | |
download | opie-f238d6cc096cd1baf3e821af80ecd51917d615ad.zip opie-f238d6cc096cd1baf3e821af80ecd51917d615ad.tar.gz opie-f238d6cc096cd1baf3e821af80ecd51917d615ad.tar.bz2 |
bugfix while assigning mail-numbers
-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index 5de9299..62116ba 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp | |||
@@ -366,122 +366,122 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | |||
366 | 366 | ||
367 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | 367 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) |
368 | { | 368 | { |
369 | QString result( "" ); | 369 | QString result( "" ); |
370 | 370 | ||
371 | bool first = true; | 371 | bool first = true; |
372 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | 372 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { |
373 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | 373 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; |
374 | 374 | ||
375 | if ( !first ) { | 375 | if ( !first ) { |
376 | result.append( "," ); | 376 | result.append( "," ); |
377 | } else { | 377 | } else { |
378 | first = false; | 378 | first = false; |
379 | } | 379 | } |
380 | 380 | ||
381 | result.append( parseMailbox( box ) ); | 381 | result.append( parseMailbox( box ) ); |
382 | } | 382 | } |
383 | 383 | ||
384 | return result; | 384 | return result; |
385 | } | 385 | } |
386 | 386 | ||
387 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | 387 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) |
388 | { | 388 | { |
389 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 389 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
390 | if (it==bodyCache.end()) return new encodedString(); | 390 | if (it==bodyCache.end()) return new encodedString(); |
391 | encodedString*t = decode_String(it.data(),part.Encoding()); | 391 | encodedString*t = decode_String(it.data(),part.Encoding()); |
392 | return t; | 392 | return t; |
393 | } | 393 | } |
394 | 394 | ||
395 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | 395 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) |
396 | { | 396 | { |
397 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 397 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
398 | if (it==bodyCache.end()) return new encodedString(); | 398 | if (it==bodyCache.end()) return new encodedString(); |
399 | encodedString*t = it.data(); | 399 | encodedString*t = it.data(); |
400 | return t; | 400 | return t; |
401 | } | 401 | } |
402 | 402 | ||
403 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | 403 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) |
404 | { | 404 | { |
405 | encodedString*t = fetchDecodedPart(mail,part); | 405 | encodedString*t = fetchDecodedPart(mail,part); |
406 | QString text=t->Content(); | 406 | QString text=t->Content(); |
407 | delete t; | 407 | delete t; |
408 | return text; | 408 | return text; |
409 | } | 409 | } |
410 | 410 | ||
411 | void Genericwrapper::cleanMimeCache() | 411 | void Genericwrapper::cleanMimeCache() |
412 | { | 412 | { |
413 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 413 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
414 | for (;it!=bodyCache.end();++it) { | 414 | for (;it!=bodyCache.end();++it) { |
415 | encodedString*t = it.data(); | 415 | encodedString*t = it.data(); |
416 | //it.setValue(0); | 416 | //it.setValue(0); |
417 | if (t) delete t; | 417 | if (t) delete t; |
418 | } | 418 | } |
419 | bodyCache.clear(); | 419 | bodyCache.clear(); |
420 | qDebug("Genericwrapper: cache cleaned"); | 420 | qDebug("Genericwrapper: cache cleaned"); |
421 | } | 421 | } |
422 | 422 | ||
423 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) | 423 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) |
424 | { | 424 | { |
425 | int r; | 425 | int r; |
426 | mailmessage_list * env_list = 0; | 426 | mailmessage_list * env_list = 0; |
427 | r = mailsession_get_messages_list(session,&env_list); | 427 | r = mailsession_get_messages_list(session,&env_list); |
428 | if (r != MAIL_NO_ERROR) { | 428 | if (r != MAIL_NO_ERROR) { |
429 | qDebug("Error message list"); | 429 | qDebug("Error message list"); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | r = mailsession_get_envelopes_list(session, env_list); | 432 | r = mailsession_get_envelopes_list(session, env_list); |
433 | if (r != MAIL_NO_ERROR) { | 433 | if (r != MAIL_NO_ERROR) { |
434 | qDebug("Error filling message list"); | 434 | qDebug("Error filling message list"); |
435 | if (env_list) { | 435 | if (env_list) { |
436 | mailmessage_list_free(env_list); | 436 | mailmessage_list_free(env_list); |
437 | } | 437 | } |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | mailimf_references * refs; | 440 | mailimf_references * refs; |
441 | uint32_t i = 0; | 441 | uint32_t i = 0; |
442 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 442 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
443 | mailmessage * msg; | 443 | mailmessage * msg; |
444 | QBitArray mFlags(7); | 444 | QBitArray mFlags(7); |
445 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 445 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
446 | if (msg->msg_fields == NULL) { | 446 | if (msg->msg_fields == NULL) { |
447 | qDebug("could not fetch envelope of message %i", i); | 447 | qDebug("could not fetch envelope of message %i", i); |
448 | continue; | 448 | continue; |
449 | } | 449 | } |
450 | RecMail * mail = new RecMail(); | 450 | RecMail * mail = new RecMail(); |
451 | mail->setWrapper(this); | 451 | mail->setWrapper(this); |
452 | mail_flags * flag_result = 0; | 452 | mail_flags * flag_result = 0; |
453 | r = mailmessage_get_flags(msg,&flag_result); | 453 | r = mailmessage_get_flags(msg,&flag_result); |
454 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 454 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
455 | mFlags.setBit(FLAG_SEEN); | 455 | mFlags.setBit(FLAG_SEEN); |
456 | } | 456 | } |
457 | mailimf_single_fields single_fields; | 457 | mailimf_single_fields single_fields; |
458 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 458 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
459 | mail->setMsgsize(msg->msg_size); | 459 | mail->setMsgsize(msg->msg_size); |
460 | mail->setFlags(mFlags); | 460 | mail->setFlags(mFlags); |
461 | mail->setMbox(mailbox); | 461 | mail->setMbox(mailbox); |
462 | mail->setNumber(i+1); | 462 | mail->setNumber(msg->msg_index); |
463 | if (single_fields.fld_subject) | 463 | if (single_fields.fld_subject) |
464 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 464 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
465 | if (single_fields.fld_from) | 465 | if (single_fields.fld_from) |
466 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 466 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
467 | if (single_fields.fld_to) | 467 | if (single_fields.fld_to) |
468 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 468 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
469 | if (single_fields.fld_cc) | 469 | if (single_fields.fld_cc) |
470 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 470 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
471 | if (single_fields.fld_bcc) | 471 | if (single_fields.fld_bcc) |
472 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 472 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
473 | if (single_fields.fld_orig_date) | 473 | if (single_fields.fld_orig_date) |
474 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 474 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
475 | if (single_fields.fld_message_id->mid_value) | 475 | if (single_fields.fld_message_id->mid_value) |
476 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 476 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
477 | refs = single_fields.fld_references; | 477 | refs = single_fields.fld_references; |
478 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 478 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
479 | char * text = (char*)refs->mid_list->first->data; | 479 | char * text = (char*)refs->mid_list->first->data; |
480 | mail->setReplyto(QString(text)); | 480 | mail->setReplyto(QString(text)); |
481 | } | 481 | } |
482 | target.append(mail); | 482 | target.append(mail); |
483 | } | 483 | } |
484 | if (env_list) { | 484 | if (env_list) { |
485 | mailmessage_list_free(env_list); | 485 | mailmessage_list_free(env_list); |
486 | } | 486 | } |
487 | } | 487 | } |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 5de9299..62116ba 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -366,122 +366,122 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | |||
366 | 366 | ||
367 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | 367 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) |
368 | { | 368 | { |
369 | QString result( "" ); | 369 | QString result( "" ); |
370 | 370 | ||
371 | bool first = true; | 371 | bool first = true; |
372 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | 372 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { |
373 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | 373 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; |
374 | 374 | ||
375 | if ( !first ) { | 375 | if ( !first ) { |
376 | result.append( "," ); | 376 | result.append( "," ); |
377 | } else { | 377 | } else { |
378 | first = false; | 378 | first = false; |
379 | } | 379 | } |
380 | 380 | ||
381 | result.append( parseMailbox( box ) ); | 381 | result.append( parseMailbox( box ) ); |
382 | } | 382 | } |
383 | 383 | ||
384 | return result; | 384 | return result; |
385 | } | 385 | } |
386 | 386 | ||
387 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | 387 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) |
388 | { | 388 | { |
389 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 389 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
390 | if (it==bodyCache.end()) return new encodedString(); | 390 | if (it==bodyCache.end()) return new encodedString(); |
391 | encodedString*t = decode_String(it.data(),part.Encoding()); | 391 | encodedString*t = decode_String(it.data(),part.Encoding()); |
392 | return t; | 392 | return t; |
393 | } | 393 | } |
394 | 394 | ||
395 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | 395 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) |
396 | { | 396 | { |
397 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 397 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
398 | if (it==bodyCache.end()) return new encodedString(); | 398 | if (it==bodyCache.end()) return new encodedString(); |
399 | encodedString*t = it.data(); | 399 | encodedString*t = it.data(); |
400 | return t; | 400 | return t; |
401 | } | 401 | } |
402 | 402 | ||
403 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | 403 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) |
404 | { | 404 | { |
405 | encodedString*t = fetchDecodedPart(mail,part); | 405 | encodedString*t = fetchDecodedPart(mail,part); |
406 | QString text=t->Content(); | 406 | QString text=t->Content(); |
407 | delete t; | 407 | delete t; |
408 | return text; | 408 | return text; |
409 | } | 409 | } |
410 | 410 | ||
411 | void Genericwrapper::cleanMimeCache() | 411 | void Genericwrapper::cleanMimeCache() |
412 | { | 412 | { |
413 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 413 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
414 | for (;it!=bodyCache.end();++it) { | 414 | for (;it!=bodyCache.end();++it) { |
415 | encodedString*t = it.data(); | 415 | encodedString*t = it.data(); |
416 | //it.setValue(0); | 416 | //it.setValue(0); |
417 | if (t) delete t; | 417 | if (t) delete t; |
418 | } | 418 | } |
419 | bodyCache.clear(); | 419 | bodyCache.clear(); |
420 | qDebug("Genericwrapper: cache cleaned"); | 420 | qDebug("Genericwrapper: cache cleaned"); |
421 | } | 421 | } |
422 | 422 | ||
423 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) | 423 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) |
424 | { | 424 | { |
425 | int r; | 425 | int r; |
426 | mailmessage_list * env_list = 0; | 426 | mailmessage_list * env_list = 0; |
427 | r = mailsession_get_messages_list(session,&env_list); | 427 | r = mailsession_get_messages_list(session,&env_list); |
428 | if (r != MAIL_NO_ERROR) { | 428 | if (r != MAIL_NO_ERROR) { |
429 | qDebug("Error message list"); | 429 | qDebug("Error message list"); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | r = mailsession_get_envelopes_list(session, env_list); | 432 | r = mailsession_get_envelopes_list(session, env_list); |
433 | if (r != MAIL_NO_ERROR) { | 433 | if (r != MAIL_NO_ERROR) { |
434 | qDebug("Error filling message list"); | 434 | qDebug("Error filling message list"); |
435 | if (env_list) { | 435 | if (env_list) { |
436 | mailmessage_list_free(env_list); | 436 | mailmessage_list_free(env_list); |
437 | } | 437 | } |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | mailimf_references * refs; | 440 | mailimf_references * refs; |
441 | uint32_t i = 0; | 441 | uint32_t i = 0; |
442 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 442 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
443 | mailmessage * msg; | 443 | mailmessage * msg; |
444 | QBitArray mFlags(7); | 444 | QBitArray mFlags(7); |
445 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 445 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
446 | if (msg->msg_fields == NULL) { | 446 | if (msg->msg_fields == NULL) { |
447 | qDebug("could not fetch envelope of message %i", i); | 447 | qDebug("could not fetch envelope of message %i", i); |
448 | continue; | 448 | continue; |
449 | } | 449 | } |
450 | RecMail * mail = new RecMail(); | 450 | RecMail * mail = new RecMail(); |
451 | mail->setWrapper(this); | 451 | mail->setWrapper(this); |
452 | mail_flags * flag_result = 0; | 452 | mail_flags * flag_result = 0; |
453 | r = mailmessage_get_flags(msg,&flag_result); | 453 | r = mailmessage_get_flags(msg,&flag_result); |
454 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 454 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
455 | mFlags.setBit(FLAG_SEEN); | 455 | mFlags.setBit(FLAG_SEEN); |
456 | } | 456 | } |
457 | mailimf_single_fields single_fields; | 457 | mailimf_single_fields single_fields; |
458 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 458 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
459 | mail->setMsgsize(msg->msg_size); | 459 | mail->setMsgsize(msg->msg_size); |
460 | mail->setFlags(mFlags); | 460 | mail->setFlags(mFlags); |
461 | mail->setMbox(mailbox); | 461 | mail->setMbox(mailbox); |
462 | mail->setNumber(i+1); | 462 | mail->setNumber(msg->msg_index); |
463 | if (single_fields.fld_subject) | 463 | if (single_fields.fld_subject) |
464 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 464 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
465 | if (single_fields.fld_from) | 465 | if (single_fields.fld_from) |
466 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 466 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
467 | if (single_fields.fld_to) | 467 | if (single_fields.fld_to) |
468 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 468 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
469 | if (single_fields.fld_cc) | 469 | if (single_fields.fld_cc) |
470 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 470 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
471 | if (single_fields.fld_bcc) | 471 | if (single_fields.fld_bcc) |
472 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 472 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
473 | if (single_fields.fld_orig_date) | 473 | if (single_fields.fld_orig_date) |
474 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 474 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
475 | if (single_fields.fld_message_id->mid_value) | 475 | if (single_fields.fld_message_id->mid_value) |
476 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 476 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
477 | refs = single_fields.fld_references; | 477 | refs = single_fields.fld_references; |
478 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 478 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
479 | char * text = (char*)refs->mid_list->first->data; | 479 | char * text = (char*)refs->mid_list->first->data; |
480 | mail->setReplyto(QString(text)); | 480 | mail->setReplyto(QString(text)); |
481 | } | 481 | } |
482 | target.append(mail); | 482 | target.append(mail); |
483 | } | 483 | } |
484 | if (env_list) { | 484 | if (env_list) { |
485 | mailmessage_list_free(env_list); | 485 | mailmessage_list_free(env_list); |
486 | } | 486 | } |
487 | } | 487 | } |