From 97498477a619d62a9204f8ca52efcd252f4d65bc Mon Sep 17 00:00:00 2001 From: APTX Date: Tue, 3 Jan 2012 02:30:02 +0100 Subject: [PATCH] Add detection incorrect API Key. --- client.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client.cpp b/client.cpp index 078db26..142255d 100644 --- a/client.cpp +++ b/client.cpp @@ -266,6 +266,8 @@ qDebug() << "Entering Disconnected State"; #endif if (socket->state() == QAbstractSocket::BoundState) socket->disconnectFromHost(); + m_salt.clear(); + usingEncryption = false; } void Client::enterConnectingState() @@ -576,7 +578,7 @@ qDebug() << QString("Recieved datagram from [%1]:%2\nRaw datagram contents:%3") // Check if it is a 6xx error. { - QRegExp rx("(?:50[34]|555|6[0-9]{2}) "); + QRegExp rx("(?:50[34]|555|598|6[0-9]{2}) "); if (rx.exactMatch(tmp.mid(0, 4))) { int replyCode = tmp.mid(0, 3).toInt(); @@ -599,6 +601,15 @@ qDebug() << QString("Recieved datagram from [%1]:%2\nRaw datagram contents:%3") m_errorString = tr("Server busy. Try again later. Wait at least 30 minutes."); emit connectionError(); goto endLoop; + case UNKNOWN_COMMAND: + if (usingEncryption) + { + m_error = EncryptionError; + m_errorString = tr("Server did not recognize encrypted command. Make sure the API Key is correct."); + emit connectionError(); + goto endLoop; + } + break; default: if (replyCode > 601 && replyCode < 700) { -- 2.52.0