/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "base/bytes.h" namespace MTP { class SpecialConfigRequest : public QObject { public: SpecialConfigRequest( base::lambda callback, const QString &phone); private: enum class Type { App, Dns, }; struct Attempt { Type type; QString domain; }; struct Request { Request(not_null reply); Request(Request &&other); Request &operator=(Request &&other); ~Request(); void destroy(); QPointer reply; }; void sendNextRequest(); void performRequest(const Attempt &attempt); void requestFinished(Type type, not_null reply); QByteArray finalizeRequest(not_null reply); void handleResponse(const QByteArray &bytes); bool decryptSimpleConfig(const QByteArray &bytes); base::lambda _callback; QString _phone; MTPhelp_ConfigSimple _simpleConfig; QNetworkAccessManager _manager; std::vector _attempts; std::vector _requests; }; } // namespace MTP