summaryrefslogtreecommitdiff
authoralwin <alwin>2004-02-13 02:52:41 (UTC)
committer alwin <alwin>2004-02-13 02:52:41 (UTC)
commitaca5ba5ed24b4da61517560ea91f566afd132d28 (patch) (unidiff)
tree86085c6042e591dc9f211a8716cb63ff30cb5f4e
parent2fd9c32e07714b7caf38994c0b0f1da8ffb27aa9 (diff)
downloadopie-aca5ba5ed24b4da61517560ea91f566afd132d28.zip
opie-aca5ba5ed24b4da61517560ea91f566afd132d28.tar.gz
opie-aca5ba5ed24b4da61517560ea91f566afd132d28.tar.bz2
interface changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp156
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h27
-rw-r--r--noncore/net/mail/opiemail.cpp5
4 files changed, 107 insertions, 85 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 5e823e8..abcc3f6 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -219,10 +219,10 @@ void ComposeMail::accept()
219 mail->addAttachment( it->getAttachment() ); 219 mail->addAttachment( it->getAttachment() );
220 it = (AttachViewItem *) it->nextSibling(); 220 it = (AttachViewItem *) it->nextSibling();
221 } 221 }
222 222
223 SMTPwrapper wrapper( settings ); 223 SMTPwrapper wrapper( smtp );
224 wrapper.sendMail( *mail,smtp,checkBoxLater->isChecked() ); 224 wrapper.sendMail( *mail,checkBoxLater->isChecked() );
225 225
226 QDialog::accept(); 226 QDialog::accept();
227} 227}
228 228
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 3ab6b77..a3c68ae 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -23,16 +23,23 @@
23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; 23const char* SMTPwrapper::USER_AGENT="OpieMail v0.4";
24 24
25progressMailSend*SMTPwrapper::sendProgress = 0; 25progressMailSend*SMTPwrapper::sendProgress = 0;
26 26
27SMTPwrapper::SMTPwrapper( Settings *s ) 27SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
28: QObject() { 28 : QObject()
29 settings = s; 29{
30 m_SmtpAccount = aSmtp;
30 Config cfg( "mail" ); 31 Config cfg( "mail" );
31 cfg.setGroup( "Status" ); 32 cfg.setGroup( "Status" );
32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 33 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
33 emit queuedMails( m_queuedMail ); 34 emit queuedMails( m_queuedMail );
34 connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); 35 connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) );
36 m_smtp = 0;
37}
38
39SMTPwrapper::~SMTPwrapper()
40{
41 disc_server();
35} 42}
36 43
37void SMTPwrapper::emitQCop( int queued ) { 44void SMTPwrapper::emitQCop( int queued ) {
38 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
@@ -509,16 +516,13 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
509 wrap->storeMessage(mail,length,box); 516 wrap->storeMessage(mail,length,box);
510 delete wrap; 517 delete wrap;
511} 518}
512 519
513void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { 520void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
514 clist *rcpts = 0; 521 clist *rcpts = 0;
515 char *from, *data; 522 char *from, *data;
516 size_t size; 523 size_t size;
517 524
518 if ( smtp == NULL ) {
519 return;
520 }
521 from = data = 0; 525 from = data = 0;
522 526
523 mailmessage * msg = 0; 527 mailmessage * msg = 0;
524 msg = mime_message_init(mail); 528 msg = mime_message_init(mail);
@@ -544,9 +548,9 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) {
544 return; 548 return;
545 } 549 }
546 from = getFrom( mail ); 550 from = getFrom( mail );
547 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 551 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
548 smtpSend(from,rcpts,data,size,smtp); 552 smtpSend(from,rcpts,data,size);
549 if (data) { 553 if (data) {
550 free(data); 554 free(data);
551 } 555 }
552 if (from) { 556 if (from) {
@@ -566,72 +570,70 @@ void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*
566 tr("<center>%1</center>").arg(failuremessage)); 570 tr("<center>%1</center>").arg(failuremessage));
567 } 571 }
568} 572}
569 573
570int SMTPwrapper::start_smtp_tls(mailsmtp *session) 574int SMTPwrapper::start_smtp_tls()
571{ 575{
572 if (!session) { 576 if (!m_smtp) {
573 return MAILSMTP_ERROR_IN_PROCESSING; 577 return MAILSMTP_ERROR_IN_PROCESSING;
574 } 578 }
575 int err = mailesmtp_starttls(session); 579 int err = mailesmtp_starttls(m_smtp);
576 if (err != MAILSMTP_NO_ERROR) return err; 580 if (err != MAILSMTP_NO_ERROR) return err;
577 mailstream_low * low; 581 mailstream_low * low;
578 mailstream_low * new_low; 582 mailstream_low * new_low;
579 low = mailstream_get_low(session->stream); 583 low = mailstream_get_low(m_smtp->stream);
580 if (!low) { 584 if (!low) {
581 return MAILSMTP_ERROR_IN_PROCESSING; 585 return MAILSMTP_ERROR_IN_PROCESSING;
582 } 586 }
583 int fd = mailstream_low_get_fd(low); 587 int fd = mailstream_low_get_fd(low);
584 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { 588 if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
585 mailstream_low_free(low); 589 mailstream_low_free(low);
586 mailstream_set_low(session->stream, new_low); 590 mailstream_set_low(m_smtp->stream, new_low);
587 } else { 591 } else {
588 return MAILSMTP_ERROR_IN_PROCESSING; 592 return MAILSMTP_ERROR_IN_PROCESSING;
589 } 593 }
590 return err; 594 return err;
591} 595}
592 596
593int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) { 597void SMTPwrapper::connect_server()
598{
594 const char *server, *user, *pass; 599 const char *server, *user, *pass;
595 bool ssl; 600 bool ssl;
596 uint16_t port; 601 uint16_t port;
597 mailsmtp *session;
598 int err,result;
599 QString failuretext = "";
600
601 result = 1;
602 server = user = pass = 0;
603 server = smtp->getServer().latin1();
604
605 // FIXME: currently only TLS and Plain work.
606
607 ssl = false; 602 ssl = false;
608 bool try_tls = true; 603 bool try_tls = true;
609 bool force_tls=false; 604 bool force_tls=false;
610 605 server = user = pass = 0;
611 if ( smtp->ConnectionType() == 2 ) { 606 QString failuretext = "";
607
608 if (m_smtp || !m_SmtpAccount) {
609 return;
610 }
611 server = m_SmtpAccount->getServer().latin1();
612 if ( m_SmtpAccount->ConnectionType() == 2 ) {
612 ssl = true; 613 ssl = true;
613 try_tls = false; 614 try_tls = false;
614 } else if (smtp->ConnectionType() == 1) { 615 } else if (m_SmtpAccount->ConnectionType() == 1) {
615 force_tls = true; 616 force_tls = true;
616 } 617 }
618 int result = 1;
619 port = m_SmtpAccount->getPort().toUInt();
617 620
618 port = smtp->getPort().toUInt(); 621 m_smtp = mailsmtp_new( 20, &progress );
619 622 if ( m_smtp == NULL ) {
620 session = mailsmtp_new( 20, &progress );
621 if ( session == NULL ) {
622 /* no failure message cause this happens when problems with memory - than we 623 /* no failure message cause this happens when problems with memory - than we
623 we can not display any messagebox */ 624 we can not display any messagebox */
624 return 0; 625 return;
625 } 626 }
626 627
628 int err = MAILSMTP_NO_ERROR;
627 qDebug( "Servername %s at port %i", server, port ); 629 qDebug( "Servername %s at port %i", server, port );
628 if ( ssl ) { 630 if ( ssl ) {
629 qDebug( "SSL session" ); 631 qDebug( "SSL session" );
630 err = mailsmtp_ssl_connect( session, server, port ); 632 err = mailsmtp_ssl_connect( m_smtp, server, port );
631 } else { 633 } else {
632 qDebug( "No SSL session" ); 634 qDebug( "No SSL session" );
633 err = mailsmtp_socket_connect( session, server, port ); 635 err = mailsmtp_socket_connect( m_smtp, server, port );
634 } 636 }
635 if ( err != MAILSMTP_NO_ERROR ) { 637 if ( err != MAILSMTP_NO_ERROR ) {
636 qDebug("Error init connection"); 638 qDebug("Error init connection");
637 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 639 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
@@ -639,34 +641,35 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
639 } 641 }
640 642
641 /* switch to tls after init 'cause there it will send the ehlo */ 643 /* switch to tls after init 'cause there it will send the ehlo */
642 if (result) { 644 if (result) {
643 err = mailsmtp_init( session ); 645 err = mailsmtp_init( m_smtp );
644 if (err != MAILSMTP_NO_ERROR) { 646 if (err != MAILSMTP_NO_ERROR) {
645 result = 0; 647 result = 0;
646 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); 648 failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
647 } 649 }
648 } 650 }
649 651
650 if (try_tls) { 652 if (try_tls) {
651 err = start_smtp_tls(session); 653 err = start_smtp_tls();
652 if (err != MAILSMTP_NO_ERROR) { 654 if (err != MAILSMTP_NO_ERROR) {
653 try_tls = false; 655 try_tls = false;
654 } else { 656 } else {
655 err = mailesmtp_ehlo(session); 657 err = mailesmtp_ehlo(m_smtp);
656 } 658 }
657 } 659 }
658 660
659 if (!try_tls && force_tls) { 661 if (!try_tls && force_tls) {
660 result = 0; 662 result = 0;
661 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); 663 failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
662 } 664 }
663 665
664 if (result==1 && smtp->getLogin() ) { 666 if (result==1 && m_SmtpAccount->getLogin() ) {
665 qDebug("smtp with auth"); 667 qDebug("smtp with auth");
666 if ( smtp->getUser().isEmpty() || smtp->getPassword().isEmpty() ) { 668 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
667 // get'em 669 // get'em
668 LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); 670 LoginDialog login( m_SmtpAccount->getUser(),
671 m_SmtpAccount->getPassword(), NULL, 0, true );
669 login.show(); 672 login.show();
670 if ( QDialog::Accepted == login.exec() ) { 673 if ( QDialog::Accepted == login.exec() ) {
671 // ok 674 // ok
672 user = login.getUser().latin1(); 675 user = login.getUser().latin1();
@@ -675,70 +678,81 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
675 result = 0; 678 result = 0;
676 failuretext=tr("Login aborted - storing mail to localfolder"); 679 failuretext=tr("Login aborted - storing mail to localfolder");
677 } 680 }
678 } else { 681 } else {
679 user = smtp->getUser().latin1(); 682 user = m_SmtpAccount->getUser().latin1();
680 pass = smtp->getPassword().latin1(); 683 pass = m_SmtpAccount->getPassword().latin1();
681 } 684 }
682 qDebug( "session->auth: %i", session->auth); 685 qDebug( "session->auth: %i", m_smtp->auth);
683 if (result) { 686 if (result) {
684 err = mailsmtp_auth( session, (char*)user, (char*)pass ); 687 err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
685 if ( err == MAILSMTP_NO_ERROR ) { 688 if ( err == MAILSMTP_NO_ERROR ) {
686 qDebug("auth ok"); 689 qDebug("auth ok");
687 } else { 690 } else {
688 failuretext = tr("Authentification failed"); 691 failuretext = tr("Authentification failed");
689 result = 0; 692 result = 0;
690 } 693 }
691 } 694 }
692 } 695 }
696}
693 697
694 if (result) { 698void SMTPwrapper::disc_server()
695 err = mailsmtp_send( session, from, rcpts, data, size ); 699{
700 if (m_smtp) {
701 mailsmtp_quit( m_smtp );
702 mailsmtp_free( m_smtp );
703 m_smtp = 0;
704 }
705}
706
707int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
708{
709 int err,result;
710 QString failuretext = "";
711
712 connect_server();
713
714 result = 1;
715 if (m_smtp) {
716 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
696 if ( err != MAILSMTP_NO_ERROR ) { 717 if ( err != MAILSMTP_NO_ERROR ) {
697 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); 718 failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
698 result = 0; 719 result = 0;
699 } 720 }
721 } else {
722 result = 0;
700 } 723 }
701 724
702 if (!result) { 725 if (!result) {
703 storeFailedMail(data,size,failuretext); 726 storeFailedMail(data,size,failuretext);
704 } else { 727 } else {
705 qDebug( "Mail sent." ); 728 qDebug( "Mail sent." );
706 storeMail(data,size,"Sent"); 729 storeMail(data,size,"Sent");
707 } 730 }
708 if (session) {
709 mailsmtp_quit( session );
710 mailsmtp_free( session );
711 }
712 return result; 731 return result;
713} 732}
714 733
715void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) { 734void SMTPwrapper::sendMail(const Mail&mail,bool later )
735{
716 mailmime * mimeMail; 736 mailmime * mimeMail;
717 737
718 SMTPaccount *smtp = aSmtp;
719
720 if (!later && !smtp) {
721 qDebug("Didn't get any send method - giving up");
722 return;
723 }
724 mimeMail = createMimeMail(mail ); 738 mimeMail = createMimeMail(mail );
725 if ( mimeMail == NULL ) { 739 if ( mimeMail == NULL ) {
726 qDebug( "sendMail: error creating mime mail" ); 740 qDebug( "sendMail: error creating mime mail" );
727 } else { 741 } else {
728 sendProgress = new progressMailSend(); 742 sendProgress = new progressMailSend();
729 sendProgress->show(); 743 sendProgress->show();
730 sendProgress->setMaxMails(1); 744 sendProgress->setMaxMails(1);
731 smtpSend( mimeMail,later,smtp); 745 smtpSend( mimeMail,later);
732 qDebug("Clean up done"); 746 qDebug("Clean up done");
733 sendProgress->hide(); 747 sendProgress->hide();
734 delete sendProgress; 748 delete sendProgress;
735 sendProgress = 0; 749 sendProgress = 0;
736 mailmime_free( mimeMail ); 750 mailmime_free( mimeMail );
737 } 751 }
738} 752}
739 753
740int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which) { 754int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) {
741 size_t curTok = 0; 755 size_t curTok = 0;
742 mailimf_fields *fields = 0; 756 mailimf_fields *fields = 0;
743 mailimf_field*ffrom = 0; 757 mailimf_field*ffrom = 0;
744 clist *rcpts = 0; 758 clist *rcpts = 0;
@@ -759,9 +773,9 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which
759 ffrom = getField(fields, MAILIMF_FIELD_FROM ); 773 ffrom = getField(fields, MAILIMF_FIELD_FROM );
760 from = getFrom(ffrom); 774 from = getFrom(ffrom);
761 775
762 if (rcpts && from) { 776 if (rcpts && from) {
763 res = smtpSend(from,rcpts,data->Content(),data->Length(),smtp ); 777 res = smtpSend(from,rcpts,data->Content(),data->Length());
764 } 778 }
765 if (fields) { 779 if (fields) {
766 mailimf_fields_free(fields); 780 mailimf_fields_free(fields);
767 fields = 0; 781 fields = 0;
@@ -778,13 +792,13 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which
778 return res; 792 return res;
779} 793}
780 794
781/* this is a special fun */ 795/* this is a special fun */
782bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { 796bool SMTPwrapper::flushOutbox() {
783 bool returnValue = true; 797 bool returnValue = true;
784 798
785 qDebug("Sending the queue"); 799 qDebug("Sending the queue");
786 if (!smtp) { 800 if (!m_SmtpAccount) {
787 qDebug("No smtp account given"); 801 qDebug("No smtp account given");
788 return false; 802 return false;
789 } 803 }
790 804
@@ -805,22 +819,22 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) {
805 qDebug("No mails to send"); 819 qDebug("No mails to send");
806 return false; 820 return false;
807 } 821 }
808 822
809 oldPw = smtp->getPassword(); 823 oldPw = m_SmtpAccount->getPassword();
810 oldUser = smtp->getUser(); 824 oldUser = m_SmtpAccount->getUser();
811 if (smtp->getLogin() && (smtp->getUser().isEmpty() || smtp->getPassword().isEmpty()) ) { 825 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
812 // get'em 826 // get'em
813 QString user,pass; 827 QString user,pass;
814 LoginDialog login( smtp->getUser(), smtp->getPassword(), NULL, 0, true ); 828 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
815 login.show(); 829 login.show();
816 if ( QDialog::Accepted == login.exec() ) { 830 if ( QDialog::Accepted == login.exec() ) {
817 // ok 831 // ok
818 user = login.getUser().latin1(); 832 user = login.getUser().latin1();
819 pass = login.getPassword().latin1(); 833 pass = login.getPassword().latin1();
820 reset_user_value = true; 834 reset_user_value = true;
821 smtp->setUser(user); 835 m_SmtpAccount->setUser(user);
822 smtp->setPassword(pass); 836 m_SmtpAccount->setPassword(pass);
823 } else { 837 } else {
824 return true; 838 return true;
825 } 839 }
826 } 840 }
@@ -831,9 +845,9 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) {
831 sendProgress->show(); 845 sendProgress->show();
832 sendProgress->setMaxMails(mailsToSend.count()); 846 sendProgress->setMaxMails(mailsToSend.count());
833 847
834 while (mailsToSend.count()>0) { 848 while (mailsToSend.count()>0) {
835 if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { 849 if (sendQueuedMail(wrap,mailsToSend.at(0))==0) {
836 QMessageBox::critical(0,tr("Error sending mail"), 850 QMessageBox::critical(0,tr("Error sending mail"),
837 tr("Error sending queued mail - breaking")); 851 tr("Error sending queued mail - breaking"));
838 returnValue = false; 852 returnValue = false;
839 break; 853 break;
@@ -842,10 +856,10 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) {
842 mailsToSend.removeFirst(); 856 mailsToSend.removeFirst();
843 sendProgress->setCurrentMails(mailsToRemove.count()); 857 sendProgress->setCurrentMails(mailsToRemove.count());
844 } 858 }
845 if (reset_user_value) { 859 if (reset_user_value) {
846 smtp->setUser(oldUser); 860 m_SmtpAccount->setUser(oldUser);
847 smtp->setPassword(oldPw); 861 m_SmtpAccount->setPassword(oldPw);
848 } 862 }
849 Config cfg( "mail" ); 863 Config cfg( "mail" );
850 cfg.setGroup( "Status" ); 864 cfg.setGroup( "Status" );
851 m_queuedMail = 0; 865 m_queuedMail = 0;
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 75e4891..7f6aac1 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -1,4 +1,5 @@
1// -*- Mode: C++; -*-
1#ifndef SMTPwrapper_H 2#ifndef SMTPwrapper_H
2#define SMTPwrapper_H 3#define SMTPwrapper_H
3 4
4#include <qpe/applnk.h> 5#include <qpe/applnk.h>
@@ -19,34 +20,42 @@ struct mailimf_mailbox;
19struct mailmime; 20struct mailmime;
20struct mailimf_address_list; 21struct mailimf_address_list;
21class progressMailSend; 22class progressMailSend;
22struct mailsmtp; 23struct mailsmtp;
24class SMTPaccount;
23 25
24class SMTPwrapper : public QObject 26class SMTPwrapper : public QObject
25{ 27{
26 Q_OBJECT 28 Q_OBJECT
27 29
28public: 30public:
29 SMTPwrapper( Settings *s ); 31 SMTPwrapper(SMTPaccount * aSmtp);
30 virtual ~SMTPwrapper(){} 32 virtual ~SMTPwrapper();
31 void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); 33 void sendMail(const Mail& mail,bool later=false );
32 bool flushOutbox(SMTPaccount*smtp); 34 bool flushOutbox();
33 35
34 static progressMailSend*sendProgress; 36 static progressMailSend*sendProgress;
35 37
36signals: 38signals:
37 void queuedMails( int ); 39 void queuedMails( int );
38 40
39protected: 41protected:
42 mailsmtp *m_smtp;
43 SMTPaccount * m_SmtpAccount;
44
45 void connect_server();
46 void disc_server();
47 int start_smtp_tls();
48
40 mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); 49 mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
41 mailimf_fields *createImfFields(const Mail &mail ); 50 mailimf_fields *createImfFields(const Mail &mail );
42 mailmime *createMimeMail(const Mail&mail ); 51 mailmime *createMimeMail(const Mail&mail );
43 52
44 mailimf_address_list *parseAddresses(const QString&addr ); 53 mailimf_address_list *parseAddresses(const QString&addr );
45 void addFileParts( mailmime *message,const QList<Attachment>&files ); 54 void addFileParts( mailmime *message,const QList<Attachment>&files );
46 mailmime *buildTxtPart(const QString&str ); 55 mailmime *buildTxtPart(const QString&str );
47 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 56 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
48 void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); 57 void smtpSend( mailmime *mail,bool later);
49 clist *createRcptList( mailimf_fields *fields ); 58 clist *createRcptList( mailimf_fields *fields );
50 59
51 static void storeMail(const char*mail, size_t length, const QString&box); 60 static void storeMail(const char*mail, size_t length, const QString&box);
52 static QString mailsmtpError( int err ); 61 static QString mailsmtpError( int err );
@@ -54,23 +63,21 @@ protected:
54 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 63 static void addRcpts( clist *list, mailimf_address_list *addr_list );
55 static char *getFrom( mailmime *mail ); 64 static char *getFrom( mailmime *mail );
56 static char *getFrom( mailimf_field *ffrom); 65 static char *getFrom( mailimf_field *ffrom);
57 static mailimf_field *getField( mailimf_fields *fields, int type ); 66 static mailimf_field *getField( mailimf_fields *fields, int type );
58 static int start_smtp_tls(mailsmtp *session);
59 67
60 int smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ); 68 int smtpSend(char*from,clist*rcpts,const char*data,size_t size);
61 69
62 void storeMail(mailmime*mail, const QString&box); 70 void storeMail(mailmime*mail, const QString&box);
63 Settings *settings;
64 71
65 int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); 72 int sendQueuedMail(AbstractMail*wrap,RecMail*which);
66 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); 73 void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);
67 74
68 int m_queuedMail; 75 int m_queuedMail;
69 static const char* USER_AGENT; 76 static const char* USER_AGENT;
70 77
71protected slots: 78protected slots:
72 void emitQCop( int queued ); 79 void emitQCop( int queued );
73 80
74}; 81};
75 82
76#endif 83#endif
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index ea0019d..0795436 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -93,12 +93,13 @@ void OpieMail::slotSendQueued()
93 smtp = selsmtp.selected_smtp(); 93 smtp = selsmtp.selected_smtp();
94 } 94 }
95 } 95 }
96 if (smtp) { 96 if (smtp) {
97 SMTPwrapper * wrap = new SMTPwrapper(settings); 97 SMTPwrapper * wrap = new SMTPwrapper(smtp);
98 if ( wrap->flushOutbox(smtp) ) { 98 if ( wrap->flushOutbox() ) {
99 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 99 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
100 } 100 }
101 delete wrap;
101 } 102 }
102} 103}
103 104
104void OpieMail::slotSearchMails() 105void OpieMail::slotSearchMails()