diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/CurlHttpClient.cpp | 8 | ||||
-rw-r--r-- | src/net/HttpParser.cpp | 1 | ||||
-rw-r--r-- | src/net/TgLongPoll.cpp | 12 | ||||
-rw-r--r-- | src/net/Url.cpp | 2 |
4 files changed, 11 insertions, 12 deletions
diff --git a/src/net/CurlHttpClient.cpp b/src/net/CurlHttpClient.cpp index 5bd9313..6255974 100644 --- a/src/net/CurlHttpClient.cpp +++ b/src/net/CurlHttpClient.cpp @@ -17,9 +17,9 @@ CurlHttpClient::~CurlHttpClient() { } static std::size_t curlWriteString(char* ptr, std::size_t size, std::size_t nmemb, void* userdata) { - static_cast<std::string *>(userdata)->append(ptr, size * nmemb); + static_cast<std::string*>(userdata)->append(ptr, size * nmemb); return size * nmemb; -}; +} std::string CurlHttpClient::makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const { // Copy settings for each call because we change CURLOPT_URL and other stuff. @@ -34,8 +34,8 @@ std::string CurlHttpClient::makeRequest(const Url& url, const std::vector<HttpRe headers = curl_slist_append(headers, "Connection: close"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - curl_mime *mime; - curl_mimepart *part; + curl_mime* mime; + curl_mimepart* part; mime = curl_mime_init(curl); if (!args.empty()) { for (const HttpReqArg& a : args) { diff --git a/src/net/HttpParser.cpp b/src/net/HttpParser.cpp index 8006c85..2d3085f 100644 --- a/src/net/HttpParser.cpp +++ b/src/net/HttpParser.cpp @@ -81,7 +81,6 @@ string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, con string HttpParser::generateMultipartBoundary(const vector<HttpReqArg>& args) const { string result; - srand((std::uint32_t) time(nullptr)); for (const HttpReqArg& item : args) { if (item.isFile) { while (result.empty() || item.value.find(result) != string::npos) { 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 <cstdint> +#include <utility> namespace TgBot { -TgLongPoll::TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t limit, std::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 Api* api, const EventHandler* eventHandler, std::int32_t limit, std::int32_t timeout, std::shared_ptr<std::vector<std::string>> 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<std::vector<std::string>>& 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<std::vector<std::string>>& allowUpdates) : + TgLongPoll(&bot.getApi(), &bot.getEventHandler(), limit, timeout, allowUpdates) { } void TgLongPoll::start() { - std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowupdates); + std::vector<Update::Ptr> updates = _api->getUpdates(_lastUpdateId, _limit, _timeout, _allowUpdates); for (Update::Ptr& item : updates) { if (item->updateId >= _lastUpdateId) { _lastUpdateId = item->updateId + 1; diff --git a/src/net/Url.cpp b/src/net/Url.cpp index 016a97f..95e31c7 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -2,8 +2,6 @@ #include <cstddef> -#include "tgbot/tools/StringTools.h" - using namespace std; namespace TgBot { |