summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/proto.cpp2
-rw-r--r--protocols/Telegram/src/server.cpp17
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));
}