summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Springer <eric.springer@nokia.com>2011-06-29 19:33:50 +1000
committerEric Springer <eric.springer@nokia.com>2011-06-29 19:33:50 +1000
commit584fc9ae45da46a7d84611c61ff14c43377f4e32 (patch)
tree1fe7898f204a036ac9a0158b691638c3b67c628f
parent8b6e91bd3239aa05f15dfb4448e1c68f39ace7a8 (diff)
Return ConfigurationError if no greeting received in 20 secondssmtpfix
-rw-r--r--CHANGES3
-rw-r--r--src/plugins/messageservices/smtp/smtpclient.cpp18
-rw-r--r--src/plugins/messageservices/smtp/smtpclient.h3
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index e12e4905..c7dceb3c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
Latest Changes
---------------
+201126
+ * Fixes: NB#195729 ConfigurationError not shown when account is configured with wrong settings
+
201125
* Fixes: NB#215942 Traditional Chinese character is corrupted in mailbox
* Fixes: NB#232541 Invitations not displayed in the message viewer for Gmail
diff --git a/src/plugins/messageservices/smtp/smtpclient.cpp b/src/plugins/messageservices/smtp/smtpclient.cpp
index 274ff64b..50d05d76 100644
--- a/src/plugins/messageservices/smtp/smtpclient.cpp
+++ b/src/plugins/messageservices/smtp/smtpclient.cpp
@@ -108,6 +108,7 @@ SmtpClient::SmtpClient(QObject* parent)
, temporaryFile(0)
, waitingForBytes(0)
, notUsingAuth(false)
+ , authTimeout(0)
{
connect(QMailStore::instance(), SIGNAL(accountsUpdated(const QMailAccountIdList&)),
this, SLOT(accountsUpdated(const QMailAccountIdList&)));
@@ -117,6 +118,7 @@ SmtpClient::~SmtpClient()
{
delete transport;
delete temporaryFile;
+ delete authTimeout;
}
void SmtpClient::accountsUpdated(const QMailAccountIdList &ids)
@@ -245,6 +247,13 @@ QMailServiceAction::Status::ErrorCode SmtpClient::addMail(const QMailMessage& ma
void SmtpClient::connected(QMailTransport::EncryptType encryptType)
{
+ authTimeout = new QTimer;
+ authTimeout->setSingleShot(true);
+ const int twentySeconds = 20 * 1000;
+ connect(authTimeout, SIGNAL(timeout()), this, SLOT(authExpired()));
+ authTimeout->setInterval(twentySeconds);
+ authTimeout->start();
+
SmtpConfiguration smtpCfg(config);
if (smtpCfg.smtpEncryption() == encryptType) {
qMailLog(SMTP) << "Connected" << flush;
@@ -332,6 +341,8 @@ void SmtpClient::incomingData()
notUsingAuth = false;
}
}
+ delete authTimeout;
+ authTimeout = 0;
if (outstandingResponses > 0) {
--outstandingResponses;
@@ -907,6 +918,13 @@ void SmtpClient::sendMoreData(qint64 bytesWritten)
//qMailLog(SMTP) << "Body: sent a" << bytes << "byte block";
}
+void SmtpClient::authExpired()
+{
+ status = Done;
+ operationFailed(QMailServiceAction::Status::ErrConfiguration, tr("Have not received any greeting from SMTP server, probably configuration error"));
+ return;
+}
+
void SmtpClient::stopTransferring()
{
if (temporaryFile)
diff --git a/src/plugins/messageservices/smtp/smtpclient.h b/src/plugins/messageservices/smtp/smtpclient.h
index c52c261a..008ed345 100644
--- a/src/plugins/messageservices/smtp/smtpclient.h
+++ b/src/plugins/messageservices/smtp/smtpclient.h
@@ -96,6 +96,7 @@ protected slots:
private slots:
void sendMoreData(qint64);
+ void authExpired();
private:
void sendCommand(const char *data, int len = -1);
@@ -146,6 +147,8 @@ private:
QString bufferedResponse;
bool notUsingAuth;
+
+ QTimer *authTimeout;
};
#endif