summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index e054365..00181ff 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -476,25 +476,25 @@ char *SMTPwrapper::getFrom( mailmime *mail )
476 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); 476 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM );
477 return getFrom(ffrom); 477 return getFrom(ffrom);
478} 478}
479 479
480void SMTPwrapper::progress( size_t current, size_t maximum ) 480void SMTPwrapper::progress( size_t current, size_t maximum )
481{ 481{
482 if (SMTPwrapper::sendProgress) { 482 if (SMTPwrapper::sendProgress) {
483 SMTPwrapper::sendProgress->setSingleMail(current, maximum ); 483 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
484 qApp->processEvents(); 484 qApp->processEvents();
485 } 485 }
486} 486}
487 487
488void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) 488void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box)
489{ 489{
490 if (!mail) return; 490 if (!mail) return;
491 QString localfolders = AbstractMail::defaultLocalfolder(); 491 QString localfolders = AbstractMail::defaultLocalfolder();
492 MBOXwrapper*wrap = new MBOXwrapper(localfolders); 492 MBOXwrapper*wrap = new MBOXwrapper(localfolders);
493 wrap->storeMessage(mail,length,box); 493 wrap->storeMessage(mail,length,box);
494 delete wrap; 494 delete wrap;
495} 495}
496 496
497void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) 497void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
498{ 498{
499 clist *rcpts = 0; 499 clist *rcpts = 0;
500 char *from, *data; 500 char *from, *data;
@@ -527,25 +527,25 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
527 cfg.writeEntry( "outgoing", ++m_queuedMail ); 527 cfg.writeEntry( "outgoing", ++m_queuedMail );
528 emit queuedMails( m_queuedMail ); 528 emit queuedMails( m_queuedMail );
529 return; 529 return;
530 } 530 }
531 from = getFrom( mail ); 531 from = getFrom( mail );
532 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 532 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
533 smtpSend(from,rcpts,data,size,smtp); 533 smtpSend(from,rcpts,data,size,smtp);
534 if (data) {free(data);} 534 if (data) {free(data);}
535 if (from) {free(from);} 535 if (from) {free(from);}
536 if (rcpts) smtp_address_list_free( rcpts ); 536 if (rcpts) smtp_address_list_free( rcpts );
537} 537}
538 538
539int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) 539int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp )
540{ 540{
541 char *server, *user, *pass; 541 char *server, *user, *pass;
542 bool ssl; 542 bool ssl;
543 uint16_t port; 543 uint16_t port;
544 mailsmtp *session; 544 mailsmtp *session;
545 int err,result; 545 int err,result;
546 546
547 result = 1; 547 result = 1;
548 server = user = pass = 0; 548 server = user = pass = 0;
549 server = strdup( smtp->getServer().latin1() ); 549 server = strdup( smtp->getServer().latin1() );
550 ssl = smtp->getSSL(); 550 ssl = smtp->getSSL();
551 port = smtp->getPort().toUInt(); 551 port = smtp->getPort().toUInt();
@@ -631,56 +631,53 @@ void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
631 sendProgress->setMaxMails(1); 631 sendProgress->setMaxMails(1);
632 smtpSend( mimeMail,later,smtp); 632 smtpSend( mimeMail,later,smtp);
633 qDebug("Clean up done"); 633 qDebug("Clean up done");
634 sendProgress->hide(); 634 sendProgress->hide();
635 delete sendProgress; 635 delete sendProgress;
636 sendProgress = 0; 636 sendProgress = 0;
637 mailmime_free( mimeMail ); 637 mailmime_free( mimeMail );
638 } 638 }
639} 639}
640 640
641int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) 641int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
642{ 642{
643 char*data = 0;
644 size_t length = 0;
645 size_t curTok = 0; 643 size_t curTok = 0;
646 mailimf_fields *fields = 0; 644 mailimf_fields *fields = 0;
647 mailimf_field*ffrom = 0; 645 mailimf_field*ffrom = 0;
648 clist *rcpts = 0; 646 clist *rcpts = 0;
649 char*from = 0; 647 char*from = 0;
650 int res = 0; 648 int res = 0;
651 649
652 wrap->fetchRawBody(*which,&data,&length); 650 encodedString * data = wrap->fetchRawBody(*which);
653 if (!data) return 0; 651 if (!data) return 0;
654 int err = mailimf_fields_parse( data, length, &curTok, &fields ); 652 int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
655 if (err != MAILIMF_NO_ERROR) { 653 if (err != MAILIMF_NO_ERROR) {
656 free(data); 654 delete data;
657 delete wrap; 655 delete wrap;
658 return 0; 656 return 0;
659 } 657 }
660 658
661 rcpts = createRcptList( fields ); 659 rcpts = createRcptList( fields );
662 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 660 ffrom = getField(fields, MAILIMF_FIELD_FROM );
663 from = getFrom(ffrom); 661 from = getFrom(ffrom);
664 662
665 qDebug("Size: %i vs. %i",length,strlen(data));
666 if (rcpts && from) { 663 if (rcpts && from) {
667 res = smtpSend(from,rcpts,data,length,smtp ); 664 res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp );
668 } 665 }
669 if (fields) { 666 if (fields) {
670 mailimf_fields_free(fields); 667 mailimf_fields_free(fields);
671 fields = 0; 668 fields = 0;
672 } 669 }
673 if (data) { 670 if (data) {
674 free(data); 671 delete data;
675 } 672 }
676 if (from) { 673 if (from) {
677 free(from); 674 free(from);
678 } 675 }
679 if (rcpts) { 676 if (rcpts) {
680 smtp_address_list_free( rcpts ); 677 smtp_address_list_free( rcpts );
681 } 678 }
682 return res; 679 return res;
683} 680}
684 681
685/* this is a special fun */ 682/* this is a special fun */
686bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) 683bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)