From 1166a4797a91cedd5002a3513d5028c5e86016f0 Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 11 Mar 2005 19:26:02 +0000 Subject: better kopi export --- (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') 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 @@ -244,7 +244,7 @@ void SMTPwrapper::connect_server() 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) { @@ -252,6 +252,8 @@ void SMTPwrapper::connect_server() qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); + if ( err != MAILSMTP_NO_ERROR ) + result = 0; } } //qDebug("mailesmtp_ehlo %d ",err ); @@ -290,6 +292,10 @@ void SMTPwrapper::connect_server() } } } + if ( result == 0 ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } void SMTPwrapper::disc_server() @@ -346,7 +352,11 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer&mail,bool later sendProgress->hide(); delete sendProgress; sendProgress = 0; - mailmime_free( mimeMail ); + mailmime_free( mimeMail ); + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } return result; } @@ -458,6 +468,7 @@ bool SMTPwrapper::flushOutbox() { m_SmtpAccount->setUser(oldUser); m_SmtpAccount->setPassword(oldPw); } + KConfig cfg( locateLocal("config", "kopiemailrc" ) ); cfg.setGroup( "Status" ); m_queuedMail = mailsToSend.count(); @@ -467,6 +478,10 @@ bool SMTPwrapper::flushOutbox() { delete sendProgress; sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); - delete wrap; + delete wrap; + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } return returnValue; } -- cgit v0.9.0.2