diff options
author | Eric Springer <eric.springer@nokia.com> | 2011-07-04 09:39:57 +1000 |
---|---|---|
committer | Eric Springer <eric.springer@nokia.com> | 2011-07-04 09:39:57 +1000 |
commit | 7207440b6015674297c49797c2f4ec6bca154f49 (patch) | |
tree | 8b2430d5dc29a1bcaa5bb8befe7e5e3f79c056b1 | |
parent | 4ae2f569f03901f4465eb169a39dba05f5f9d4d9 (diff) | |
parent | 584fc9ae45da46a7d84611c61ff14c43377f4e32 (diff) |
Conflicts:
CHANGES
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | src/plugins/messageservices/smtp/smtpclient.cpp | 18 | ||||
-rw-r--r-- | src/plugins/messageservices/smtp/smtpclient.h | 3 |
3 files changed, 22 insertions, 0 deletions
@@ -3,6 +3,7 @@ Latest Changes 201126 * Fixes: NB#267169 "can't get your message" error shown when going back + * Fixes: NB#195729 ConfigurationError not shown when account is configured with wrong settings 201125 * Fixes: NB#215942 Traditional Chinese character is corrupted in mailbox 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 |