diff --git a/example/cpp/td_example.cpp b/example/cpp/td_example.cpp index c90946d5d..3f806d7b9 100644 --- a/example/cpp/td_example.cpp +++ b/example/cpp/td_example.cpp @@ -291,7 +291,7 @@ class TdExample { std::cin >> first_name; std::cout << "Enter your last name: " << std::flush; std::cin >> last_name; - send_query(td_api::make_object(first_name, last_name), + send_query(td_api::make_object(first_name, last_name, false), create_authentication_query_handler()); }, [this](td_api::authorizationStateWaitPassword &) { diff --git a/example/csharp/TdExample.cs b/example/csharp/TdExample.cs index f09f1cc6c..48a08ee0a 100644 --- a/example/csharp/TdExample.cs +++ b/example/csharp/TdExample.cs @@ -107,7 +107,7 @@ namespace TdExample { string firstName = ReadLine("Please enter your first name: "); string lastName = ReadLine("Please enter your last name: "); - _client.Send(new TdApi.RegisterUser(firstName, lastName), new AuthorizationRequestHandler()); + _client.Send(new TdApi.RegisterUser(firstName, lastName, false), new AuthorizationRequestHandler()); } else if (_authorizationState is TdApi.AuthorizationStateWaitPassword) { diff --git a/example/java/org/drinkless/tdlib/example/Example.java b/example/java/org/drinkless/tdlib/example/Example.java index 7a8ea1c94..066ad96b3 100644 --- a/example/java/org/drinkless/tdlib/example/Example.java +++ b/example/java/org/drinkless/tdlib/example/Example.java @@ -133,7 +133,7 @@ public final class Example { case TdApi.AuthorizationStateWaitRegistration.CONSTRUCTOR: { String firstName = promptString("Please enter your first name: "); String lastName = promptString("Please enter your last name: "); - client.send(new TdApi.RegisterUser(firstName, lastName), new AuthorizationRequestHandler()); + client.send(new TdApi.RegisterUser(firstName, lastName, false), new AuthorizationRequestHandler()); break; } case TdApi.AuthorizationStateWaitPassword.CONSTRUCTOR: { diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 999fef21d..152b12a5e 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -6961,7 +6961,8 @@ requestQrCodeAuthentication other_user_ids:vector = Ok; //@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration //@first_name The first name of the user; 1-64 characters //@last_name The last name of the user; 0-64 characters -registerUser first_name:string last_name:string = Ok; +//@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contacts list +registerUser first_name:string last_name:string disable_notification:Bool = Ok; //@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. //-Works only when the current authorization state is authorizationStateWaitEmailCode and authorization_state.can_reset_email_address == true diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index 6891639ab..51456cad9 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -636,7 +636,7 @@ void AuthManager::check_code(uint64 query_id, string code) { send_auth_sign_in_query(); } -void AuthManager::register_user(uint64 query_id, string first_name, string last_name) { +void AuthManager::register_user(uint64 query_id, string first_name, string last_name, bool disable_notification) { if (state_ != State::WaitRegistration) { return on_query_error(query_id, Status::Error(400, "Call to registerUser unexpected")); } @@ -649,6 +649,9 @@ void AuthManager::register_user(uint64 query_id, string first_name, string last_ last_name = clean_name(last_name, MAX_NAME_LENGTH); int32 flags = 0; + if (disable_notification) { + flags |= telegram_api::auth_signUp::NO_JOINED_NOTIFICATIONS_MASK; + } start_net_query(NetQueryType::SignUp, G()->net_query_creator().create_unauth(telegram_api::auth_signUp( flags, false /*ignored*/, send_code_helper_.phone_number().str(), send_code_helper_.phone_code_hash().str(), first_name, last_name))); diff --git a/td/telegram/AuthManager.h b/td/telegram/AuthManager.h index 5c5d5abfe..5707e88ea 100644 --- a/td/telegram/AuthManager.h +++ b/td/telegram/AuthManager.h @@ -44,7 +44,7 @@ class AuthManager final : public NetActor { void check_email_code(uint64 query_id, EmailVerification &&code); void reset_email_address(uint64 query_id); void check_code(uint64 query_id, string code); - void register_user(uint64 query_id, string first_name, string last_name); + void register_user(uint64 query_id, string first_name, string last_name, bool disable_notification); void request_qr_code_authentication(uint64 query_id, vector other_user_ids); void check_bot_token(uint64 query_id, string bot_token); void check_password(uint64 query_id, string password); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 2889b10aa..8c8857653 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4202,7 +4202,7 @@ void Td::on_request(uint64 id, td_api::registerUser &request) { CLEAN_INPUT_STRING(request.first_name_); CLEAN_INPUT_STRING(request.last_name_); send_closure(auth_manager_actor_, &AuthManager::register_user, id, std::move(request.first_name_), - std::move(request.last_name_)); + std::move(request.last_name_), request.disable_notification_); } void Td::on_request(uint64 id, td_api::requestQrCodeAuthentication &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index f6b5823fe..2ca8abb7b 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2399,11 +2399,11 @@ class CliClient final : public Actor { send_request(td_api::make_object(as_email_address_authentication(args))); } else if (op == "cac") { send_request(td_api::make_object(args)); - } else if (op == "ru") { + } else if (op == "ru" || op == "rus") { string first_name; string last_name; get_args(args, first_name, last_name); - send_request(td_api::make_object(first_name, last_name)); + send_request(td_api::make_object(first_name, last_name, op == "rus")); } else if (op == "cap") { send_request(td_api::make_object(args)); } else if (op == "cabt") { diff --git a/test/tdclient.cpp b/test/tdclient.cpp index a5aa26928..66f0ae615 100644 --- a/test/tdclient.cpp +++ b/test/tdclient.cpp @@ -224,7 +224,7 @@ class DoAuthentication final : public TestClinetTask { function = td::make_tl_object(code_); break; case td::td_api::authorizationStateWaitRegistration::ID: - function = td::make_tl_object(name_, ""); + function = td::make_tl_object(name_, "", false); break; case td::td_api::authorizationStateWaitTdlibParameters::ID: { auto request = td::td_api::make_object();