Follow new server-side limits on first/last name and title length.
GitOrigin-RevId: 89fe4eb85c42859974142fd163ea9fd062fde459
This commit is contained in:
parent
10063f39f4
commit
2d05be04dd
@ -2345,7 +2345,7 @@ setAuthenticationPhoneNumber phone_number:string allow_flash_call:Bool is_curren
|
||||
resendAuthenticationCode = Ok;
|
||||
|
||||
//@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @code The verification code received via SMS, Telegram message, phone call, or flash call
|
||||
//@first_name If the user is not yet registered, the first name of the user; 1-255 characters @last_name If the user is not yet registered; the last name of the user; optional; 0-255 characters
|
||||
//@first_name If the user is not yet registered, the first name of the user; 1-64 characters @last_name If the user is not yet registered; the last name of the user; optional; 0-64 characters
|
||||
checkAuthenticationCode code:string first_name:string last_name:string = Ok;
|
||||
|
||||
//@description Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword @password The password to check
|
||||
@ -2734,10 +2734,10 @@ createSupergroupChat supergroup_id:int32 force:Bool = Chat;
|
||||
//@description Returns an existing chat corresponding to a known secret chat @secret_chat_id Secret chat identifier
|
||||
createSecretChat secret_chat_id:int32 = Chat;
|
||||
|
||||
//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-255 characters
|
||||
//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-128 characters
|
||||
createNewBasicGroupChat user_ids:vector<int32> title:string = Chat;
|
||||
|
||||
//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-255 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters
|
||||
//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-128 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters
|
||||
createNewSupergroupChat title:string is_channel:Bool description:string = Chat;
|
||||
|
||||
//@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user
|
||||
@ -2748,7 +2748,7 @@ upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat;
|
||||
|
||||
|
||||
//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed
|
||||
//@chat_id Chat identifier @title New title of the chat; 1-255 characters
|
||||
//@chat_id Chat identifier @title New title of the chat; 1-128 characters
|
||||
setChatTitle chat_id:int53 title:string = Ok;
|
||||
|
||||
//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed
|
||||
@ -3015,7 +3015,7 @@ setProfilePhoto photo:InputFile = Ok;
|
||||
//@description Deletes a profile photo. If something changes, updateUser will be sent @profile_photo_id Identifier of the profile photo to delete
|
||||
deleteProfilePhoto profile_photo_id:int64 = Ok;
|
||||
|
||||
//@description Changes the first and last name of the current user. If something changes, updateUser will be sent @first_name The new value of the first name for the user; 1-255 characters @last_name The new value of the optional last name for the user; 0-255 characters
|
||||
//@description Changes the first and last name of the current user. If something changes, updateUser will be sent @first_name The new value of the first name for the user; 1-64 characters @last_name The new value of the optional last name for the user; 0-64 characters
|
||||
setName first_name:string last_name:string = Ok;
|
||||
|
||||
//@description Changes the bio of the current user @bio The new value of the user bio; 0-70 characters without line feeds
|
||||
|
@ -169,7 +169,7 @@ class AuthManager : public NetActor {
|
||||
void on_closing();
|
||||
|
||||
private:
|
||||
static constexpr size_t MAX_NAME_LENGTH = 255; // server side limit
|
||||
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit
|
||||
|
||||
enum class State : int32 {
|
||||
None,
|
||||
|
@ -4046,7 +4046,7 @@ void ContactsManager::toggle_channel_is_all_history_available(ChannelId channel_
|
||||
|
||||
void ContactsManager::set_channel_description(ChannelId channel_id, const string &description,
|
||||
Promise<Unit> &&promise) {
|
||||
auto new_description = strip_empty_characters(description, MAX_NAME_LENGTH);
|
||||
auto new_description = strip_empty_characters(description, MAX_DESCRIPTION_LENGTH);
|
||||
auto c = get_channel(channel_id);
|
||||
if (c == nullptr) {
|
||||
return promise.set_error(Status::Error(6, "Supergroup not found"));
|
||||
|
@ -681,7 +681,8 @@ class ContactsManager : public Actor {
|
||||
class SecretChatLogEvent;
|
||||
|
||||
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server side limit
|
||||
static constexpr size_t MAX_NAME_LENGTH = 255; // server side limit for first/last name and title
|
||||
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
|
||||
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for channel description
|
||||
static constexpr size_t MAX_BIO_LENGTH = 70; // server side limit
|
||||
|
||||
static constexpr int32 USER_FLAG_HAS_ACCESS_HASH = 1 << 0;
|
||||
|
@ -13207,7 +13207,7 @@ DialogId MessagesManager::create_new_group_chat(const vector<UserId> &user_ids,
|
||||
return DialogId();
|
||||
}
|
||||
|
||||
auto new_title = clean_name(title, MAX_NAME_LENGTH);
|
||||
auto new_title = clean_name(title, MAX_TITLE_LENGTH);
|
||||
if (new_title.empty()) {
|
||||
promise.set_error(Status::Error(3, "Title can't be empty"));
|
||||
return DialogId();
|
||||
@ -13255,7 +13255,7 @@ DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_m
|
||||
return dialog_id;
|
||||
}
|
||||
|
||||
auto new_title = clean_name(title, MAX_NAME_LENGTH);
|
||||
auto new_title = clean_name(title, MAX_TITLE_LENGTH);
|
||||
if (new_title.empty()) {
|
||||
promise.set_error(Status::Error(3, "Title can't be empty"));
|
||||
return DialogId();
|
||||
@ -13267,7 +13267,7 @@ DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_m
|
||||
created_dialogs_[random_id]; // reserve place for result
|
||||
|
||||
td_->create_handler<CreateChannelQuery>(std::move(promise))
|
||||
->send(new_title, is_megagroup, strip_empty_characters(description, MAX_NAME_LENGTH), random_id);
|
||||
->send(new_title, is_megagroup, strip_empty_characters(description, MAX_DESCRIPTION_LENGTH), random_id);
|
||||
return DialogId();
|
||||
}
|
||||
|
||||
@ -21438,7 +21438,7 @@ void MessagesManager::set_dialog_title(DialogId dialog_id, const string &title,
|
||||
return promise.set_error(Status::Error(3, "Chat not found"));
|
||||
}
|
||||
|
||||
auto new_title = clean_name(title, MAX_NAME_LENGTH);
|
||||
auto new_title = clean_name(title, MAX_TITLE_LENGTH);
|
||||
if (new_title.empty()) {
|
||||
return promise.set_error(Status::Error(3, "Title can't be empty"));
|
||||
}
|
||||
|
@ -1910,7 +1910,8 @@ class MessagesManager : public Actor {
|
||||
static constexpr int32 MAX_CHANNEL_DIFFERENCE = 100;
|
||||
static constexpr int32 MAX_BOT_CHANNEL_DIFFERENCE = 100000; // server side limit
|
||||
static constexpr int32 MAX_RECENT_FOUND_DIALOGS = 20; // some reasonable value
|
||||
static constexpr size_t MAX_NAME_LENGTH = 255; // server side limit for title and description
|
||||
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for chat title
|
||||
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat description
|
||||
static constexpr int64 SPONSORED_DIALOG_ORDER = static_cast<int64>(2147483647) << 32;
|
||||
static constexpr int32 MIN_PINNED_DIALOG_DATE = 2147000000; // some big date
|
||||
static constexpr int32 MAX_PRIVATE_MESSAGE_TTL = 60; // server side limit
|
||||
|
Reference in New Issue
Block a user