2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 15:05:56 +00:00

Better special config implementation.

This commit is contained in:
John Preston
2018-05-02 22:27:03 +03:00
parent 95fee543ec
commit 4bf66cb6e9
12 changed files with 200 additions and 85 deletions

View File

@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/bytes.h"
namespace MTP {
class SpecialConfigRequest : public QObject {
@@ -15,16 +17,16 @@ public:
base::lambda<void(
DcId dcId,
const std::string &ip,
int port)> callback);
int port,
bytes::const_span secret)> callback,
const QString &phone);
~SpecialConfigRequest();
private:
void performApp1Request();
void performApp2Request();
void performAppRequest();
void performDnsRequest();
void app1Finished();
void app2Finished();
void appFinished();
void dnsFinished();
void handleResponse(const QByteArray &bytes);
bool decryptSimpleConfig(const QByteArray &bytes);
@@ -32,12 +34,13 @@ private:
base::lambda<void(
DcId dcId,
const std::string &ip,
int port)> _callback;
int port,
bytes::const_span secret)> _callback;
QString _phone;
MTPhelp_ConfigSimple _simpleConfig;
QNetworkAccessManager _manager;
std::unique_ptr<QNetworkReply> _app1Reply;
std::unique_ptr<QNetworkReply> _app2Reply;
std::unique_ptr<QNetworkReply> _appReply;
std::unique_ptr<QNetworkReply> _dnsReply;
std::unique_ptr<DcOptions> _localOptions;