diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index f793158a..26ddd12d 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -5618,6 +5618,14 @@ void MessagesManager::on_update_channel_max_unavailable_message_id(ChannelId cha "on_update_channel_max_unavailable_message_id"); } +void MessagesManager::on_user_dialog_action(DialogId dialog_id, UserId user_id, + tl_object_ptr &&action) { + send_closure(G()->td(), &Td::send_update, + make_tl_object( + dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "on_user_dialog_action"), + std::move(action))); +} + void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_ptr &&update, int32 new_pts, int32 pts_count, const char *source, bool is_postponed_udpate) { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index ca9e6ca5..0337a3b9 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -959,6 +959,8 @@ class MessagesManager : public Actor { void on_update_channel_max_unavailable_message_id(ChannelId channel_id, MessageId max_unavailable_message_id); + void on_user_dialog_action(DialogId dialog_id, UserId user_id, tl_object_ptr &&action); + void delete_messages(DialogId dialog_id, const vector &message_ids, bool revoke, Promise &&promise); void delete_dialog_history(DialogId dialog_id, bool remove_from_dialog_list, Promise &&promise); diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 21ddeae0..207d6c1f 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1497,7 +1497,7 @@ void UpdatesManager::on_update(tl_object_ptr update->pts_count_, "on_updateChannelWebPage"); } -tl_object_ptr UpdatesManager::convertSendMessageAction( +tl_object_ptr UpdatesManager::convert_send_message_action( tl_object_ptr action) { auto fix_progress = [](int32 progress) { return progress <= 0 || progress > 100 ? 0 : progress; }; @@ -1554,10 +1554,8 @@ void UpdatesManager::on_update(tl_object_ptr upd LOG(DEBUG) << "Ignore user typing in unknown " << dialog_id; return; } - send_closure(G()->td(), &Td::send_update, - make_tl_object( - dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateUserTyping"), - convertSendMessageAction(std::move(update->action_)))); + td_->messages_manager_->on_user_dialog_action(dialog_id, user_id, + convert_send_message_action(std::move(update->action_))); } void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { @@ -1576,10 +1574,8 @@ void UpdatesManager::on_update(tl_object_ptr return; } } - send_closure(G()->td(), &Td::send_update, - make_tl_object( - dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateChatUserTyping"), - convertSendMessageAction(std::move(update->action_)))); + td_->messages_manager_->on_user_dialog_action(dialog_id, user_id, + convert_send_message_action(std::move(update->action_))); } void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { @@ -1597,10 +1593,7 @@ void UpdatesManager::on_update(tl_object_ptrtd(), &Td::send_update, - make_tl_object( - dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateEncryptedChatTyping"), - make_tl_object())); + td_->messages_manager_->on_user_dialog_action(dialog_id, user_id, make_tl_object()); } void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index bf4e83b9..9602fee7 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -139,7 +139,7 @@ class UpdatesManager : public Actor { void set_date(int32 date, bool from_update, string date_source); - static tl_object_ptr convertSendMessageAction( + static tl_object_ptr convert_send_message_action( tl_object_ptr action); void process_get_difference_updates(vector> &&new_messages,