Add checkChatUsernameResultUsernamePurchasable.
This commit is contained in:
parent
47c8d957a1
commit
a20076b620
@ -3346,6 +3346,9 @@ checkChatUsernameResultUsernameInvalid = CheckChatUsernameResult;
|
||||
//@description The username is occupied
|
||||
checkChatUsernameResultUsernameOccupied = CheckChatUsernameResult;
|
||||
|
||||
//@description The username can be purchased at fragment.com
|
||||
checkChatUsernameResultUsernamePurchasable = CheckChatUsernameResult;
|
||||
|
||||
//@description The user has too many chats with username, one of them must be made private first
|
||||
checkChatUsernameResultPublicChatsTooMuch = CheckChatUsernameResult;
|
||||
|
||||
|
@ -5631,7 +5631,8 @@ void ContactsManager::check_dialog_username(DialogId dialog_id, const string &us
|
||||
if (username.empty()) {
|
||||
return promise.set_value(CheckDialogUsernameResult::Ok);
|
||||
}
|
||||
if (!is_allowed_username(username)) {
|
||||
|
||||
if (!is_allowed_username(username) && username.size() != 4) {
|
||||
return promise.set_value(CheckDialogUsernameResult::Invalid);
|
||||
}
|
||||
|
||||
@ -5647,6 +5648,9 @@ void ContactsManager::check_dialog_username(DialogId dialog_id, const string &us
|
||||
if (error.message() == "USERNAME_INVALID") {
|
||||
return promise.set_value(CheckDialogUsernameResult::Invalid);
|
||||
}
|
||||
if (error.message() == "USERNAME_PURCHASE_AVAILABLE") {
|
||||
return promise.set_value(CheckDialogUsernameResult::Purchasable);
|
||||
}
|
||||
return promise.set_error(std::move(error));
|
||||
}
|
||||
|
||||
@ -5677,6 +5681,8 @@ td_api::object_ptr<td_api::CheckChatUsernameResult> ContactsManager::get_check_c
|
||||
return td_api::make_object<td_api::checkChatUsernameResultUsernameInvalid>();
|
||||
case CheckDialogUsernameResult::Occupied:
|
||||
return td_api::make_object<td_api::checkChatUsernameResultUsernameOccupied>();
|
||||
case CheckDialogUsernameResult::Purchasable:
|
||||
return td_api::make_object<td_api::checkChatUsernameResultUsernamePurchasable>();
|
||||
case CheckDialogUsernameResult::PublicDialogsTooMuch:
|
||||
return td_api::make_object<td_api::checkChatUsernameResultPublicChatsTooMuch>();
|
||||
case CheckDialogUsernameResult::PublicGroupsUnavailable:
|
||||
|
@ -304,7 +304,14 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void invalidate_user_full(UserId user_id);
|
||||
|
||||
enum class CheckDialogUsernameResult : uint8 { Ok, Invalid, Occupied, PublicDialogsTooMuch, PublicGroupsUnavailable };
|
||||
enum class CheckDialogUsernameResult : uint8 {
|
||||
Ok,
|
||||
Invalid,
|
||||
Occupied,
|
||||
Purchasable,
|
||||
PublicDialogsTooMuch,
|
||||
PublicGroupsUnavailable
|
||||
};
|
||||
|
||||
void check_dialog_username(DialogId dialog_id, const string &username, Promise<CheckDialogUsernameResult> &&promise);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user