2017-06-26 17:38:16 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-06-26 17:38:16 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-06-26 17:38:16 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace MTP {
|
|
|
|
|
|
|
|
class SpecialConfigRequest : public QObject {
|
|
|
|
public:
|
|
|
|
SpecialConfigRequest(base::lambda<void(DcId dcId, const std::string &ip, int port)> callback);
|
|
|
|
|
|
|
|
~SpecialConfigRequest();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void performAppRequest();
|
|
|
|
void performDnsRequest();
|
|
|
|
void appFinished();
|
|
|
|
void dnsFinished();
|
|
|
|
void handleResponse(const QByteArray &bytes);
|
|
|
|
bool decryptSimpleConfig(const QByteArray &bytes);
|
|
|
|
|
|
|
|
base::lambda<void(DcId dcId, const std::string &ip, int port)> _callback;
|
|
|
|
MTPhelp_ConfigSimple _simpleConfig;
|
|
|
|
|
|
|
|
QNetworkAccessManager _manager;
|
|
|
|
std::unique_ptr<QNetworkReply> _appReply;
|
|
|
|
std::unique_ptr<QNetworkReply> _dnsReply;
|
|
|
|
|
|
|
|
std::unique_ptr<DcOptions> _localOptions;
|
|
|
|
std::unique_ptr<Instance> _localInstance;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace MTP
|