diff options
author | Oleg Morozenkov <o.morozenkov@corp.mail.ru> | 2022-11-01 19:43:42 +0300 |
---|---|---|
committer | Oleg Morozenkov <o.morozenkov@corp.mail.ru> | 2022-11-01 19:43:42 +0300 |
commit | e96d3a3d4f023dc0d5d4e60fb8efb5a40ce7a71d (patch) | |
tree | f57f44b1448204120229bd83f3654b32e3df79ed /src/net/TgLongPoll.cpp | |
parent | 30136601c6755e5d7c2174ebd4ed49595e10a54b (diff) | |
parent | 7abb2509b87ef1344da97ae734211715f291cfa2 (diff) |
Merge remote-tracking branch 'llnulldisk/master' into merge-228
Diffstat (limited to 'src/net/TgLongPoll.cpp')
-rw-r--r-- | src/net/TgLongPoll.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net/TgLongPoll.cpp b/src/net/TgLongPoll.cpp index a7b4fcb..6a224cb 100644 --- a/src/net/TgLongPoll.cpp +++ b/src/net/TgLongPoll.cpp @@ -21,13 +21,19 @@ TgLongPoll::TgLongPoll(const Bot& bot, std::int32_t limit, std::int32_t timeout, } void TgLongPoll::start() { - std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowUpdates); + // get all unconfirmed updates + std::vector<Update::Ptr> updates = _api->getUpdates(0, _limit, _timeout, _allowUpdates); + + // handle updates for (Update::Ptr& item : updates) { if (item->updateId >= _lastUpdateId) { _lastUpdateId = item->updateId + 1; } _eventHandler->handleUpdate(item); } + + // confirm handled updates + _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowUpdates); } } |