summaryrefslogtreecommitdiff
path: root/src/net/TgLongPoll.cpp
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2018-07-23 02:35:50 +0300
committerOleg Morozenkov <m@oleg.rocks>2018-07-23 02:35:50 +0300
commit98b8b7e4338b71ee46c4301b0bf2ae667be9a99d (patch)
tree32f8b0d32048b2d83b57773c0efa3db9600b8701 /src/net/TgLongPoll.cpp
parent1dd3affe306793d2129f121c11e43c45ae8690da (diff)
parent167e3e7607e43a0f06c7f87ced94f481e6525b0e (diff)
Merge branch 'master' into nicholascw-master
Diffstat (limited to 'src/net/TgLongPoll.cpp')
-rw-r--r--src/net/TgLongPoll.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/net/TgLongPoll.cpp b/src/net/TgLongPoll.cpp
index 30ce815..6af8a62 100644
--- a/src/net/TgLongPoll.cpp
+++ b/src/net/TgLongPoll.cpp
@@ -25,21 +25,21 @@
namespace TgBot {
TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, int32_t limit, int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates)
- : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), _allowupdates(allowupdates) {
+ : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), _allowupdates(allowupdates) {
}
TgLongPoll::TgLongPoll(const Bot& bot, int32_t limit, int32_t timeout, const std::shared_ptr<std::vector<std::string>>& allowupdates) :
- TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowupdates) {
+ TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowupdates) {
}
void TgLongPoll::start() {
- std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowupdates);
- for (Update::Ptr& item : updates) {
- if (item->updateId >= _lastUpdateId) {
- _lastUpdateId = item->updateId + 1;
- }
- _eventHandler->handleUpdate(item);
- }
+ std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowupdates);
+ for (Update::Ptr& item : updates) {
+ if (item->updateId >= _lastUpdateId) {
+ _lastUpdateId = item->updateId + 1;
+ }
+ _eventHandler->handleUpdate(item);
+ }
}
}