From 89fa0f64466357ee2db67843682f7a42f296d29b Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 5 Jan 2021 12:41:35 +0300 Subject: [PATCH] Add get_update_qts/get_update_pts. --- td/telegram/UpdatesManager.cpp | 38 ++++++++++++++++++++++++++++++++-- td/telegram/UpdatesManager.h | 4 ++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index e9f90b6a6..26b7f9428 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1449,8 +1449,8 @@ void UpdatesManager::on_pending_updates(vectorget_id()) { + case telegram_api::updateNewMessage::ID: + return static_cast(update)->pts_; + case telegram_api::updateReadMessagesContents::ID: + return static_cast(update)->pts_; + case telegram_api::updateEditMessage::ID: + return static_cast(update)->pts_; + case telegram_api::updateDeleteMessages::ID: + return static_cast(update)->pts_; + case telegram_api::updateReadHistoryInbox::ID: + return static_cast(update)->pts_; + case telegram_api::updateReadHistoryOutbox::ID: + return static_cast(update)->pts_; + case telegram_api::updateWebPage::ID: + return static_cast(update)->pts_; + case telegram_api::updatePinnedMessages::ID: + return static_cast(update)->pts_; + default: + return 0; + } +} + +int32 UpdatesManager::get_update_qts(const telegram_api::Update *update) { + switch (update->get_id()) { + case telegram_api::updateNewEncryptedMessage::ID: + return static_cast(update)->qts_; + case telegram_api::updateChannelParticipant::ID: + return static_cast(update)->qts_; + default: + return 0; + } +} + void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/, Promise &&promise) { UserId user_id(update->user_id_); diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index 09c5d9635..1f42d3a30 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -190,6 +190,10 @@ class UpdatesManager : public Actor { void after_get_difference(); + static int32 get_update_pts(const telegram_api::Update *update); + + static int32 get_update_qts(const telegram_api::Update *update); + static const vector> *get_updates(const telegram_api::Updates *updates_ptr); bool is_acceptable_user(UserId user_id) const;