summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index b1e4459..350808a 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -343,170 +343,170 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list )
343 switch ( addr->ad_type ) { 343 switch ( addr->ad_type ) {
344 case MAILIMF_ADDRESS_MAILBOX: 344 case MAILIMF_ADDRESS_MAILBOX:
345 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 345 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
346 break; 346 break;
347 case MAILIMF_ADDRESS_GROUP: 347 case MAILIMF_ADDRESS_GROUP:
348 result.append( parseGroup( addr->ad_data.ad_group ) ); 348 result.append( parseGroup( addr->ad_data.ad_group ) );
349 break; 349 break;
350 default: 350 default:
351 qDebug( "Generic: unkown mailimf address type" ); 351 qDebug( "Generic: unkown mailimf address type" );
352 break; 352 break;
353 } 353 }
354 } 354 }
355 355
356 return result; 356 return result;
357} 357}
358 358
359QString Genericwrapper::parseGroup( mailimf_group *group ) 359QString Genericwrapper::parseGroup( mailimf_group *group )
360{ 360{
361 QString result( "" ); 361 QString result( "" );
362 362
363 result.append( group->grp_display_name ); 363 result.append( group->grp_display_name );
364 result.append( ": " ); 364 result.append( ": " );
365 365
366 if ( group->grp_mb_list != NULL ) { 366 if ( group->grp_mb_list != NULL ) {
367 result.append( parseMailboxList( group->grp_mb_list ) ); 367 result.append( parseMailboxList( group->grp_mb_list ) );
368 } 368 }
369 369
370 result.append( ";" ); 370 result.append( ";" );
371 371
372 return result; 372 return result;
373} 373}
374 374
375QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) 375QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
376{ 376{
377 QString result( "" ); 377 QString result( "" );
378 378
379 if ( box->mb_display_name == NULL ) { 379 if ( box->mb_display_name == NULL ) {
380 result.append( box->mb_addr_spec ); 380 result.append( box->mb_addr_spec );
381 } else { 381 } else {
382 result.append( convert_String(box->mb_display_name).latin1() ); 382 result.append( convert_String(box->mb_display_name).latin1() );
383 result.append( " <" ); 383 result.append( " <" );
384 result.append( box->mb_addr_spec ); 384 result.append( box->mb_addr_spec );
385 result.append( ">" ); 385 result.append( ">" );
386 } 386 }
387 387
388 return result; 388 return result;
389} 389}
390 390
391QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) 391QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
392{ 392{
393 QString result( "" ); 393 QString result( "" );
394 394
395 bool first = true; 395 bool first = true;
396 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { 396 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) {
397 mailimf_mailbox *box = (mailimf_mailbox *) current->data; 397 mailimf_mailbox *box = (mailimf_mailbox *) current->data;
398 398
399 if ( !first ) { 399 if ( !first ) {
400 result.append( "," ); 400 result.append( "," );
401 } else { 401 } else {
402 first = false; 402 first = false;
403 } 403 }
404 404
405 result.append( parseMailbox( box ) ); 405 result.append( parseMailbox( box ) );
406 } 406 }
407 407
408 return result; 408 return result;
409} 409}
410 410
411encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) 411encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part)
412{ 412{
413 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); 413 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
414 if (it==bodyCache.end()) return new encodedString(); 414 if (it==bodyCache.end()) return new encodedString();
415 encodedString*t = decode_String(it.data(),part.Encoding()); 415 encodedString*t = decode_String(it.data(),part.Encoding());
416 return t; 416 return t;
417} 417}
418 418
419encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) 419encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part)
420{ 420{
421 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); 421 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
422 if (it==bodyCache.end()) return new encodedString(); 422 if (it==bodyCache.end()) return new encodedString();
423 encodedString*t = it.data(); 423 encodedString*t = it.data();
424 return t; 424 return t;
425} 425}
426 426
427QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) 427QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part)
428{ 428{
429 encodedString*t = fetchDecodedPart(mail,part); 429 encodedString*t = fetchDecodedPart(mail,part);
430 QString text=t->Content(); 430 QString text=t->Content();
431 delete t; 431 delete t;
432 return text; 432 return text;
433} 433}
434 434
435void Genericwrapper::cleanMimeCache() 435void Genericwrapper::cleanMimeCache()
436{ 436{
437 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 437 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
438 for (;it!=bodyCache.end();++it) { 438 for (;it!=bodyCache.end();++it) {
439 encodedString*t = it.data(); 439 encodedString*t = it.data();
440 //it.setValue(0); 440 //it.setValue(0);
441 if (t) delete t; 441 if (t) delete t;
442 } 442 }
443 bodyCache.clear(); 443 bodyCache.clear();
444 qDebug("Genericwrapper: cache cleaned"); 444 qDebug("Genericwrapper: cache cleaned");
445} 445}
446 446
447void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox) 447void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox)
448{ 448{
449 int r; 449 int r;
450 mailmessage_list * env_list = 0; 450 mailmessage_list * env_list = 0;
451 r = mailsession_get_messages_list(session,&env_list); 451 r = mailsession_get_messages_list(session,&env_list);
452 if (r != MAIL_NO_ERROR) { 452 if (r != MAIL_NO_ERROR) {
453 qDebug("Error message list"); 453 qDebug("Error message list");
454 return; 454 return;
455 } 455 }
456 r = mailsession_get_envelopes_list(session, env_list); 456 r = mailsession_get_envelopes_list(session, env_list);
457 if (r != MAIL_NO_ERROR) { 457 if (r != MAIL_NO_ERROR) {
458 qDebug("Error filling message list"); 458 qDebug("Error filling message list");
459 if (env_list) { 459 if (env_list) {
460 mailmessage_list_free(env_list); 460 mailmessage_list_free(env_list);
461 } 461 }
462 return; 462 return;
463 } 463 }
464 mailimf_references * refs; 464 mailimf_references * refs;
465 uint32_t i = 0; 465 uint32_t i = 0;
466 for(; i < carray_count(env_list->msg_tab) ; ++i) { 466 for(; i < carray_count(env_list->msg_tab) ; ++i) {
467 mailmessage * msg; 467 mailmessage * msg;
468 QBitArray mFlags(7); 468 QBitArray mFlags(7);
469 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 469 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
470 if (msg->msg_fields == NULL) { 470 if (msg->msg_fields == NULL) {
471 qDebug("could not fetch envelope of message %i", i); 471 //qDebug("could not fetch envelope of message %i", i);
472 continue; 472 continue;
473 } 473 }
474 RecMail * mail = new RecMail(); 474 RecMail * mail = new RecMail();
475 mail->setWrapper(this); 475 mail->setWrapper(this);
476 mail_flags * flag_result = 0; 476 mail_flags * flag_result = 0;
477 r = mailmessage_get_flags(msg,&flag_result); 477 r = mailmessage_get_flags(msg,&flag_result);
478 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 478 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
479 mFlags.setBit(FLAG_SEEN); 479 mFlags.setBit(FLAG_SEEN);
480 } 480 }
481 mailimf_single_fields single_fields; 481 mailimf_single_fields single_fields;
482 mailimf_single_fields_init(&single_fields, msg->msg_fields); 482 mailimf_single_fields_init(&single_fields, msg->msg_fields);
483 mail->setMsgsize(msg->msg_size); 483 mail->setMsgsize(msg->msg_size);
484 mail->setFlags(mFlags); 484 mail->setFlags(mFlags);
485 mail->setMbox(mailbox); 485 mail->setMbox(mailbox);
486 mail->setNumber(msg->msg_index); 486 mail->setNumber(msg->msg_index);
487 if (single_fields.fld_subject) 487 if (single_fields.fld_subject)
488 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 488 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
489 if (single_fields.fld_from) 489 if (single_fields.fld_from)
490 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); 490 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
491 if (single_fields.fld_to) 491 if (single_fields.fld_to)
492 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); 492 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
493 if (single_fields.fld_cc) 493 if (single_fields.fld_cc)
494 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 494 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
495 if (single_fields.fld_bcc) 495 if (single_fields.fld_bcc)
496 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 496 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
497 if (single_fields.fld_orig_date) 497 if (single_fields.fld_orig_date)
498 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 498 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
499 // crashes when accessing pop3 account 499 // crashes when accessing pop3 account
500 // if (single_fields.fld_message_id->mid_value) 500 // if (single_fields.fld_message_id->mid_value)
501 // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 501 // mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
502 refs = single_fields.fld_references; 502 refs = single_fields.fld_references;
503 if (refs && refs->mid_list && clist_count(refs->mid_list)) { 503 if (refs && refs->mid_list && clist_count(refs->mid_list)) {
504 char * text = (char*)refs->mid_list->first->data; 504 char * text = (char*)refs->mid_list->first->data;
505 mail->setReplyto(QString(text)); 505 mail->setReplyto(QString(text));
506 } 506 }
507 target.append(mail); 507 target.append(mail);
508 } 508 }
509 if (env_list) { 509 if (env_list) {
510 mailmessage_list_free(env_list); 510 mailmessage_list_free(env_list);
511 } 511 }
512} 512}