Move class OnUpdate inside UpdatesManager.

This commit is contained in:
levlam 2024-08-16 16:38:25 +03:00
parent 52f24d72f5
commit 9858220708
2 changed files with 17 additions and 18 deletions

View File

@ -108,23 +108,6 @@ namespace td {
int VERBOSITY_NAME(get_difference) = VERBOSITY_NAME(INFO);
class OnUpdate {
UpdatesManager *updates_manager_;
tl_object_ptr<telegram_api::Update> &update_;
mutable Promise<Unit> promise_;
public:
OnUpdate(UpdatesManager *updates_manager, tl_object_ptr<telegram_api::Update> &update, Promise<Unit> &&promise)
: updates_manager_(updates_manager), update_(update), promise_(std::move(promise)) {
}
template <class T>
void operator()(T &obj) const {
CHECK(&*update_ == &obj);
updates_manager_->on_update(move_tl_object_as<T>(update_), std::move(promise_));
}
};
class GetUpdatesStateQuery final : public Td::ResultHandler {
Promise<tl_object_ptr<telegram_api::updates_state>> promise_;

View File

@ -149,7 +149,23 @@ class UpdatesManager final : public Actor {
static constexpr bool DROP_PTS_UPDATES = false;
static constexpr const char *AFTER_GET_DIFFERENCE_SOURCE = "after get difference";
friend class OnUpdate;
class OnUpdate {
UpdatesManager *updates_manager_;
telegram_api::object_ptr<telegram_api::Update> &update_;
mutable Promise<Unit> promise_;
public:
OnUpdate(UpdatesManager *updates_manager, telegram_api::object_ptr<telegram_api::Update> &update,
Promise<Unit> &&promise)
: updates_manager_(updates_manager), update_(update), promise_(std::move(promise)) {
}
template <class T>
void operator()(T &obj) const {
CHECK(&*update_ == &obj);
updates_manager_->on_update(move_tl_object_as<T>(update_), std::move(promise_));
}
};
class PendingPtsUpdate {
public: