Add td_api::checkCreatedPublicChatsLimit.
GitOrigin-RevId: 9364cd09348ece39d56cbc8882fa8bfef36df18c
This commit is contained in:
parent
892a091998
commit
0e874a5247
@ -3127,6 +3127,9 @@ checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult;
|
||||
//@description Returns a list of public chats of the specified type, owned by the user @type Type of the public chats to return
|
||||
getCreatedPublicChats type:PublicChatType = Chats;
|
||||
|
||||
//@description Checks whether a maximum number of owned public chats is reached. Returns corresponding error if the limit was reached @type Type of the public chats, for which to check the limit
|
||||
checkCreatedPublicChatsLimit type:PublicChatType = Ok;
|
||||
|
||||
//@description Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group
|
||||
getSuitableDiscussionChats = Chats;
|
||||
|
||||
|
Binary file not shown.
@ -1975,12 +1975,15 @@ class GetCreatedPublicChannelsQuery : public Td::ResultHandler {
|
||||
explicit GetCreatedPublicChannelsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(PublicDialogType type) {
|
||||
void send(PublicDialogType type, bool check_limit) {
|
||||
type_ = type;
|
||||
int32 flags = 0;
|
||||
if (type_ == PublicDialogType::IsLocationBased) {
|
||||
flags |= telegram_api::channels_getAdminedPublicChannels::BY_LOCATION_MASK;
|
||||
}
|
||||
if (check_limit) {
|
||||
flags |= telegram_api::channels_getAdminedPublicChannels::CHECK_LIMIT_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
create_storer(telegram_api::channels_getAdminedPublicChannels(flags, false /*ignored*/, false /*ignored*/))));
|
||||
}
|
||||
@ -5798,7 +5801,7 @@ vector<DialogId> ContactsManager::get_created_public_dialogs(PublicDialogType ty
|
||||
});
|
||||
}
|
||||
|
||||
td_->create_handler<GetCreatedPublicChannelsQuery>(std::move(promise))->send(type);
|
||||
td_->create_handler<GetCreatedPublicChannelsQuery>(std::move(promise))->send(type, false);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -5809,6 +5812,10 @@ void ContactsManager::on_get_created_public_channels(PublicDialogType type,
|
||||
created_public_channels_inited_[index] = true;
|
||||
}
|
||||
|
||||
void ContactsManager::check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise) {
|
||||
td_->create_handler<GetCreatedPublicChannelsQuery>(std::move(promise))->send(type, true);
|
||||
}
|
||||
|
||||
vector<DialogId> ContactsManager::get_dialogs_for_discussion(Promise<Unit> &&promise) {
|
||||
if (dialogs_for_discussion_inited_) {
|
||||
promise.set_value(Unit());
|
||||
|
@ -366,6 +366,8 @@ class ContactsManager : public Actor {
|
||||
|
||||
vector<DialogId> get_created_public_dialogs(PublicDialogType type, Promise<Unit> &&promise);
|
||||
|
||||
void check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise);
|
||||
|
||||
vector<DialogId> get_dialogs_for_discussion(Promise<Unit> &&promise);
|
||||
|
||||
bool is_user_contact(UserId user_id) const;
|
||||
|
@ -5504,6 +5504,12 @@ void Td::on_request(uint64 id, const td_api::getCreatedPublicChats &request) {
|
||||
CREATE_REQUEST(GetCreatedPublicChatsRequest, get_public_dialog_type(request.type_));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::checkCreatedPublicChatsLimit &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
contacts_manager_->check_created_public_dialogs_limit(get_public_dialog_type(request.type_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getSuitableDiscussionChats &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_NO_ARGS_REQUEST(GetSuitableDiscussionChatsRequest);
|
||||
|
@ -528,6 +528,8 @@ class Td final : public NetQueryCallback {
|
||||
|
||||
void on_request(uint64 id, const td_api::getCreatedPublicChats &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::checkCreatedPublicChatsLimit &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getSuitableDiscussionChats &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::openChat &request);
|
||||
|
@ -3278,6 +3278,11 @@ class CliClient final : public Actor {
|
||||
} else if (op == "gcpcl") {
|
||||
send_request(td_api::make_object<td_api::getCreatedPublicChats>(
|
||||
td_api::make_object<td_api::publicChatTypeIsLocationBased>()));
|
||||
} else if (op == "ccpcl") {
|
||||
send_request(td_api::make_object<td_api::checkCreatedPublicChatsLimit>());
|
||||
} else if (op == "ccpcll") {
|
||||
send_request(td_api::make_object<td_api::checkCreatedPublicChatsLimit>(
|
||||
td_api::make_object<td_api::publicChatTypeIsLocationBased>()));
|
||||
} else if (op == "gsdc") {
|
||||
send_request(td_api::make_object<td_api::getSuitableDiscussionChats>());
|
||||
} else if (op == "cpc") {
|
||||
|
Loading…
Reference in New Issue
Block a user