diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-30 18:38:25 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-30 18:38:25 +0300 |
commit | 22f9f9460967114c70a6c3a516ea8b24c7d42bd7 (patch) | |
tree | 0a84d56e4d33c6a30e1cd969ede40d3e4c859c39 /protocols | |
parent | b0eec8dbfd0b5fe70102e4b61a97a1e01057d4e1 (diff) |
fixes #3992 (Telegram: отсутствует возможность указать прокси)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 9222617a7a..08f7f102ad 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -84,7 +84,7 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : // create standard network connection NETLIBUSER nlu = {}; - nlu.flags = NUF_UNICODE; + nlu.flags = NUF_OUTGOING | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; nlu.szDescriptiveName.w = m_tszUserName; m_hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index d9dde02216..181631f4cc 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -32,6 +32,23 @@ void __cdecl CTelegramProto::ServerThread(void *) SendQuery(new TD::getOption("version"));
+ NETLIBUSERSETTINGS nluSettings;
+ Netlib_GetUserSettings(m_hNetlibUser, &nluSettings);
+ if (nluSettings.useProxy) {
+ TD::object_ptr<TD::ProxyType> proxyType;
+ switch (nluSettings.proxyType) {
+ case PROXYTYPE_SOCKS4:
+ case PROXYTYPE_SOCKS5:
+ proxyType = TD::make_object<TD::proxyTypeSocks5>();
+ break;
+ case PROXYTYPE_HTTP:
+ case PROXYTYPE_HTTPS:
+ proxyType = TD::make_object<TD::proxyTypeHttp>();
+ break;
+ }
+ SendQuery(new TD::addProxy(nluSettings.szProxyServer, nluSettings.wProxyPort, true, std::move(proxyType)));
+ }
+
while (!m_bTerminated) {
ProcessResponse(m_pClientManager->receive(1));
}
|