tdlib update to 1.6.0

This commit is contained in:
infactum 2020-07-25 13:46:31 +03:00 committed by Infactum
parent f4495ede1b
commit b5784d54f9
12 changed files with 121 additions and 83 deletions

View File

@ -7,7 +7,7 @@ add_subdirectory(libtgvoip)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(Td 1.2.0 REQUIRED) find_package(Td 1.6.0 REQUIRED)
find_package(spdlog 0.17 REQUIRED) find_package(spdlog 0.17 REQUIRED)
pkg_check_modules(PJSIP libpjproject>=2.8 REQUIRED) pkg_check_modules(PJSIP libpjproject>=2.8 REQUIRED)
pkg_check_modules(OPUS opus REQUIRED) pkg_check_modules(OPUS opus REQUIRED)

View File

@ -8,21 +8,21 @@ RUN apt-get update \
zlib1g-dev gperf ccache \ zlib1g-dev gperf ccache \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \ RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \
&& sh cmake-3.9.6-Linux-x86_64.sh --prefix=/usr --exclude-subdir && sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir
COPY tdlib_header.patch / COPY tdlib_header.patch /
COPY tdlib_threadname.patch / COPY tdlib_threadname.patch /
RUN git clone https://github.com/tdlib/td.git \ RUN git clone https://github.com/tdlib/td.git \
&& cd td \ && cd td \
&& git reset --hard v1.2.0 \ && git reset --hard v1.6.0 \
&& git apply /tdlib_header.patch \ && git apply /tdlib_header.patch \
&& git apply /tdlib_threadname.patch \ && git apply /tdlib_threadname.patch \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \ && cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf td && rm -rf td
@ -33,7 +33,7 @@ RUN git clone https://github.com/pjsip/pjproject.git \
&& git reset --hard 2.9 \ && git reset --hard 2.9 \
&& cp /config_site.h pjlib/include/pj \ && cp /config_site.h pjlib/include/pj \
&& ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \ && ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \
&& make dep && make && make install \ && make dep && make -j $(grep -c ^processor /proc/cpuinfo) && make install \
&& cd / \ && cd / \
&& rm -rf pjproject && rm -rf pjproject
@ -43,6 +43,6 @@ RUN git clone -n https://github.com/gabime/spdlog.git \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \ && cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf spdlog && rm -rf spdlog

View File

@ -7,7 +7,7 @@ RUN yum -y install centos-release-scl yum-utils \
RUN set -xe \ RUN set -xe \
&& yum install -y \ && yum install -y \
make \ make patch \
git wget \ git wget \
zlib-devel openssl-devel gperf \ zlib-devel openssl-devel gperf \
pkgconfig ccache gperf unzip \ pkgconfig ccache gperf unzip \
@ -15,8 +15,27 @@ RUN set -xe \
epel-release \ epel-release \
&& yum install -y opus-devel patchelf && yum install -y opus-devel patchelf
RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \ RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \
&& sh cmake-3.9.6-Linux-x86_64.sh --prefix=/usr --exclude-subdir && sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir
COPY glibc_gcc.patch /
RUN source /opt/rh/devtoolset-7/enable \
&& wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz \
&& tar zxf glibc-2.14.tar.gz \
&& rm glibc-2.14.tar.gz \
&& cd glibc-2.14 \
&& patch < /glibc_gcc.patch \
&& gcc --version \
&& mkdir build \
&& cd build \
&& ../configure --prefix=/opt/glibc-2.14 \
&& make -j $(grep -c ^processor /proc/cpuinfo) \
&& make install \
&& cd / \
&& rm -rf glibc-2.14 \
ENV LD_LIBRARY_PATH="/opt/glibc-2.14/lib:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
COPY tdlib_header.patch / COPY tdlib_header.patch /
COPY tdlib_threadname.patch / COPY tdlib_threadname.patch /
@ -24,13 +43,14 @@ COPY tdlib_threadname.patch /
RUN source /opt/rh/devtoolset-7/enable \ RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/tdlib/td.git \ && git clone https://github.com/tdlib/td.git \
&& cd td \ && cd td \
&& git reset --hard v1.2.0 \ && git reset --hard v1.6.0 \
&& git apply /tdlib_header.patch \ && git apply /tdlib_header.patch \
&& git apply /tdlib_threadname.patch \ && git apply /tdlib_threadname.patch \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& export CPLUS_INCLUDE_PATH="/opt/glibc-2.14/include" \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \ && cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf td && rm -rf td
@ -42,7 +62,7 @@ RUN source /opt/rh/devtoolset-7/enable \
&& git reset --hard 2.9 \ && git reset --hard 2.9 \
&& cp /config_site.h pjlib/include/pj \ && cp /config_site.h pjlib/include/pj \
&& ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \ && ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \
&& make dep && make && make install \ && make dep && make -j $(grep -c ^processor /proc/cpuinfo) && make install \
&& cd / \ && cd / \
&& rm -rf pjproject && rm -rf pjproject
@ -53,7 +73,7 @@ RUN source /opt/rh/devtoolset-7/enable \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \ && cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf spdlog && rm -rf spdlog
@ -64,7 +84,7 @@ RUN source /opt/rh/devtoolset-7/enable \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIMG=0 .. \ && export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIMG=0 .. \
&& cmake --build . \ && cmake --build . -j $(grep -c ^processor /proc/cpuinfo) \
&& cp bin/linuxdeploy /usr/local/bin \ && cp bin/linuxdeploy /usr/local/bin \
&& cd / \ && cd / \
&& rm -rf linuxdeploy && rm -rf linuxdeploy

View File

@ -11,8 +11,8 @@ RUN yum install -y \
zlib-devel opus-devel openssl-devel gperf \ zlib-devel opus-devel openssl-devel gperf \
pkgconfig ccache gperf unzip pkgconfig ccache gperf unzip
RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \ RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \
&& sh cmake-3.9.6-Linux-x86_64.sh --prefix=/usr --exclude-subdir && sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir
COPY tdlib_header.patch / COPY tdlib_header.patch /
COPY tdlib_threadname.patch / COPY tdlib_threadname.patch /
@ -20,13 +20,13 @@ COPY tdlib_threadname.patch /
RUN source /opt/rh/devtoolset-7/enable \ RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/tdlib/td.git \ && git clone https://github.com/tdlib/td.git \
&& cd td \ && cd td \
&& git reset --hard v1.2.0 \ && git reset --hard v1.6.0 \
&& git apply /tdlib_header.patch \ && git apply /tdlib_header.patch \
&& git apply /tdlib_threadname.patch \ && git apply /tdlib_threadname.patch \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \ && cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf td && rm -rf td
@ -38,7 +38,7 @@ RUN source /opt/rh/devtoolset-7/enable \
&& git reset --hard 2.9 \ && git reset --hard 2.9 \
&& cp /config_site.h pjlib/include/pj \ && cp /config_site.h pjlib/include/pj \
&& ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \ && ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \
&& make dep && make && make install \ && make dep && make -j $(grep -c ^processor /proc/cpuinfo) && make install \
&& cd / \ && cd / \
&& rm -rf pjproject && rm -rf pjproject
@ -49,7 +49,7 @@ RUN source /opt/rh/devtoolset-7/enable \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \ && cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \
&& cmake --build . --target install \ && cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \ && cd / \
&& rm -rf spdlog && rm -rf spdlog

17
buildenv/glibc_gcc.patch Normal file
View File

@ -0,0 +1,17 @@
diff --git a/configure b/configure
index 6cf85e5..2613fc4 100755
--- a/configure
+++ b/configure
@@ -4938,10 +4938,10 @@ else
$as_echo_n "checking version of $CC... " >&6; }
ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=no;;
3.4* | 4.[0-9]* )
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=no;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e
DOCKER_IMAGE=infactum/tg2sip-builder DOCKER_IMAGE=infactum/tg2sip-builder
for DOCKER_TAG in bionic centos6 centos7 for DOCKER_TAG in bionic centos6 centos7

View File

@ -1,19 +1,19 @@
diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp
index a150e6c..cd66d91 100644 index eafec324..3cce46f5 100644
--- a/td/telegram/Td.cpp --- a/td/telegram/Td.cpp
+++ b/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp
@@ -4827,10 +4827,10 @@ Status Td::set_parameters(td_api::object_ptr<td_api::tdlibParameters> parameters @@ -4899,10 +4899,10 @@ Status Td::set_parameters(td_api::object_ptr<td_api::tdlibParameters> parameters
if (options.application_version.empty()) { if (options_.application_version.empty()) {
return Status::Error(400, "Application version must be non-empty"); return Status::Error(400, "Application version must be non-empty");
} }
- if (options.api_id != 21724) { - if (options_.api_id != 21724) {
- options.application_version += ", TDLib "; - options_.application_version += ", TDLib ";
- options.application_version += TDLIB_VERSION; - options_.application_version += TDLIB_VERSION;
- } - }
+ // if (options.api_id != 21724) { + // if (options_.api_id != 21724) {
+ // options.application_version += ", TDLib "; + // options_.application_version += ", TDLib ";
+ // options.application_version += TDLIB_VERSION; + // options_.application_version += TDLIB_VERSION;
+ // } + // }
G()->set_mtproto_header(std::make_unique<MtprotoHeader>(options)); options_.language_pack = "";
options_.language_code = "";
state_ = State::Decrypt; options_.parameters = "";

View File

@ -1,8 +1,8 @@
diff --git a/tdutils/td/utils/port/detail/ThreadStl.h b/tdutils/td/utils/port/detail/ThreadStl.h diff --git a/tdutils/td/utils/port/detail/ThreadStl.h b/tdutils/td/utils/port/detail/ThreadStl.h
index 64bf321..68d3bf6 100644 index ef6ff475..c0e18ee4 100644
--- a/tdutils/td/utils/port/detail/ThreadStl.h --- a/tdutils/td/utils/port/detail/ThreadStl.h
+++ b/tdutils/td/utils/port/detail/ThreadStl.h +++ b/tdutils/td/utils/port/detail/ThreadStl.h
@@ -37,6 +37,7 @@ class ThreadStl { @@ -41,6 +41,7 @@ class ThreadStl {
invoke_tuple(std::move(args)); invoke_tuple(std::move(args));
clear_thread_locals(); clear_thread_locals();
}); });

View File

@ -57,12 +57,9 @@ namespace state_machine::guards {
// the event type 16 (flash) as stated in RFC 4730. // the event type 16 (flash) as stated in RFC 4730.
// PJSUA maximum number of characters are 32. // PJSUA maximum number of characters are 32.
auto content = td_api::move_object_as<td_api::messageText>(event->message_->content_); auto text = static_cast<const td_api::messageText &>(*event->message_->content_).text_->text_;
const std::regex dtmf_regex("^[0-9A-D*#]{1,32}$"); const std::regex dtmf_regex("^[0-9A-D*#]{1,32}$");
auto result = regex_match(content->text_->text_, dtmf_regex); auto result = regex_match(text, dtmf_regex);
// Don't forget to put data back!
event->message_->content_ = td_api::move_object_as<td_api::MessageContent>(content);
return result; return result;
} }
@ -312,7 +309,7 @@ namespace state_machine::actions {
using namespace tgvoip; using namespace tgvoip;
auto state = td_api::move_object_as<td_api::callStateReady>(event->call_->state_); const auto &state = static_cast<const td_api::callStateReady &>(*event->call_->state_);
auto voip_controller = std::make_shared<VoIPController>(); auto voip_controller = std::make_shared<VoIPController>();
static auto config = VoIPController::Config( static auto config = VoIPController::Config(
@ -336,11 +333,11 @@ namespace state_machine::actions {
} }
char encryption_key[256]; char encryption_key[256];
memcpy(encryption_key, state->encryption_key_.c_str(), 256); memcpy(encryption_key, state.encryption_key_.c_str(), 256);
voip_controller->SetEncryptionKey(encryption_key, event->call_->is_outgoing_); voip_controller->SetEncryptionKey(encryption_key, event->call_->is_outgoing_);
vector<Endpoint> endpoints; vector<Endpoint> endpoints;
for (auto &connection : state->connections_) { for (const auto &connection : state.connections_) {
unsigned char peer_tag[16]; unsigned char peer_tag[16];
memcpy(peer_tag, connection->peer_tag_.c_str(), 16); memcpy(peer_tag, connection->peer_tag_.c_str(), 16);
auto ipv4 = IPv4Address(connection->ip_); auto ipv4 = IPv4Address(connection->ip_);
@ -566,10 +563,10 @@ namespace state_machine::actions {
const td_api::object_ptr<td::td_api::updateNewMessage> &event, const td_api::object_ptr<td::td_api::updateNewMessage> &event,
std::shared_ptr<spdlog::logger> logger) const { std::shared_ptr<spdlog::logger> logger) const {
auto content = td_api::move_object_as<td_api::messageText>(event->message_->content_); auto text = static_cast<const td_api::messageText &>(*event->message_->content_).text_->text_;
DEBUG(logger, "[{}] sending DTMF {}", ctx.id(), content->text_->text_); DEBUG(logger, "[{}] sending DTMF {}", ctx.id(), text);
try { try {
sip_client.DialDtmf(ctx.sip_call_id, content->text_->text_); sip_client.DialDtmf(ctx.sip_call_id, text);
} catch (const pj::Error &error) { } catch (const pj::Error &error) {
logger->error(error.reason); logger->error(error.reason);
} }

View File

@ -152,21 +152,22 @@ private:
sequence_done = true; sequence_done = true;
std::cerr << "Terminated" << std::endl; std::cerr << "Terminated" << std::endl;
}, },
[this](td_api::authorizationStateWaitCode &wait_code) { [this](td_api::authorizationStateWaitCode &) {
std::string first_name; std::cout << "Enter authentication code: " << std::flush;
std::string last_name;
if (!wait_code.is_registered_) {
std::cerr << "Enter your first name: ";
std::cin >> first_name;
std::cerr << "Enter your last name: ";
std::cin >> last_name;
}
std::cerr << "Enter authentication code: ";
std::string code; std::string code;
std::cin >> code; std::cin >> code;
send_query( send_query(td_api::make_object<td_api::checkAuthenticationCode>(code),
td_api::make_object<td_api::checkAuthenticationCode>(code, first_name, last_name), create_authentication_query_handler());
create_authentication_query_handler()); },
[this](td_api::authorizationStateWaitRegistration &) {
std::string first_name;
std::string last_name;
std::cout << "Enter your first name: " << std::flush;
std::cin >> first_name;
std::cout << "Enter your last name: " << std::flush;
std::cin >> last_name;
send_query(td_api::make_object<td_api::registerUser>(first_name, last_name),
create_authentication_query_handler());
}, },
[this](td_api::authorizationStateWaitPassword &) { [this](td_api::authorizationStateWaitPassword &) {
std::cerr << "Enter authentication password: "; std::cerr << "Enter authentication password: ";
@ -175,34 +176,35 @@ private:
send_query(td_api::make_object<td_api::checkAuthenticationPassword>(password), send_query(td_api::make_object<td_api::checkAuthenticationPassword>(password),
create_authentication_query_handler()); create_authentication_query_handler());
}, },
[this](td_api::authorizationStateWaitOtherDeviceConfirmation &state) {
std::cout << "Confirm this login link on another device: " << state.link_ << std::endl;
},
[this](td_api::authorizationStateWaitPhoneNumber &) { [this](td_api::authorizationStateWaitPhoneNumber &) {
std::cerr << "Enter phone number: "; std::cout << "Enter phone number: " << std::flush;
std::string phone_number; std::string phone_number;
std::cin >> phone_number; std::cin >> phone_number;
send_query(td_api::make_object<td_api::setAuthenticationPhoneNumber>( send_query(td_api::make_object<td_api::setAuthenticationPhoneNumber>(phone_number, nullptr),
phone_number, false /*allow_flash_calls*/, false /*is_current_phone_number*/),
create_authentication_query_handler()); create_authentication_query_handler());
}, },
[this](td_api::authorizationStateWaitEncryptionKey &) { [this](td_api::authorizationStateWaitEncryptionKey &) {
send_query(td_api::make_object<td_api::checkDatabaseEncryptionKey>(""), send_query(td_api::make_object<td_api::checkDatabaseEncryptionKey>(""),
create_authentication_query_handler()); create_authentication_query_handler());
td_api::object_ptr<td_api::Proxy> proxy;
if (settings.proxy_enabled()) { if (settings.proxy_enabled()) {
auto socks_proxy = td_api::make_object<td_api::proxySocks5>( auto socks_proxy_type = td_api::make_object<td_api::proxyTypeSocks5>(
settings.proxy_address(),
settings.proxy_port(),
settings.proxy_username(), settings.proxy_username(),
settings.proxy_password() settings.proxy_password()
); );
proxy = td_api::move_object_as<td_api::Proxy>(socks_proxy); send_query(td_api::make_object<td_api::addProxy>(
settings.proxy_address(),
settings.proxy_port(),
true,
td_api::move_object_as<td_api::ProxyType>(socks_proxy_type)),
[](Object) {});
} else { } else {
auto empty_proxy = td_api::make_object<td_api::proxyEmpty>(); send_query(td_api::make_object<td_api::disableProxy>(), [](Object) {});
proxy = td_api::move_object_as<td_api::Proxy>(empty_proxy);
} }
send_query(td_api::make_object<td_api::setProxy>(
td_api::move_object_as<td_api::Proxy>(proxy)),
[](Object) {});
}, },
[this](td_api::authorizationStateWaitTdlibParameters &) { [this](td_api::authorizationStateWaitTdlibParameters &) {
auto lib_parameters = td_api::make_object<td_api::tdlibParameters>(); auto lib_parameters = td_api::make_object<td_api::tdlibParameters>();

View File

@ -21,7 +21,7 @@
using namespace tg; using namespace tg;
Client::Client(Settings &settings, std::shared_ptr<spdlog::logger> logger_, Client::Client(Settings &settings, std::shared_ptr<spdlog::logger> logger_,
OptionalQueue<Object> &events_) OptionalQueue<Object> &events_)
: logger(std::move(logger_)), events(events_) { : logger(std::move(logger_)), events(events_) {
client = std::make_unique<td::Client>(); client = std::make_unique<td::Client>();
@ -60,16 +60,17 @@ void Client::init_lib_parameters(Settings &settings) {
void Client::init_proxy(Settings &settings) { void Client::init_proxy(Settings &settings) {
if (settings.proxy_enabled()) { if (settings.proxy_enabled()) {
auto socks_proxy = td_api::make_object<td_api::proxySocks5>( auto socks_proxy_type = td_api::make_object<td_api::proxyTypeSocks5>(
settings.proxy_address(),
settings.proxy_port(),
settings.proxy_username(), settings.proxy_username(),
settings.proxy_password() settings.proxy_password()
); );
proxy = td_api::move_object_as<td_api::Proxy>(socks_proxy); set_proxy = td_api::make_object<td_api::addProxy>(
settings.proxy_address(),
settings.proxy_port(),
true,
td_api::move_object_as<td_api::ProxyType>(socks_proxy_type));
} else { } else {
auto empty_proxy = td_api::make_object<td_api::proxyEmpty>(); set_proxy = td_api::make_object<td_api::disableProxy>();
proxy = td_api::move_object_as<td_api::Proxy>(empty_proxy);
} }
} }
@ -186,8 +187,7 @@ void Client::on_authorization_state_update(td_api::object_ptr<td_api::Authorizat
case td_api::authorizationStateWaitEncryptionKey::ID: case td_api::authorizationStateWaitEncryptionKey::ID:
send_query(td_api::make_object<td_api::checkDatabaseEncryptionKey>(), send_query(td_api::make_object<td_api::checkDatabaseEncryptionKey>(),
create_authentication_query_handler()); create_authentication_query_handler());
send_query(td_api::make_object<td_api::setProxy>(td_api::move_object_as<td_api::Proxy>(proxy)), send_query(std::move(set_proxy), create_authentication_query_handler());
create_authentication_query_handler());
break; break;
case td_api::authorizationStateWaitTdlibParameters::ID: { case td_api::authorizationStateWaitTdlibParameters::ID: {
send_query(td_api::make_object<td_api::setTdlibParameters>( send_query(td_api::make_object<td_api::setTdlibParameters>(

View File

@ -57,8 +57,8 @@ namespace tg {
const double WAIT_TIMEOUT = 10; const double WAIT_TIMEOUT = 10;
std::unique_ptr<td::Client> client; std::unique_ptr<td::Client> client;
std::unique_ptr<td_api::tdlibParameters> lib_parameters; td::tl::unique_ptr<td_api::tdlibParameters> lib_parameters;
td_api::object_ptr<td_api::Proxy> proxy; td_api::object_ptr<td_api::Function> set_proxy;
std::thread thread_; std::thread thread_;