Send updateUserChatAction from on_user_dialog_action.

GitOrigin-RevId: 6af5402efa9ac21b9054278c839d982b4fbdcb6e
This commit is contained in:
levlam 2018-03-13 11:57:58 +03:00
parent 86666a8418
commit 8eaea5d4af
4 changed files with 17 additions and 14 deletions

View File

@ -5618,6 +5618,14 @@ void MessagesManager::on_update_channel_max_unavailable_message_id(ChannelId cha
"on_update_channel_max_unavailable_message_id"); "on_update_channel_max_unavailable_message_id");
} }
void MessagesManager::on_user_dialog_action(DialogId dialog_id, UserId user_id,
tl_object_ptr<td_api::ChatAction> &&action) {
send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateUserChatAction>(
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<telegram_api::Update> &&update, void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_ptr<telegram_api::Update> &&update,
int32 new_pts, int32 pts_count, const char *source, int32 new_pts, int32 pts_count, const char *source,
bool is_postponed_udpate) { bool is_postponed_udpate) {

View File

@ -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_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<td_api::ChatAction> &&action);
void delete_messages(DialogId dialog_id, const vector<MessageId> &message_ids, bool revoke, Promise<Unit> &&promise); void delete_messages(DialogId dialog_id, const vector<MessageId> &message_ids, bool revoke, Promise<Unit> &&promise);
void delete_dialog_history(DialogId dialog_id, bool remove_from_dialog_list, Promise<Unit> &&promise); void delete_dialog_history(DialogId dialog_id, bool remove_from_dialog_list, Promise<Unit> &&promise);

View File

@ -1497,7 +1497,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelWebPage>
update->pts_count_, "on_updateChannelWebPage"); update->pts_count_, "on_updateChannelWebPage");
} }
tl_object_ptr<td_api::ChatAction> UpdatesManager::convertSendMessageAction( tl_object_ptr<td_api::ChatAction> UpdatesManager::convert_send_message_action(
tl_object_ptr<telegram_api::SendMessageAction> action) { tl_object_ptr<telegram_api::SendMessageAction> action) {
auto fix_progress = [](int32 progress) { return progress <= 0 || progress > 100 ? 0 : progress; }; auto fix_progress = [](int32 progress) { return progress <= 0 || progress > 100 ? 0 : progress; };
@ -1554,10 +1554,8 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserTyping> upd
LOG(DEBUG) << "Ignore user typing in unknown " << dialog_id; LOG(DEBUG) << "Ignore user typing in unknown " << dialog_id;
return; return;
} }
send_closure(G()->td(), &Td::send_update, td_->messages_manager_->on_user_dialog_action(dialog_id, user_id,
make_tl_object<td_api::updateUserChatAction>( convert_send_message_action(std::move(update->action_)));
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateUserTyping"),
convertSendMessageAction(std::move(update->action_))));
} }
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping> update, bool /*force_apply*/) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping> update, bool /*force_apply*/) {
@ -1576,10 +1574,8 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChatUserTyping>
return; return;
} }
} }
send_closure(G()->td(), &Td::send_update, td_->messages_manager_->on_user_dialog_action(dialog_id, user_id,
make_tl_object<td_api::updateUserChatAction>( convert_send_message_action(std::move(update->action_)));
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateChatUserTyping"),
convertSendMessageAction(std::move(update->action_))));
} }
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTyping> update, bool /*force_apply*/) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTyping> update, bool /*force_apply*/) {
@ -1597,10 +1593,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTy
return; return;
} }
send_closure(G()->td(), &Td::send_update, td_->messages_manager_->on_user_dialog_action(dialog_id, user_id, make_tl_object<td_api::chatActionTyping>());
make_tl_object<td_api::updateUserChatAction>(
dialog_id.get(), td_->contacts_manager_->get_user_id_object(user_id, "updateEncryptedChatTyping"),
make_tl_object<td_api::chatActionTyping>()));
} }
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserStatus> update, bool /*force_apply*/) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserStatus> update, bool /*force_apply*/) {

View File

@ -139,7 +139,7 @@ class UpdatesManager : public Actor {
void set_date(int32 date, bool from_update, string date_source); void set_date(int32 date, bool from_update, string date_source);
static tl_object_ptr<td_api::ChatAction> convertSendMessageAction( static tl_object_ptr<td_api::ChatAction> convert_send_message_action(
tl_object_ptr<telegram_api::SendMessageAction> action); tl_object_ptr<telegram_api::SendMessageAction> action);
void process_get_difference_updates(vector<tl_object_ptr<telegram_api::Message>> &&new_messages, void process_get_difference_updates(vector<tl_object_ptr<telegram_api::Message>> &&new_messages,