2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Abstract out tcp socket from tcp connection.

This commit is contained in:
John Preston
2019-07-05 09:54:53 +02:00
parent ffba901620
commit 3cda267787
13 changed files with 306 additions and 100 deletions

View File

@@ -305,11 +305,12 @@ bool ProxyData::operator!=(const ProxyData &other) const {
}
bool ProxyData::ValidMtprotoPassword(const QString &secret) {
using Expression = QRegularExpression;
if (secret.size() == 32) {
static const auto check = QRegularExpression("^[a-fA-F0-9]{32}$");
static const auto check = Expression("^[a-fA-F0-9]{32}$");
return check.match(secret).hasMatch();
} else if (secret.size() == 34) {
static const auto check = QRegularExpression("^dd[a-fA-F0-9]{32}$");
static const auto check = Expression("^(dd|ee)[a-fA-F0-9]{32}$");
return check.match(secret).hasMatch();
}
return false;