-rw-r--r-- | kmicromail/editaccounts.cpp | 12 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 21 |
2 files changed, 27 insertions, 6 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 49049f6..2c0f2d8 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -346,8 +346,9 @@ void IMAPconfig::slotConnectionToggle( int index ) { if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { portLine->setText( IMAP_PORT ); @@ -355,8 +356,9 @@ void IMAPconfig::slotConnectionToggle( int index ) } else { portLine->setText( IMAP_PORT ); + CommandEdit->hide(); } } void IMAPconfig::fillValues() @@ -427,8 +429,9 @@ void POP3config::slotConnectionToggle( int index ) // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); + CommandEdit->hide(); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); @@ -436,8 +439,9 @@ void POP3config::slotConnectionToggle( int index ) } else { portLine->setText( POP3_PORT ); + CommandEdit->hide(); } } void POP3config::fillValues() @@ -519,21 +523,23 @@ void SMTPconfig::chooseSig() } } void SMTPconfig::slotConnectionToggle( int index ) { - // 2 is ssl connection - if ( index == 2 ) + // 3 is ssl connection + if ( index == 3 ) { portLine->setText( SMTP_SSL_PORT ); + CommandEdit->hide(); } - else if ( index == 3 ) + else if ( index == 4 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); } else { portLine->setText( SMTP_PORT ); + CommandEdit->hide(); } } void SMTPconfig::fillValues() diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 872a460..845c71c 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -243,16 +243,18 @@ void SMTPwrapper::connect_server() qDebug("Error init SMTP connection "); failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); } } - if (try_tls) { + if (result && try_tls) { qDebug("Smpt: Try tls "); err = start_smtp_tls(); if (err != MAILSMTP_NO_ERROR) { try_tls = false; qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); + if ( err != MAILSMTP_NO_ERROR ) + result = 0; } } //qDebug("mailesmtp_ehlo %d ",err ); if (!try_tls && force_tls) { @@ -289,8 +291,12 @@ void SMTPwrapper::connect_server() result = 0; } } } + if ( result == 0 ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } void SMTPwrapper::disc_server() { @@ -345,9 +351,13 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ; // odebug << "Clean up done" << oendl; sendProgress->hide(); delete sendProgress; sendProgress = 0; - mailmime_free( mimeMail ); + mailmime_free( mimeMail ); + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } return result; } @@ -457,8 +467,9 @@ bool SMTPwrapper::flushOutbox() { if (reset_user_value) { m_SmtpAccount->setUser(oldUser); m_SmtpAccount->setPassword(oldPw); } + KConfig cfg( locateLocal("config", "kopiemailrc" ) ); cfg.setGroup( "Status" ); m_queuedMail = mailsToSend.count(); cfg.writeEntry( "outgoing", m_queuedMail ); @@ -466,7 +477,11 @@ bool SMTPwrapper::flushOutbox() { sendProgress->hide(); delete sendProgress; sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); - delete wrap; + delete wrap; + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } return returnValue; } |