summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2021-12-04 12:02:39 +0100
committerGitHub <noreply@github.com>2021-12-04 12:02:39 +0100
commit55d3fbca78774d7c033cd31860fd1d5f11dd2ad1 (patch)
tree25d44cf50526fab019b5495a83d4546198307413 /src
parent814ac074633125c975fa6979e79c93cc7115a57b (diff)
parent1b69e2be2564de979dd481772f3f7d489e957c2f (diff)
Merge pull request #188 from JellyBrick/patch-3
migrate(user-id): from 32-bit integer to 64-bit integer
Diffstat (limited to 'src')
-rw-r--r--src/Api.cpp22
-rw-r--r--src/TgTypeParser.cpp6
-rw-r--r--src/net/CurlHttpClient.cpp2
-rw-r--r--src/net/HttpParser.cpp6
4 files changed, 17 insertions, 19 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 08b102a..ff39805 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -312,7 +312,7 @@ StickerSet::Ptr Api::getStickerSet(const string& name) const {
return _tgTypeParser.parseJsonAndGetStickerSet(sendRequest("getStickerSet", args));
}
-File::Ptr Api::uploadStickerFile(std::int32_t userId, const InputFile::Ptr pngSticker) const {
+File::Ptr Api::uploadStickerFile(std::int64_t userId, const InputFile::Ptr pngSticker) const {
vector<HttpReqArg> args;
args.reserve(2);
args.emplace_back("user_id", userId);
@@ -320,7 +320,7 @@ File::Ptr Api::uploadStickerFile(std::int32_t userId, const InputFile::Ptr pngSt
return _tgTypeParser.parseJsonAndGetFile(sendRequest("uploadStickerFile", args));
}
-bool Api::createNewStickerSet(std::int32_t userId, const string& name, const string& title, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, bool containsMasks, MaskPosition::Ptr maskPosition) const {
+bool Api::createNewStickerSet(std::int64_t userId, const string& name, const string& title, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, bool containsMasks, MaskPosition::Ptr maskPosition) const {
vector<HttpReqArg> args;
args.reserve(7);
args.emplace_back("user_id", userId);
@@ -342,7 +342,7 @@ bool Api::createNewStickerSet(std::int32_t userId, const string& name, const str
return sendRequest("createNewStickerSet", args).get<bool>("", false);
}
-bool Api::addStickerToSet(std::int32_t userId, const string& name, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, MaskPosition::Ptr maskPosition) const {
+bool Api::addStickerToSet(std::int64_t userId, const string& name, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, MaskPosition::Ptr maskPosition) const {
vector<HttpReqArg> args;
args.reserve(6);
args.emplace_back("user_id", userId);
@@ -698,7 +698,7 @@ void Api::sendChatAction(std::int64_t chatId, const string& action) const {
sendRequest("sendChatAction", args);
}
-UserProfilePhotos::Ptr Api::getUserProfilePhotos(std::int32_t userId, std::int32_t offset, std::int32_t limit) const {
+UserProfilePhotos::Ptr Api::getUserProfilePhotos(std::int64_t userId, std::int32_t offset, std::int32_t limit) const {
vector<HttpReqArg> args;
args.reserve(3);
args.emplace_back("user_id", userId);
@@ -875,7 +875,7 @@ Message::Ptr Api::editMessageMedia(InputMedia::Ptr media, std::int64_t chatId, s
}
}
-ChatMember::Ptr Api::getChatMember(std::int64_t chatId, std::int32_t userId) const {
+ChatMember::Ptr Api::getChatMember(std::int64_t chatId, std::int64_t userId) const {
vector<HttpReqArg> args;
args.reserve(2);
args.emplace_back("chat_id", chatId);
@@ -970,7 +970,7 @@ bool Api::answerInlineQuery(const string& inlineQueryId, const std::vector<Inlin
return sendRequest("answerInlineQuery", args).get<bool>("", false);
}
-bool Api::kickChatMember(std::int64_t chatId, std::int32_t userId, std::uint64_t untilDate) const {
+bool Api::kickChatMember(std::int64_t chatId, std::int64_t userId, std::uint64_t untilDate) const {
vector<HttpReqArg> args;
args.reserve(3);
args.emplace_back("chat_id", chatId);
@@ -981,14 +981,14 @@ bool Api::kickChatMember(std::int64_t chatId, std::int32_t userId, std::uint64_t
return sendRequest("kickChatMember", args).get<bool>("", false);
}
-bool Api::unbanChatMember(std::int64_t chatId, std::int32_t userId) const {
+bool Api::unbanChatMember(std::int64_t chatId, std::int64_t userId) const {
vector<HttpReqArg> args;
args.reserve(2);
args.emplace_back("chat_id", chatId);
args.emplace_back("user_id", userId);
return sendRequest("unbanChatMember", args).get<bool>("", false);
}
-bool Api::restrictChatMember(std::int64_t chatId, std::int32_t userId, TgBot::ChatPermissions::Ptr permissions,
+bool Api::restrictChatMember(std::int64_t chatId, std::int64_t userId, TgBot::ChatPermissions::Ptr permissions,
std::uint64_t untilDate) const {
vector<HttpReqArg> args;
args.reserve(4);
@@ -1002,7 +1002,7 @@ bool Api::restrictChatMember(std::int64_t chatId, std::int32_t userId, TgBot::Ch
return sendRequest("restrictChatMember", args).get<bool>("", false);
}
-bool Api::promoteChatMember(std::int64_t chatId, std::int32_t userId, bool canChangeInfo, bool canPostMessages,
+bool Api::promoteChatMember(std::int64_t chatId, std::int64_t userId, bool canChangeInfo, bool canPostMessages,
bool canEditMessages, bool canDeleteMessages, bool canInviteUsers, bool canPinMessages, bool canPromoteMembers) const {
vector<HttpReqArg> args;
args.reserve(9);
@@ -1096,7 +1096,7 @@ bool Api::unpinChatMessage(std::int64_t chatId) const {
return sendRequest("unpinChatMessage", args).get<bool>("", false);
}
-Message::Ptr Api::setGameScore(std::int32_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const {
+Message::Ptr Api::setGameScore(std::int64_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const {
vector<HttpReqArg> args;
args.reserve(7);
args.emplace_back("user_id", userId);
@@ -1119,7 +1119,7 @@ Message::Ptr Api::setGameScore(std::int32_t userId, std::int32_t score, bool for
return _tgTypeParser.parseJsonAndGetMessage(sendRequest("setGameScore", args));
}
-vector<GameHighScore::Ptr> Api::getGameHighScores(std::int32_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const {
+vector<GameHighScore::Ptr> Api::getGameHighScores(std::int64_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const {
vector<HttpReqArg> args;
args.reserve(7);
args.emplace_back("user_id", userId);
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 95c60c9..b96068e 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -63,7 +63,7 @@ string TgTypeParser::parseChat(const Chat::Ptr& object) const {
User::Ptr TgTypeParser::parseJsonAndGetUser(const ptree& data) const {
auto result(make_shared<User>());
- result->id = data.get<int32_t>("id");
+ result->id = data.get<int64_t>("id");
result->isBot = data.get<bool>("is_bot", false);
result->firstName = data.get<string>("first_name");
result->lastName = data.get("last_name", "");
@@ -613,7 +613,7 @@ Contact::Ptr TgTypeParser::parseJsonAndGetContact(const ptree& data) const {
result->phoneNumber = data.get<string>("phone_number");
result->firstName = data.get<string>("first_name");
result->lastName = data.get("last_name", "");
- result->userId = data.get("user_id", "");
+ result->userId = data.get("user_id", 0);
result->vcard = data.get("vcard", "");
return result;
}
@@ -988,7 +988,7 @@ std::string TgTypeParser::parseChatPhoto(const ChatPhoto::Ptr& object) const {
ResponseParameters::Ptr TgTypeParser::parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const {
auto result(make_shared<ResponseParameters>());
- result->migrateToChatId = data.get<int32_t>("migrate_to_chat_id", 0);
+ result->migrateToChatId = data.get<int64_t>("migrate_to_chat_id", 0);
result->retryAfter = data.get<int32_t>("retry_after", 0);
return result;
}
diff --git a/src/net/CurlHttpClient.cpp b/src/net/CurlHttpClient.cpp
index 13973cc..ff06138 100644
--- a/src/net/CurlHttpClient.cpp
+++ b/src/net/CurlHttpClient.cpp
@@ -2,8 +2,6 @@
#include "tgbot/net/CurlHttpClient.h"
-#include <boost/asio/ssl.hpp>
-
#include <cstddef>
#include <string>
diff --git a/src/net/HttpParser.cpp b/src/net/HttpParser.cpp
index cc9b84b..246c47c 100644
--- a/src/net/HttpParser.cpp
+++ b/src/net/HttpParser.cpp
@@ -57,11 +57,11 @@ string HttpParser::generateRequest(const Url& url, const vector<HttpReqArg>& arg
return result;
}
-string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, const string& bondary) const {
+string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, const string& boundary) const {
string result;
for (const HttpReqArg& item : args) {
result += "--";
- result += bondary;
+ result += boundary;
result += "\r\nContent-Disposition: form-data; name=\"";
result += item.name;
if (item.isFile) {
@@ -77,7 +77,7 @@ string HttpParser::generateMultipartFormData(const vector<HttpReqArg>& args, con
result += item.value;
result += "\r\n";
}
- result += "--" + bondary + "--\r\n";
+ result += "--" + boundary + "--\r\n";
return result;
}