From 64174491dac84c559db5c48ed850177fa3eb4da0 Mon Sep 17 00:00:00 2001 From: jellybrick Date: Sat, 14 Mar 2020 23:21:30 +0900 Subject: Fix #127, #128 & Code quality improvements It seems that the author of this code misunderstood 'Array of PollOption' as 'PollOption'. --- src/net/TgLongPoll.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/net/TgLongPoll.cpp') diff --git a/src/net/TgLongPoll.cpp b/src/net/TgLongPoll.cpp index 0138620..6d266f8 100644 --- a/src/net/TgLongPoll.cpp +++ b/src/net/TgLongPoll.cpp @@ -1,19 +1,21 @@ #include "tgbot/net/TgLongPoll.h" #include +#include namespace TgBot { -TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout, const std::shared_ptr>& allowupdates) - : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), _allowupdates(allowupdates) { +TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout, std::shared_ptr> allowUpdates) + : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), + _allowUpdates(std::move(allowUpdates)) { } -TgLongPoll::TgLongPoll(const Bot& bot, std::int32_t limit, std::int32_t timeout, const std::shared_ptr>& allowupdates) : - TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowupdates) { +TgLongPoll::TgLongPoll(const Bot& bot, std::int32_t limit, std::int32_t timeout, const std::shared_ptr>& allowUpdates) : + TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowUpdates) { } void TgLongPoll::start() { - std::vector updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowupdates); + std::vector updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowUpdates); for (Update::Ptr& item : updates) { if (item->updateId >= _lastUpdateId) { _lastUpdateId = item->updateId + 1; -- cgit v1.2.3