Bug fix (issue 2)

This commit is contained in:
Attila Tőkés 2012-09-05 19:36:52 +03:00 committed by Attila
parent 81e561c91b
commit 3d3f9136af

View File

@ -380,14 +380,16 @@ void SmtpClient::quit()
void SmtpClient::waitForResponse() throw (ResponseTimeoutException) void SmtpClient::waitForResponse() throw (ResponseTimeoutException)
{ {
do {
if (!socket->waitForReadyRead(responseTimeout)) if (!socket->waitForReadyRead(responseTimeout))
{ {
emit smtpError(ResponseTimeoutError); emit smtpError(ResponseTimeoutError);
throw ResponseTimeoutException(); throw ResponseTimeoutException();
} }
while (socket->canReadLine()) {
// Save the server's response // Save the server's response
responseText = socket->readAll(); responseText = socket->readLine();
// Extract the respose code from the server's responce (first 3 digits) // Extract the respose code from the server's responce (first 3 digits)
responseCode = responseText.left(3).toInt(); responseCode = responseText.left(3).toInt();
@ -397,6 +399,10 @@ void SmtpClient::waitForResponse() throw (ResponseTimeoutException)
if (responseCode / 100 == 5) if (responseCode / 100 == 5)
emit smtpError(ClientError); emit smtpError(ClientError);
if (responseText[3] == ' ') { return; }
}
} while (true);
} }
void SmtpClient::sendMessage(const QString &text) void SmtpClient::sendMessage(const QString &text)