Update С++ example.

This commit is contained in:
levlam 2022-09-08 00:41:35 +03:00
parent d4d746f02a
commit 8d32a1e143

View File

@ -254,6 +254,29 @@ class TdExample {
need_restart_ = true;
std::cout << "Terminated" << std::endl;
},
[this](td_api::authorizationStateWaitPhoneNumber &) {
std::cout << "Enter phone number: " << std::flush;
std::string phone_number;
std::cin >> phone_number;
send_query(
td_api::make_object<td_api::setAuthenticationPhoneNumber>(phone_number, nullptr),
create_authentication_query_handler());
},
[this](td_api::authorizationStateWaitEmailAddress &) {
std::cout << "Enter email address: " << std::flush;
std::string email_address;
std::cin >> email_address;
send_query(td_api::make_object<td_api::setAuthenticationEmailAddress>(email_address),
create_authentication_query_handler());
},
[this](td_api::authorizationStateWaitEmailCode &) {
std::cout << "Enter email authentication code: " << std::flush;
std::string code;
std::cin >> code;
send_query(td_api::make_object<td_api::checkAuthenticationEmailCode>(
td_api::make_object<td_api::emailAddressAuthenticationCode>(code)),
create_authentication_query_handler());
},
[this](td_api::authorizationStateWaitCode &) {
std::cout << "Enter authentication code: " << std::flush;
std::string code;
@ -281,14 +304,6 @@ class TdExample {
[this](td_api::authorizationStateWaitOtherDeviceConfirmation &state) {
std::cout << "Confirm this login link on another device: " << state.link_ << std::endl;
},
[this](td_api::authorizationStateWaitPhoneNumber &) {
std::cout << "Enter phone number: " << std::flush;
std::string phone_number;
std::cin >> phone_number;
send_query(
td_api::make_object<td_api::setAuthenticationPhoneNumber>(phone_number, nullptr),
create_authentication_query_handler());
},
[this](td_api::authorizationStateWaitTdlibParameters &) {
auto request = td_api::make_object<td_api::setTdlibParameters>();
request->database_directory_ = "tdlib";