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
+13 -2
View File
@@ -21,16 +21,26 @@ namespace internal {
class ConfigLoader : public base::has_weak_ptr {
public:
ConfigLoader(not_null<Instance*> instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail);
ConfigLoader(
not_null<Instance*> instance,
const QString &phone,
RPCDoneHandlerPtr onDone,
RPCFailHandlerPtr onFail);
~ConfigLoader();
void load();
void setPhone(const QString &phone);
private:
mtpRequestId sendRequest(ShiftedDcId shiftedDcId);
void addSpecialEndpoint(DcId dcId, const std::string &ip, int port);
void addSpecialEndpoint(
DcId dcId,
const std::string &ip,
int port,
bytes::const_span secret);
void sendSpecialRequest();
void enumerate();
void refreshSpecialLoader();
void createSpecialLoader();
DcId specialToRealDcId(DcId specialDcId);
void specialConfigLoaded(const MTPConfig &result);
@@ -55,6 +65,7 @@ private:
base::Timer _specialEnumTimer;
DcId _specialEnumCurrent = 0;
mtpRequestId _specialEnumRequest = 0;
QString _phone;
RPCDoneHandlerPtr _doneHandler;
RPCFailHandlerPtr _failHandler;