Cancel previous setEncryptedTyping query.
GitOrigin-RevId: dcebab6bae15c25def5f7c6bc15f03fffea66ef4
This commit is contained in:
parent
62e1f418e2
commit
86666a8418
@ -2786,6 +2786,10 @@ class SetTypingQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
void on_error(uint64 id, Status status) override {
|
||||||
|
if (status.code() == NetQuery::Cancelled) {
|
||||||
|
return promise_.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
LOG(INFO) << "Receive error for set typing: " << status;
|
LOG(INFO) << "Receive error for set typing: " << status;
|
||||||
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "SetTypingQuery");
|
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "SetTypingQuery");
|
||||||
promise_.set_error(std::move(status));
|
promise_.set_error(std::move(status));
|
||||||
@ -19166,7 +19170,6 @@ void MessagesManager::send_dialog_action(DialogId dialog_id, const tl_object_ptr
|
|||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
// TODO cancel previous query
|
|
||||||
send_closure(G()->secret_chats_manager(), &SecretChatsManager::send_message_action, dialog_id.get_secret_chat_id(),
|
send_closure(G()->secret_chats_manager(), &SecretChatsManager::send_message_action, dialog_id.get_secret_chat_id(),
|
||||||
std::move(send_action));
|
std::move(send_action));
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
@ -19229,7 +19232,7 @@ void MessagesManager::send_dialog_action(DialogId dialog_id, const tl_object_ptr
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto &query_ref = set_typing_query_[dialog_id];
|
auto &query_ref = set_typing_query_[dialog_id];
|
||||||
if (!query_ref.empty()) {
|
if (!query_ref.empty() && !td_->auth_manager_->is_bot()) {
|
||||||
LOG(INFO) << "Cancel previous set typing query";
|
LOG(INFO) << "Cancel previous set typing query";
|
||||||
cancel_query(query_ref);
|
cancel_query(query_ref);
|
||||||
}
|
}
|
||||||
|
@ -339,10 +339,16 @@ void SecretChatActor::send_message_action(tl_object_ptr<secret_api::SendMessageA
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool flag = action->get_id() != secret_api::sendMessageCancelAction::ID;
|
bool flag = action->get_id() != secret_api::sendMessageCancelAction::ID;
|
||||||
context_->send_net_query(context_->net_query_creator().create(
|
|
||||||
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::Ignore)),
|
auto net_query = context_->net_query_creator().create(
|
||||||
create_storer(telegram_api::messages_setEncryptedTyping(get_input_chat(), flag))),
|
UniqueId::next(UniqueId::Type::Default, static_cast<uint8>(QueryType::Ignore)),
|
||||||
actor_shared(this), false);
|
create_storer(telegram_api::messages_setEncryptedTyping(get_input_chat(), flag)));
|
||||||
|
if (!set_typing_query_.empty()) {
|
||||||
|
LOG(INFO) << "Cancel previous set typing query";
|
||||||
|
cancel_query(set_typing_query_);
|
||||||
|
}
|
||||||
|
set_typing_query_ = net_query.get_weak();
|
||||||
|
context_->send_net_query(std::move(net_query), actor_shared(this), false);
|
||||||
}
|
}
|
||||||
void SecretChatActor::send_read_history(int32 date, Promise<> promise) {
|
void SecretChatActor::send_read_history(int32 date, Promise<> promise) {
|
||||||
if (close_flag_) {
|
if (close_flag_) {
|
||||||
|
@ -571,6 +571,8 @@ class SecretChatActor : public NetQueryCallback {
|
|||||||
|
|
||||||
Container<OutboundMessageState> outbound_message_states_;
|
Container<OutboundMessageState> outbound_message_states_;
|
||||||
|
|
||||||
|
NetQueryRef set_typing_query_;
|
||||||
|
|
||||||
enum SendFlag {
|
enum SendFlag {
|
||||||
None = 0,
|
None = 0,
|
||||||
External = 1,
|
External = 1,
|
||||||
|
Reference in New Issue
Block a user