summaryrefslogtreecommitdiff
path: root/src/net/TgLongPoll.cpp
diff options
context:
space:
mode:
authorMio <a771644612@live.com>2018-03-20 15:10:39 +0800
committerMio <a771644612@live.com>2018-03-20 15:10:39 +0800
commit81ab7f5e8929589b352a5f621cfb98fcb2929cec (patch)
tree6333697d3082886ef3c32a121c65d82936a3fd2c /src/net/TgLongPoll.cpp
parent59b1f98679bd4f9b21cc92a861db6655ec314605 (diff)
Make TgLongPoll constructed with user-specified parameters for getUpdates() instead of hard-code
Diffstat (limited to 'src/net/TgLongPoll.cpp')
-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..8d93991 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>>& stringarrayptr)
+ : _api(api), _eventHandler(eventHandler), _limit(limit), _timeout(timeout), _stringarrayptr(stringarrayptr) {
}
-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>>& stringarrayptr) :
+ TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, stringarrayptr) {
}
void TgLongPoll::start() {
- std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, 100, 60);
+ std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _stringarrayptr);
for (Update::Ptr& item : updates) {
if (item->updateId >= _lastUpdateId) {
_lastUpdateId = item->updateId + 1;