FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tdesktop/Telegram/SourceFiles/mtproto/config_loader.h at dev · feiyunwill/tdesktop · GitHub
feiyunwill
/
tdesktop
Public
forked from
telegramdesktop/tdesktop
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tdesktop
/
Telegram
/
SourceFiles
/
mtproto
/
config_loader.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
84 lines (69 loc) · 2.05 KB
Breadcrumbs
tdesktop
/
Telegram
/
SourceFiles
/
mtproto
/
config_loader.h
Copy path
File metadata and controls
84 lines (69 loc) · 2.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
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/timer.h
"
#
include
"
base/weak_ptr.h
"
#
include
"
base/bytes.h
"
#
include
"
mtproto/mtproto_response.h
"
namespace
MTP
{
class
Instance
;
namespace
details
{
class
SpecialConfigRequest
;
class
ConfigLoader
:
public
base
::has_weak_ptr {
public:
ConfigLoader
(
not_null<Instance*> instance,
const
QString &phone,
Fn<
void
(
const
MTPConfig &result)> onDone,
FailHandler onFail,
bool
proxyEnabled);
~ConfigLoader
();
void
load
();
void
setPhone
(
const
QString &phone);
void
setProxyEnabled
(
bool
value);
private:
mtpRequestId
sendRequest
(ShiftedDcId shiftedDcId);
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);
void
terminateRequest
();
void
terminateSpecialRequest
();
not_null<Instance*> _instance;
base::Timer _enumDCTimer;
DcId _enumCurrent =
0
;
mtpRequestId _enumRequest =
0
;
struct
SpecialEndpoint
{
DcId dcId;
std::string ip;
int
port;
bytes::vector secret;
};
friend
bool
operator
==(
const
SpecialEndpoint &a,
const
SpecialEndpoint &b);
std::unique_ptr<SpecialConfigRequest> _specialLoader;
std::vector<SpecialEndpoint> _specialEndpoints;
std::vector<SpecialEndpoint> _triedSpecialEndpoints;
base::Timer _specialEnumTimer;
DcId _specialEnumCurrent =
0
;
mtpRequestId _specialEnumRequest =
0
;
QString _phone;
bool
_proxyEnabled =
false
;
Fn<
void
(
const
MTPConfig &result)> _doneHandler;
FailHandler _failHandler;
};
inline
bool
operator
==(
const
ConfigLoader::SpecialEndpoint &a,
const
ConfigLoader::SpecialEndpoint &b) {
return
(a.
dcId
== b.
dcId
) && (a.
ip
== b.
ip
) && (a.
port
== b.
port
);
}
}
//
namespace details
}
//
namespace MTP
Back
|
FazBrowse Home
|
New Git URL