summaryrefslogtreecommitdiff
path: root/noncore/net/mail/smtpwrapper.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/smtpwrapper.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp
index a7e4837..21992b4 100644
--- a/noncore/net/mail/smtpwrapper.cpp
+++ b/noncore/net/mail/smtpwrapper.cpp
@@ -441,7 +441,9 @@ char *SMTPwrapper::getFrom( mailimf_field *ffrom)
441 441
442char *SMTPwrapper::getFrom( mailmime *mail ) 442char *SMTPwrapper::getFrom( mailmime *mail )
443{ 443{
444 /* no need to delete - its just a pointer to structure content */
444 mailimf_field *ffrom = 0; 445 mailimf_field *ffrom = 0;
446 char*f = 0;
445 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); 447 ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM );
446 return getFrom(ffrom); 448 return getFrom(ffrom);
447} 449}
@@ -563,6 +565,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp )
563 from = getFrom( mail ); 565 from = getFrom( mail );
564 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 566 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
565 smtpSend(from,rcpts,data,size,smtp); 567 smtpSend(from,rcpts,data,size,smtp);
568 if (data) {free(data);}
569 if (from) {free(from);}
570 if (rcpts) smtp_address_list_free( rcpts );
566} 571}
567 572
568int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ) 573int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp )
@@ -630,10 +635,7 @@ free_con_session:
630free_mem_session: 635free_mem_session:
631 mailsmtp_free( session ); 636 mailsmtp_free( session );
632free_mem: 637free_mem:
633 if (rcpts) smtp_address_list_free( rcpts );
634 if (data) free( data );
635 if (server) free( server ); 638 if (server) free( server );
636 if (from) free( from );
637 if ( smtp->getLogin() ) { 639 if ( smtp->getLogin() ) {
638 free( user ); 640 free( user );
639 free( pass ); 641 free( pass );
@@ -652,7 +654,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
652 qDebug( "sendMail: error creating mime mail" ); 654 qDebug( "sendMail: error creating mime mail" );
653 } else { 655 } else {
654 sendProgress = new progressMailSend(); 656 sendProgress = new progressMailSend();
655// sendProgress->showMaximized();
656 sendProgress->show(); 657 sendProgress->show();
657 sendProgress->setMaxMails(1); 658 sendProgress->setMaxMails(1);
658 smtpSend( mimeMail,later,smtp); 659 smtpSend( mimeMail,later,smtp);
@@ -673,6 +674,7 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
673 mailimf_field*ffrom = 0; 674 mailimf_field*ffrom = 0;
674 clist *rcpts = 0; 675 clist *rcpts = 0;
675 char*from = 0; 676 char*from = 0;
677 int res = 0;
676 678
677 wrap->fetchRawBody(*which,&data,&length); 679 wrap->fetchRawBody(*which,&data,&length);
678 if (!data) return 0; 680 if (!data) return 0;
@@ -689,9 +691,22 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
689 691
690 qDebug("Size: %i vs. %i",length,strlen(data)); 692 qDebug("Size: %i vs. %i",length,strlen(data));
691 if (rcpts && from) { 693 if (rcpts && from) {
692 return smtpSend(from,rcpts,data,strlen(data),smtp ); 694 res = smtpSend(from,rcpts,data,length,smtp );
693 } 695 }
694 return 0; 696 if (fields) {
697 mailimf_fields_free(fields);
698 fields = 0;
699 }
700 if (data) {
701 free(data);
702 }
703 if (from) {
704 free(from);
705 }
706 if (rcpts) {
707 smtp_address_list_free( rcpts );
708 }
709 return res;
695} 710}
696 711
697/* this is a special fun */ 712/* this is a special fun */
@@ -717,9 +732,8 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)
717 } 732 }
718 mailsToSend.setAutoDelete(false); 733 mailsToSend.setAutoDelete(false);
719 sendProgress = new progressMailSend(); 734 sendProgress = new progressMailSend();
720// sendProgress->showMaximized(); 735 sendProgress->show();
721 sendProgress->show(); 736 sendProgress->setMaxMails(mailsToSend.count());
722 sendProgress->setMaxMails(mailsToSend.count());
723 737
724 while (mailsToSend.count()>0) { 738 while (mailsToSend.count()>0) {
725 if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { 739 if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) {
@@ -740,5 +754,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp)
740 mailsToSend.setAutoDelete(true); 754 mailsToSend.setAutoDelete(true);
741 delete wrap; 755 delete wrap;
742 return returnValue; 756 return returnValue;
743
744} 757}