Add registerUser.disable_notification.

This commit is contained in:
levlam 2024-01-29 16:43:42 +03:00
parent 440d9de15a
commit 2a8156a1bc
9 changed files with 14 additions and 10 deletions

View File

@ -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<td_api::registerUser>(first_name, last_name),
send_query(td_api::make_object<td_api::registerUser>(first_name, last_name, false),
create_authentication_query_handler());
},
[this](td_api::authorizationStateWaitPassword &) {

View File

@ -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)
{

View File

@ -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: {

View File

@ -6961,7 +6961,8 @@ requestQrCodeAuthentication other_user_ids:vector<int53> = 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

View File

@ -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)));

View File

@ -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<UserId> other_user_ids);
void check_bot_token(uint64 query_id, string bot_token);
void check_password(uint64 query_id, string password);

View File

@ -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) {

View File

@ -2399,11 +2399,11 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::checkAuthenticationEmailCode>(as_email_address_authentication(args)));
} else if (op == "cac") {
send_request(td_api::make_object<td_api::checkAuthenticationCode>(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<td_api::registerUser>(first_name, last_name));
send_request(td_api::make_object<td_api::registerUser>(first_name, last_name, op == "rus"));
} else if (op == "cap") {
send_request(td_api::make_object<td_api::checkAuthenticationPassword>(args));
} else if (op == "cabt") {

View File

@ -224,7 +224,7 @@ class DoAuthentication final : public TestClinetTask {
function = td::make_tl_object<td::td_api::checkAuthenticationCode>(code_);
break;
case td::td_api::authorizationStateWaitRegistration::ID:
function = td::make_tl_object<td::td_api::registerUser>(name_, "");
function = td::make_tl_object<td::td_api::registerUser>(name_, "", false);
break;
case td::td_api::authorizationStateWaitTdlibParameters::ID: {
auto request = td::td_api::make_object<td::td_api::setTdlibParameters>();