summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOleg Morozenkov <omorozenkov@gmail.com>2018-04-01 03:09:34 +0300
committerGitHub <noreply@github.com>2018-04-01 03:09:34 +0300
commit525861d940f2361531e4cd61b831a94f7d079ea9 (patch)
treeab18481c4775b76c7e021c5b36d272709cb1776d /src
parent59b1f98679bd4f9b21cc92a861db6655ec314605 (diff)
parent297e5bc0f8cb6a7fd0f3fbf1a722da7d47d6dea3 (diff)
Merge pull request #58 from wtdcode/master
remove hard-code parameters in TgLongPoll() for getUpdates()
Diffstat (limited to 'src')
-rw-r--r--src/net/TgLongPoll.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/net/TgLongPoll.cpp b/src/net/TgLongPoll.cpp
index 91bf058..30ce815 100644
--- a/src/net/TgLongPoll.cpp
+++ b/src/net/TgLongPoll.cpp
@@ -24,14 +24,16 @@
namespace TgBot {
-TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler) : _api(api), _eventHandler(eventHandler) {
+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) {
}
-TgLongPoll::TgLongPoll(const Bot& bot) : TgLongPoll(&bot.getApi(), &bot.getEventHandler()) {
+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) {
}
void TgLongPoll::start() {
- std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, 100, 60);
+ std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowupdates);
for (Update::Ptr& item : updates) {
if (item->updateId >= _lastUpdateId) {
_lastUpdateId = item->updateId + 1;