2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Ability to delete authorization keys added.

If we start logging in and we know, that some of the authorization
keys were read from the hard drive, not generated, we destroy all
the existing authorization keys and start generating new keys.
This commit is contained in:
John Preston
2017-02-25 19:44:02 +03:00
parent dd933cf61c
commit 7d89b54d1c
38 changed files with 714 additions and 432 deletions

View File

@@ -119,7 +119,7 @@ void AutoConnection::sendData(mtpBuffer &buffer) {
if (buffer.size() < 3) {
LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime)));
TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str()));
emit error();
emit error(kErrorCodeOther);
return;
}
@@ -204,7 +204,7 @@ void AutoConnection::requestFinished(QNetworkReply *reply) {
if (status == WaitingBoth) {
status = WaitingTcp;
} else {
emit error();
emit error(data[0]);
}
} else if (!data.isEmpty()) {
if (status == UsingHttp) {
@@ -230,7 +230,7 @@ void AutoConnection::requestFinished(QNetworkReply *reply) {
if (status == WaitingBoth) {
status = WaitingTcp;
} else {
emit error();
emit error(kErrorCodeOther);
}
}
} else if (status == UsingTcp) {
@@ -242,11 +242,10 @@ void AutoConnection::requestFinished(QNetworkReply *reply) {
return;
}
bool mayBeBadKey = HTTPConnection::handleError(reply) && _sentEncrypted;
if (status == WaitingBoth) {
status = WaitingTcp;
} else if (status == WaitingHttp || status == UsingHttp) {
emit error(mayBeBadKey);
emit error(HTTPConnection::handleError(reply));
} else {
LOG(("Strange Http Error: status %1").arg(status));
}
@@ -267,8 +266,7 @@ void AutoConnection::socketPacket(const char *packet, uint32 length) {
sock.disconnectFromHost();
emit connected();
} else if (status == WaitingTcp || status == UsingTcp) {
bool mayBeBadKey = (data[0] == -410) && _sentEncrypted;
emit error(mayBeBadKey);
emit error(data[0]);
} else {
LOG(("Strange Tcp Error; status %1").arg(status));
}
@@ -296,7 +294,7 @@ void AutoConnection::socketPacket(const char *packet, uint32 length) {
sock.disconnectFromHost();
emit connected();
} else {
emit error();
emit error(kErrorCodeOther);
}
}
}
@@ -335,7 +333,7 @@ void AutoConnection::socketError(QAbstractSocket::SocketError e) {
status = UsingHttp;
emit connected();
} else if (status == WaitingTcp || status == UsingTcp) {
emit error();
emit error(kErrorCodeOther);
} else {
LOG(("Strange Tcp Error: status %1").arg(status));
}