Process channel PTS updates during getDifference.

This commit is contained in:
levlam 2022-06-28 16:39:32 +03:00
parent 26fdb92dd8
commit faaf8f10f9
2 changed files with 17 additions and 0 deletions

View File

@ -1904,6 +1904,9 @@ void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Updat
}
downcast_call(*update, OnUpdate(this, update, get_promise()));
update = nullptr;
} else if (is_channel_pts_update(update.get())) {
downcast_call(*update, OnUpdate(this, update, get_promise()));
update = nullptr;
}
}
}
@ -3051,6 +3054,18 @@ int32 UpdatesManager::get_update_qts(const telegram_api::Update *update) {
}
}
bool UpdatesManager::is_channel_pts_update(const telegram_api::Update *update) {
switch (update->get_id()) {
case telegram_api::updateNewChannelMessage::ID:
case telegram_api::updateEditChannelMessage::ID:
case telegram_api::updateDeleteChannelMessages::ID:
case telegram_api::updatePinnedChannelMessages::ID:
return true;
default:
return false;
}
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateUserTyping> update, Promise<Unit> &&promise) {
DialogId dialog_id(UserId(update->user_id_));
td_->messages_manager_->on_dialog_action(dialog_id, MessageId(), dialog_id, DialogAction(std::move(update->action_)),

View File

@ -357,6 +357,8 @@ class UpdatesManager final : public Actor {
static int32 get_update_qts(const telegram_api::Update *update);
static bool is_channel_pts_update(const telegram_api::Update *update);
static const vector<tl_object_ptr<telegram_api::Update>> *get_updates(const telegram_api::Updates *updates_ptr);
static vector<tl_object_ptr<telegram_api::Update>> *get_updates(telegram_api::Updates *updates_ptr);