Add canSendMessageToUser.only_local.
This commit is contained in:
parent
3391c643f3
commit
aa6be7d9bf
@ -9538,8 +9538,10 @@ setNewChatPrivacySettings settings:newChatPrivacySettings = Ok;
|
|||||||
getNewChatPrivacySettings = NewChatPrivacySettings;
|
getNewChatPrivacySettings = NewChatPrivacySettings;
|
||||||
|
|
||||||
|
|
||||||
//@description Check whether the current user can message another user or try to create a chat with them @user_id Identifier of the other user
|
//@description Check whether the current user can message another user or try to create a chat with them
|
||||||
canSendMessageToUser user_id:int53 = CanSendMessageToUserResult;
|
//@user_id Identifier of the other user
|
||||||
|
//@only_local Pass true to get only locally available information without sending network requests
|
||||||
|
canSendMessageToUser user_id:int53 only_local:Bool = CanSendMessageToUserResult;
|
||||||
|
|
||||||
|
|
||||||
//@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options "version" and "commit_hash"
|
//@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options "version" and "commit_hash"
|
||||||
|
@ -5561,7 +5561,6 @@ void ContactsManager::can_send_message_to_user(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
LOG(ERROR) << "Can't check " << user_id << " message privacy settings";
|
|
||||||
return promise.set_value(td_api::make_object<td_api::canSendMessageToUserResultOk>());
|
return promise.set_value(td_api::make_object<td_api::canSendMessageToUserResultOk>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6531,7 +6531,7 @@ void Td::on_request(uint64 id, td_api::setNewChatPrivacySettings &request) {
|
|||||||
void Td::on_request(uint64 id, const td_api::canSendMessageToUser &request) {
|
void Td::on_request(uint64 id, const td_api::canSendMessageToUser &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
contacts_manager_->can_send_message_to_user(UserId(request.user_id_), false, std::move(promise));
|
contacts_manager_->can_send_message_to_user(UserId(request.user_id_), request.only_local_, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::setChatTitle &request) {
|
void Td::on_request(uint64 id, td_api::setChatTitle &request) {
|
||||||
|
@ -5449,10 +5449,10 @@ class CliClient final : public Actor {
|
|||||||
get_args(args, allow_new_chats_from_unknown_users);
|
get_args(args, allow_new_chats_from_unknown_users);
|
||||||
auto settings = td_api::make_object<td_api::newChatPrivacySettings>(allow_new_chats_from_unknown_users);
|
auto settings = td_api::make_object<td_api::newChatPrivacySettings>(allow_new_chats_from_unknown_users);
|
||||||
send_request(td_api::make_object<td_api::setNewChatPrivacySettings>(std::move(settings)));
|
send_request(td_api::make_object<td_api::setNewChatPrivacySettings>(std::move(settings)));
|
||||||
} else if (op == "csmtu") {
|
} else if (op == "csmtu" || op == "csmtul") {
|
||||||
UserId user_id;
|
UserId user_id;
|
||||||
get_args(args, user_id);
|
get_args(args, user_id);
|
||||||
send_request(td_api::make_object<td_api::canSendMessageToUser>(user_id));
|
send_request(td_api::make_object<td_api::canSendMessageToUser>(user_id, op == "csmtul"));
|
||||||
} else if (op == "sct") {
|
} else if (op == "sct") {
|
||||||
ChatId chat_id;
|
ChatId chat_id;
|
||||||
string title;
|
string title;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user