Add getBlockedMessageSenders.block_list.
This commit is contained in:
parent
3794e65b76
commit
ec6c36e578
@ -7779,8 +7779,11 @@ setMessageSenderBlockList sender_id:MessageSender block_list:BlockList = Ok;
|
|||||||
//@report_spam Pass true to report the sender to the Telegram moderators
|
//@report_spam Pass true to report the sender to the Telegram moderators
|
||||||
blockMessageSenderFromReplies message_id:int53 delete_message:Bool delete_all_messages:Bool report_spam:Bool = Ok;
|
blockMessageSenderFromReplies message_id:int53 delete_message:Bool delete_all_messages:Bool report_spam:Bool = Ok;
|
||||||
|
|
||||||
//@description Returns users and chats that were blocked by the current user @offset Number of users and chats to skip in the result; must be non-negative @limit The maximum number of users and chats to return; up to 100
|
//@description Returns users and chats that were blocked by the current user
|
||||||
getBlockedMessageSenders offset:int32 limit:int32 = MessageSenders;
|
//@block_list Block list from which to return users
|
||||||
|
//@offset Number of users and chats to skip in the result; must be non-negative
|
||||||
|
//@limit The maximum number of users and chats to return; up to 100
|
||||||
|
getBlockedMessageSenders block_list:BlockList offset:int32 limit:int32 = MessageSenders;
|
||||||
|
|
||||||
|
|
||||||
//@description Adds a user to the contact list or edits an existing contact by their user identifier
|
//@description Adds a user to the contact list or edits an existing contact by their user identifier
|
||||||
|
@ -747,11 +747,14 @@ class GetBlockedDialogsQuery final : public Td::ResultHandler {
|
|||||||
: promise_(std::move(promise)) {
|
: promise_(std::move(promise)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void send(int32 offset, int32 limit) {
|
void send(BlockListId block_list_id, int32 offset, int32 limit) {
|
||||||
offset_ = offset;
|
offset_ = offset;
|
||||||
limit_ = limit;
|
limit_ = limit;
|
||||||
|
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
|
if (block_list_id == BlockListId::stories()) {
|
||||||
|
flags |= telegram_api::contacts_getBlocked::MY_STORIES_FROM_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
send_query(
|
send_query(
|
||||||
G()->net_query_creator().create(telegram_api::contacts_getBlocked(flags, false /*ignored*/, offset, limit)));
|
G()->net_query_creator().create(telegram_api::contacts_getBlocked(flags, false /*ignored*/, offset, limit)));
|
||||||
@ -17716,8 +17719,8 @@ bool MessagesManager::is_dialog_blocked(DialogId dialog_id) const {
|
|||||||
return d != nullptr && d->is_blocked;
|
return d != nullptr && d->is_blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::get_blocked_dialogs(int32 offset, int32 limit,
|
void MessagesManager::get_blocked_dialogs(const td_api::object_ptr<td_api::BlockList> &block_list, int32 offset,
|
||||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise) {
|
int32 limit, Promise<td_api::object_ptr<td_api::messageSenders>> &&promise) {
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
return promise.set_error(Status::Error(400, "Parameter offset must be non-negative"));
|
return promise.set_error(Status::Error(400, "Parameter offset must be non-negative"));
|
||||||
}
|
}
|
||||||
@ -17726,7 +17729,12 @@ void MessagesManager::get_blocked_dialogs(int32 offset, int32 limit,
|
|||||||
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
||||||
}
|
}
|
||||||
|
|
||||||
td_->create_handler<GetBlockedDialogsQuery>(std::move(promise))->send(offset, limit);
|
auto block_list_id = BlockListId(block_list);
|
||||||
|
if (!block_list_id.is_valid()) {
|
||||||
|
return promise.set_error(Status::Error(400, "Block list must be non-empty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
td_->create_handler<GetBlockedDialogsQuery>(std::move(promise))->send(block_list_id, offset, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::on_get_blocked_dialogs(int32 offset, int32 limit, int32 total_count,
|
void MessagesManager::on_get_blocked_dialogs(int32 offset, int32 limit, int32 total_count,
|
||||||
|
@ -630,7 +630,8 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
bool is_dialog_blocked(DialogId dialog_id) const;
|
bool is_dialog_blocked(DialogId dialog_id) const;
|
||||||
|
|
||||||
void get_blocked_dialogs(int32 offset, int32 limit, Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
void get_blocked_dialogs(const td_api::object_ptr<td_api::BlockList> &block_list, int32 offset, int32 limit,
|
||||||
|
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
||||||
|
|
||||||
void on_get_blocked_dialogs(int32 offset, int32 limit, int32 total_count,
|
void on_get_blocked_dialogs(int32 offset, int32 limit, int32 total_count,
|
||||||
vector<tl_object_ptr<telegram_api::peerBlocked>> &&blocked_peers,
|
vector<tl_object_ptr<telegram_api::peerBlocked>> &&blocked_peers,
|
||||||
|
@ -7055,7 +7055,7 @@ void Td::on_request(uint64 id, const td_api::blockMessageSenderFromReplies &requ
|
|||||||
void Td::on_request(uint64 id, const td_api::getBlockedMessageSenders &request) {
|
void Td::on_request(uint64 id, const td_api::getBlockedMessageSenders &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
messages_manager_->get_blocked_dialogs(request.offset_, request.limit_, std::move(promise));
|
messages_manager_->get_blocked_dialogs(request.block_list_, request.offset_, request.limit_, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::addContact &request) {
|
void Td::on_request(uint64 id, td_api::addContact &request) {
|
||||||
|
@ -3026,10 +3026,12 @@ class CliClient final : public Actor {
|
|||||||
} else if (op == "tme") {
|
} else if (op == "tme") {
|
||||||
send_request(td_api::make_object<td_api::getRecentlyVisitedTMeUrls>(args));
|
send_request(td_api::make_object<td_api::getRecentlyVisitedTMeUrls>(args));
|
||||||
} else if (op == "gbms") {
|
} else if (op == "gbms") {
|
||||||
|
string block_list;
|
||||||
int32 offset;
|
int32 offset;
|
||||||
string limit;
|
string limit;
|
||||||
get_args(args, offset, limit);
|
get_args(args, block_list, offset, limit);
|
||||||
send_request(td_api::make_object<td_api::getBlockedMessageSenders>(offset, as_limit(limit)));
|
send_request(
|
||||||
|
td_api::make_object<td_api::getBlockedMessageSenders>(as_block_list(block_list), offset, as_limit(limit)));
|
||||||
} else if (op == "gu") {
|
} else if (op == "gu") {
|
||||||
UserId user_id;
|
UserId user_id;
|
||||||
get_args(args, user_id);
|
get_args(args, user_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user