diff --git a/build.html b/build.html
index dd5030c..409fb28 100644
--- a/build.html
+++ b/build.html
@@ -678,7 +678,7 @@ function onOptionsChanged() {
document.getElementById('buildCommands').innerHTML = '
- ' + commands.join('
- ') + '
';
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
}
-
+
function copyBuildInstructions() {
var text = document.getElementById('buildCommands').innerText;
diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp
index 9f945b4..aec0787 100644
--- a/telegram-bot-api/Client.cpp
+++ b/telegram-bot-api/Client.cpp
@@ -8,11 +8,11 @@
#include "telegram-bot-api/ClientParameters.h"
+#include "td/db/TQueue.h"
+
#include "td/actor/PromiseFuture.h"
#include "td/actor/SleepActor.h"
-#include "td/db/TQueue.h"
-
#include "td/utils/algorithm.h"
#include "td/utils/base64.h"
#include "td/utils/filesystem.h"
@@ -23,7 +23,6 @@
#include "td/utils/PathView.h"
#include "td/utils/port/path.h"
#include "td/utils/port/Stat.h"
-#include "td/utils/Random.h"
#include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/Span.h"
@@ -276,7 +275,7 @@ bool Client::init_methods() {
return true;
}
-class Client::JsonFile : public Jsonable {
+class Client::JsonFile final : public Jsonable {
public:
JsonFile(const td_api::file *file, const Client *client) : file_(file), client_(client) {
}
@@ -290,7 +289,7 @@ class Client::JsonFile : public Jsonable {
const Client *client_;
};
-class Client::JsonDatedFile : public Jsonable {
+class Client::JsonDatedFile final : public Jsonable {
public:
JsonDatedFile(const td_api::datedFile *file, const Client *client) : file_(file), client_(client) {
}
@@ -305,7 +304,7 @@ class Client::JsonDatedFile : public Jsonable {
const Client *client_;
};
-class Client::JsonDatedFiles : public Jsonable {
+class Client::JsonDatedFiles final : public Jsonable {
public:
JsonDatedFiles(const td::vector> &files, const Client *client)
: files_(files), client_(client) {
@@ -322,7 +321,7 @@ class Client::JsonDatedFiles : public Jsonable {
const Client *client_;
};
-class Client::JsonUser : public Jsonable {
+class Client::JsonUser final : public Jsonable {
public:
JsonUser(int64 user_id, const Client *client, bool full_bot_info = false)
: user_id_(user_id), client_(client), full_bot_info_(full_bot_info) {
@@ -356,7 +355,7 @@ class Client::JsonUser : public Jsonable {
bool full_bot_info_;
};
-class Client::JsonUsers : public Jsonable {
+class Client::JsonUsers final : public Jsonable {
public:
JsonUsers(const td::vector &user_ids, const Client *client) : user_ids_(user_ids), client_(client) {
}
@@ -372,7 +371,7 @@ class Client::JsonUsers : public Jsonable {
const Client *client_;
};
-class Client::JsonEntity : public Jsonable {
+class Client::JsonEntity final : public Jsonable {
public:
JsonEntity(const td_api::textEntity *entity, const Client *client) : entity_(entity), client_(client) {
}
@@ -454,7 +453,7 @@ class Client::JsonEntity : public Jsonable {
const Client *client_;
};
-class Client::JsonVectorEntities : public Jsonable {
+class Client::JsonVectorEntities final : public Jsonable {
public:
JsonVectorEntities(const td::vector> &entities, const Client *client)
: entities_(entities), client_(client) {
@@ -475,7 +474,7 @@ class Client::JsonVectorEntities : public Jsonable {
const Client *client_;
};
-class Client::JsonLocation : public Jsonable {
+class Client::JsonLocation final : public Jsonable {
public:
explicit JsonLocation(const td_api::location *location, double expires_in = 0.0, int32 live_period = 0,
int32 heading = 0, int32 proximity_alert_radius = 0)
@@ -511,7 +510,7 @@ class Client::JsonLocation : public Jsonable {
int32 proximity_alert_radius_;
};
-class Client::JsonChatPermissions : public Jsonable {
+class Client::JsonChatPermissions final : public Jsonable {
public:
explicit JsonChatPermissions(const td_api::chatPermissions *chat_permissions) : chat_permissions_(chat_permissions) {
}
@@ -524,7 +523,7 @@ class Client::JsonChatPermissions : public Jsonable {
const td_api::chatPermissions *chat_permissions_;
};
-class Client::JsonChatPhotoInfo : public Jsonable {
+class Client::JsonChatPhotoInfo final : public Jsonable {
public:
explicit JsonChatPhotoInfo(const td_api::chatPhotoInfo *chat_photo) : chat_photo_(chat_photo) {
}
@@ -540,7 +539,7 @@ class Client::JsonChatPhotoInfo : public Jsonable {
const td_api::chatPhotoInfo *chat_photo_;
};
-class Client::JsonChatLocation : public Jsonable {
+class Client::JsonChatLocation final : public Jsonable {
public:
explicit JsonChatLocation(const td_api::chatLocation *chat_location) : chat_location_(chat_location) {
}
@@ -554,7 +553,7 @@ class Client::JsonChatLocation : public Jsonable {
const td_api::chatLocation *chat_location_;
};
-class Client::JsonChatInviteLink : public Jsonable {
+class Client::JsonChatInviteLink final : public Jsonable {
public:
JsonChatInviteLink(const td_api::chatInviteLink *chat_invite_link, const Client *client)
: chat_invite_link_(chat_invite_link), client_(client) {
@@ -585,7 +584,7 @@ class Client::JsonChatInviteLink : public Jsonable {
const Client *client_;
};
-class Client::JsonMessage : public Jsonable {
+class Client::JsonMessage final : public Jsonable {
public:
JsonMessage(const MessageInfo *message, bool need_reply, const td::string &source, const Client *client)
: message_(message), need_reply_(need_reply), source_(source), client_(client) {
@@ -610,7 +609,7 @@ class Client::JsonMessage : public Jsonable {
}
};
-class Client::JsonChat : public Jsonable {
+class Client::JsonChat final : public Jsonable {
public:
JsonChat(int64 chat_id, bool is_full, const Client *client, int64 pinned_message_id = -1)
: chat_id_(chat_id), is_full_(is_full), client_(client), pinned_message_id_(pinned_message_id) {
@@ -746,7 +745,7 @@ class Client::JsonChat : public Jsonable {
int64 pinned_message_id_;
};
-class Client::JsonMessageSender : public Jsonable {
+class Client::JsonMessageSender final : public Jsonable {
public:
JsonMessageSender(const td_api::MessageSender *sender_id, const Client *client)
: sender_id_(sender_id), client_(client) {
@@ -774,7 +773,7 @@ class Client::JsonMessageSender : public Jsonable {
const Client *client_;
};
-class Client::JsonMessages : public Jsonable {
+class Client::JsonMessages final : public Jsonable {
public:
explicit JsonMessages(const td::vector &messages) : messages_(messages) {
}
@@ -789,7 +788,7 @@ class Client::JsonMessages : public Jsonable {
const td::vector &messages_;
};
-class Client::JsonAnimation : public Jsonable {
+class Client::JsonAnimation final : public Jsonable {
public:
JsonAnimation(const td_api::animation *animation, bool as_document, const Client *client)
: animation_(animation), as_document_(as_document), client_(client) {
@@ -817,7 +816,7 @@ class Client::JsonAnimation : public Jsonable {
const Client *client_;
};
-class Client::JsonAudio : public Jsonable {
+class Client::JsonAudio final : public Jsonable {
public:
JsonAudio(const td_api::audio *audio, const Client *client) : audio_(audio), client_(client) {
}
@@ -845,7 +844,7 @@ class Client::JsonAudio : public Jsonable {
const Client *client_;
};
-class Client::JsonDocument : public Jsonable {
+class Client::JsonDocument final : public Jsonable {
public:
JsonDocument(const td_api::document *document, const Client *client) : document_(document), client_(client) {
}
@@ -866,7 +865,7 @@ class Client::JsonDocument : public Jsonable {
const Client *client_;
};
-class Client::JsonPhotoSize : public Jsonable {
+class Client::JsonPhotoSize final : public Jsonable {
public:
JsonPhotoSize(const td_api::photoSize *photo_size, const Client *client) : photo_size_(photo_size), client_(client) {
}
@@ -882,7 +881,7 @@ class Client::JsonPhotoSize : public Jsonable {
const Client *client_;
};
-class Client::JsonThumbnail : public Jsonable {
+class Client::JsonThumbnail final : public Jsonable {
public:
JsonThumbnail(const td_api::thumbnail *thumbnail, const Client *client) : thumbnail_(thumbnail), client_(client) {
}
@@ -898,7 +897,7 @@ class Client::JsonThumbnail : public Jsonable {
const Client *client_;
};
-class Client::JsonPhoto : public Jsonable {
+class Client::JsonPhoto final : public Jsonable {
public:
JsonPhoto(const td_api::photo *photo, const Client *client) : photo_(photo), client_(client) {
}
@@ -916,7 +915,7 @@ class Client::JsonPhoto : public Jsonable {
const Client *client_;
};
-class Client::JsonChatPhoto : public Jsonable {
+class Client::JsonChatPhoto final : public Jsonable {
public:
JsonChatPhoto(const td_api::chatPhoto *photo, const Client *client) : photo_(photo), client_(client) {
}
@@ -934,7 +933,7 @@ class Client::JsonChatPhoto : public Jsonable {
const Client *client_;
};
-class Client::JsonMaskPosition : public Jsonable {
+class Client::JsonMaskPosition final : public Jsonable {
public:
explicit JsonMaskPosition(const td_api::maskPosition *mask_position) : mask_position_(mask_position) {
}
@@ -950,7 +949,7 @@ class Client::JsonMaskPosition : public Jsonable {
const td_api::maskPosition *mask_position_;
};
-class Client::JsonSticker : public Jsonable {
+class Client::JsonSticker final : public Jsonable {
public:
JsonSticker(const td_api::sticker *sticker, const Client *client) : sticker_(sticker), client_(client) {
}
@@ -978,7 +977,7 @@ class Client::JsonSticker : public Jsonable {
const Client *client_;
};
-class Client::JsonStickers : public Jsonable {
+class Client::JsonStickers final : public Jsonable {
public:
JsonStickers(const td::vector> &stickers, const Client *client)
: stickers_(stickers), client_(client) {
@@ -995,7 +994,7 @@ class Client::JsonStickers : public Jsonable {
const Client *client_;
};
-class Client::JsonVideo : public Jsonable {
+class Client::JsonVideo final : public Jsonable {
public:
JsonVideo(const td_api::video *video, const Client *client) : video_(video), client_(client) {
}
@@ -1019,7 +1018,7 @@ class Client::JsonVideo : public Jsonable {
const Client *client_;
};
-class Client::JsonVideoNote : public Jsonable {
+class Client::JsonVideoNote final : public Jsonable {
public:
JsonVideoNote(const td_api::videoNote *video_note, const Client *client) : video_note_(video_note), client_(client) {
}
@@ -1036,7 +1035,7 @@ class Client::JsonVideoNote : public Jsonable {
const Client *client_;
};
-class Client::JsonVoiceNote : public Jsonable {
+class Client::JsonVoiceNote final : public Jsonable {
public:
JsonVoiceNote(const td_api::voiceNote *voice_note, const Client *client) : voice_note_(voice_note), client_(client) {
}
@@ -1054,7 +1053,7 @@ class Client::JsonVoiceNote : public Jsonable {
const Client *client_;
};
-class Client::JsonVenue : public Jsonable {
+class Client::JsonVenue final : public Jsonable {
public:
explicit JsonVenue(const td_api::venue *venue) : venue_(venue) {
}
@@ -1085,7 +1084,7 @@ class Client::JsonVenue : public Jsonable {
const td_api::venue *venue_;
};
-class Client::JsonContact : public Jsonable {
+class Client::JsonContact final : public Jsonable {
public:
explicit JsonContact(const td_api::contact *contact) : contact_(contact) {
}
@@ -1108,7 +1107,7 @@ class Client::JsonContact : public Jsonable {
const td_api::contact *contact_;
};
-class Client::JsonDice : public Jsonable {
+class Client::JsonDice final : public Jsonable {
public:
JsonDice(const td::string &emoji, int32 value) : emoji_(emoji), value_(value) {
}
@@ -1123,7 +1122,7 @@ class Client::JsonDice : public Jsonable {
int32 value_;
};
-class Client::JsonGame : public Jsonable {
+class Client::JsonGame final : public Jsonable {
public:
JsonGame(const td_api::game *game, const Client *client) : game_(game), client_(client) {
}
@@ -1149,7 +1148,7 @@ class Client::JsonGame : public Jsonable {
const Client *client_;
};
-class Client::JsonInvoice : public Jsonable {
+class Client::JsonInvoice final : public Jsonable {
public:
explicit JsonInvoice(const td_api::messageInvoice *invoice) : invoice_(invoice) {
}
@@ -1170,7 +1169,7 @@ class Client::JsonInvoice : public Jsonable {
const td_api::messageInvoice *invoice_;
};
-class Client::JsonPollOption : public Jsonable {
+class Client::JsonPollOption final : public Jsonable {
public:
explicit JsonPollOption(const td_api::pollOption *option) : option_(option) {
}
@@ -1185,7 +1184,7 @@ class Client::JsonPollOption : public Jsonable {
const td_api::pollOption *option_;
};
-class Client::JsonPoll : public Jsonable {
+class Client::JsonPoll final : public Jsonable {
public:
JsonPoll(const td_api::poll *poll, const Client *client) : poll_(poll), client_(client) {
}
@@ -1232,7 +1231,7 @@ class Client::JsonPoll : public Jsonable {
const Client *client_;
};
-class Client::JsonPollAnswer : public Jsonable {
+class Client::JsonPollAnswer final : public Jsonable {
public:
JsonPollAnswer(const td_api::updatePollAnswer *poll_answer, const Client *client)
: poll_answer_(poll_answer), client_(client) {
@@ -1249,7 +1248,7 @@ class Client::JsonPollAnswer : public Jsonable {
const Client *client_;
};
-class Client::JsonAddress : public Jsonable {
+class Client::JsonAddress final : public Jsonable {
public:
explicit JsonAddress(const td_api::address *address) : address_(address) {
}
@@ -1267,7 +1266,7 @@ class Client::JsonAddress : public Jsonable {
const td_api::address *address_;
};
-class Client::JsonOrderInfo : public Jsonable {
+class Client::JsonOrderInfo final : public Jsonable {
public:
explicit JsonOrderInfo(const td_api::orderInfo *order_info) : order_info_(order_info) {
}
@@ -1291,7 +1290,7 @@ class Client::JsonOrderInfo : public Jsonable {
const td_api::orderInfo *order_info_;
};
-class Client::JsonSuccessfulPaymentBot : public Jsonable {
+class Client::JsonSuccessfulPaymentBot final : public Jsonable {
public:
explicit JsonSuccessfulPaymentBot(const td_api::messagePaymentSuccessfulBot *successful_payment)
: successful_payment_(successful_payment) {
@@ -1321,7 +1320,7 @@ class Client::JsonSuccessfulPaymentBot : public Jsonable {
const td_api::messagePaymentSuccessfulBot *successful_payment_;
};
-class Client::JsonEncryptedPassportElement : public Jsonable {
+class Client::JsonEncryptedPassportElement final : public Jsonable {
public:
JsonEncryptedPassportElement(const td_api::encryptedPassportElement *element, const Client *client)
: element_(element), client_(client) {
@@ -1388,7 +1387,7 @@ class Client::JsonEncryptedPassportElement : public Jsonable {
const Client *client_;
};
-class Client::JsonEncryptedCredentials : public Jsonable {
+class Client::JsonEncryptedCredentials final : public Jsonable {
public:
explicit JsonEncryptedCredentials(const td_api::encryptedCredentials *credentials) : credentials_(credentials) {
}
@@ -1403,7 +1402,7 @@ class Client::JsonEncryptedCredentials : public Jsonable {
const td_api::encryptedCredentials *credentials_;
};
-class Client::JsonPassportData : public Jsonable {
+class Client::JsonPassportData final : public Jsonable {
public:
JsonPassportData(const td_api::messagePassportDataReceived *passport_data, const Client *client)
: passport_data_(passport_data), client_(client) {
@@ -1421,7 +1420,7 @@ class Client::JsonPassportData : public Jsonable {
const Client *client_;
};
-class Client::JsonProximityAlertTriggered : public Jsonable {
+class Client::JsonProximityAlertTriggered final : public Jsonable {
public:
JsonProximityAlertTriggered(const td_api::messageProximityAlertTriggered *proximity_alert_triggered,
const Client *client)
@@ -1439,7 +1438,7 @@ class Client::JsonProximityAlertTriggered : public Jsonable {
const Client *client_;
};
-class Client::JsonVideoChatScheduled : public Jsonable {
+class Client::JsonVideoChatScheduled final : public Jsonable {
public:
explicit JsonVideoChatScheduled(const td_api::messageVideoChatScheduled *video_chat_scheduled)
: video_chat_scheduled_(video_chat_scheduled) {
@@ -1453,14 +1452,14 @@ class Client::JsonVideoChatScheduled : public Jsonable {
const td_api::messageVideoChatScheduled *video_chat_scheduled_;
};
-class Client::JsonVideoChatStarted : public Jsonable {
+class Client::JsonVideoChatStarted final : public Jsonable {
public:
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
}
};
-class Client::JsonVideoChatEnded : public Jsonable {
+class Client::JsonVideoChatEnded final : public Jsonable {
public:
explicit JsonVideoChatEnded(const td_api::messageVideoChatEnded *video_chat_ended)
: video_chat_ended_(video_chat_ended) {
@@ -1474,7 +1473,7 @@ class Client::JsonVideoChatEnded : public Jsonable {
const td_api::messageVideoChatEnded *video_chat_ended_;
};
-class Client::JsonInviteVideoChatParticipants : public Jsonable {
+class Client::JsonInviteVideoChatParticipants final : public Jsonable {
public:
JsonInviteVideoChatParticipants(const td_api::messageInviteVideoChatParticipants *invite_video_chat_participants,
const Client *client)
@@ -1490,7 +1489,7 @@ class Client::JsonInviteVideoChatParticipants : public Jsonable {
const Client *client_;
};
-class Client::JsonChatSetTtl : public Jsonable {
+class Client::JsonChatSetTtl final : public Jsonable {
public:
explicit JsonChatSetTtl(const td_api::messageChatSetTtl *chat_set_ttl) : chat_set_ttl_(chat_set_ttl) {
}
@@ -1503,14 +1502,14 @@ class Client::JsonChatSetTtl : public Jsonable {
const td_api::messageChatSetTtl *chat_set_ttl_;
};
-class Client::JsonCallbackGame : public Jsonable {
+class Client::JsonCallbackGame final : public Jsonable {
public:
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
}
};
-class Client::JsonInlineKeyboardButton : public Jsonable {
+class Client::JsonInlineKeyboardButton final : public Jsonable {
public:
explicit JsonInlineKeyboardButton(const td_api::inlineKeyboardButton *button) : button_(button) {
}
@@ -1568,7 +1567,7 @@ class Client::JsonInlineKeyboardButton : public Jsonable {
const td_api::inlineKeyboardButton *button_;
};
-class Client::JsonInlineKeyboard : public Jsonable {
+class Client::JsonInlineKeyboard final : public Jsonable {
public:
explicit JsonInlineKeyboard(const td_api::replyMarkupInlineKeyboard *inline_keyboard)
: inline_keyboard_(inline_keyboard) {
@@ -1584,7 +1583,7 @@ class Client::JsonInlineKeyboard : public Jsonable {
const td_api::replyMarkupInlineKeyboard *inline_keyboard_;
};
-class Client::JsonReplyMarkup : public Jsonable {
+class Client::JsonReplyMarkup final : public Jsonable {
public:
explicit JsonReplyMarkup(const td_api::ReplyMarkup *reply_markup) : reply_markup_(reply_markup) {
}
@@ -1936,7 +1935,7 @@ void Client::JsonMessage::store(JsonValueScope *scope) const {
}
}
-class Client::JsonDeletedMessage : public Jsonable {
+class Client::JsonDeletedMessage final : public Jsonable {
public:
JsonDeletedMessage(int64 chat_id, int64 message_id, const Client *client)
: chat_id_(chat_id), message_id_(message_id), client_(client) {
@@ -1954,7 +1953,7 @@ class Client::JsonDeletedMessage : public Jsonable {
const Client *client_;
};
-class Client::JsonMessageId : public Jsonable {
+class Client::JsonMessageId final : public Jsonable {
public:
explicit JsonMessageId(int64 message_id) : message_id_(message_id) {
}
@@ -1967,7 +1966,7 @@ class Client::JsonMessageId : public Jsonable {
int64 message_id_;
};
-class Client::JsonInlineQuery : public Jsonable {
+class Client::JsonInlineQuery final : public Jsonable {
public:
JsonInlineQuery(int64 inline_query_id, int64 sender_user_id, const td_api::location *user_location,
const td_api::ChatType *chat_type, const td::string &query, const td::string &offset,
@@ -2033,7 +2032,7 @@ class Client::JsonInlineQuery : public Jsonable {
const Client *client_;
};
-class Client::JsonChosenInlineResult : public Jsonable {
+class Client::JsonChosenInlineResult final : public Jsonable {
public:
JsonChosenInlineResult(int64 sender_user_id, const td_api::location *user_location, const td::string &query,
const td::string &result_id, const td::string &inline_message_id, const Client *client)
@@ -2067,7 +2066,7 @@ class Client::JsonChosenInlineResult : public Jsonable {
const Client *client_;
};
-class Client::JsonCallbackQuery : public Jsonable {
+class Client::JsonCallbackQuery final : public Jsonable {
public:
JsonCallbackQuery(int64 callback_query_id, int64 sender_user_id, int64 chat_id, int64 message_id,
const MessageInfo *message_info, int64 chat_instance, td_api::CallbackQueryPayload *payload,
@@ -2106,7 +2105,7 @@ class Client::JsonCallbackQuery : public Jsonable {
const Client *client_;
};
-class Client::JsonInlineCallbackQuery : public Jsonable {
+class Client::JsonInlineCallbackQuery final : public Jsonable {
public:
JsonInlineCallbackQuery(int64 callback_query_id, int64 sender_user_id, const td::string &inline_message_id,
int64 chat_instance, td_api::CallbackQueryPayload *payload, const Client *client)
@@ -2136,7 +2135,7 @@ class Client::JsonInlineCallbackQuery : public Jsonable {
const Client *client_;
};
-class Client::JsonShippingQuery : public Jsonable {
+class Client::JsonShippingQuery final : public Jsonable {
public:
JsonShippingQuery(const td_api::updateNewShippingQuery *query, const Client *client)
: query_(query), client_(client) {
@@ -2160,7 +2159,7 @@ class Client::JsonShippingQuery : public Jsonable {
const Client *client_;
};
-class Client::JsonPreCheckoutQuery : public Jsonable {
+class Client::JsonPreCheckoutQuery final : public Jsonable {
public:
JsonPreCheckoutQuery(const td_api::updateNewPreCheckoutQuery *query, const Client *client)
: query_(query), client_(client) {
@@ -2191,7 +2190,7 @@ class Client::JsonPreCheckoutQuery : public Jsonable {
const Client *client_;
};
-class Client::JsonCustomJson : public Jsonable {
+class Client::JsonCustomJson final : public Jsonable {
public:
explicit JsonCustomJson(const td::string &json) : json_(json) {
}
@@ -2204,7 +2203,7 @@ class Client::JsonCustomJson : public Jsonable {
const td::string &json_;
};
-class Client::JsonBotCommand : public Jsonable {
+class Client::JsonBotCommand final : public Jsonable {
public:
explicit JsonBotCommand(const td_api::botCommand *command) : command_(command) {
}
@@ -2218,7 +2217,7 @@ class Client::JsonBotCommand : public Jsonable {
const td_api::botCommand *command_;
};
-class Client::JsonChatPhotos : public Jsonable {
+class Client::JsonChatPhotos final : public Jsonable {
public:
JsonChatPhotos(const td_api::chatPhotos *photos, const Client *client) : photos_(photos), client_(client) {
}
@@ -2234,7 +2233,7 @@ class Client::JsonChatPhotos : public Jsonable {
const Client *client_;
};
-class Client::JsonChatMember : public Jsonable {
+class Client::JsonChatMember final : public Jsonable {
public:
JsonChatMember(const td_api::chatMember *member, Client::ChatType chat_type, const Client *client)
: member_(member), chat_type_(chat_type), client_(client) {
@@ -2316,7 +2315,7 @@ class Client::JsonChatMember : public Jsonable {
const Client *client_;
};
-class Client::JsonChatMembers : public Jsonable {
+class Client::JsonChatMembers final : public Jsonable {
public:
JsonChatMembers(const td::vector> &members, Client::ChatType chat_type,
bool administrators_only, const Client *client)
@@ -2353,7 +2352,7 @@ class Client::JsonChatMembers : public Jsonable {
const Client *client_;
};
-class Client::JsonChatMemberUpdated : public Jsonable {
+class Client::JsonChatMemberUpdated final : public Jsonable {
public:
JsonChatMemberUpdated(const td_api::updateChatMember *update, const Client *client)
: update_(update), client_(client) {
@@ -2376,7 +2375,7 @@ class Client::JsonChatMemberUpdated : public Jsonable {
const Client *client_;
};
-class Client::JsonChatJoinRequest : public Jsonable {
+class Client::JsonChatJoinRequest final : public Jsonable {
public:
JsonChatJoinRequest(const td_api::updateNewChatJoinRequest *update, const Client *client)
: update_(update), client_(client) {
@@ -2399,7 +2398,7 @@ class Client::JsonChatJoinRequest : public Jsonable {
const Client *client_;
};
-class Client::JsonGameHighScore : public Jsonable {
+class Client::JsonGameHighScore final : public Jsonable {
public:
JsonGameHighScore(const td_api::gameHighScore *score, const Client *client) : score_(score), client_(client) {
}
@@ -2416,7 +2415,7 @@ class Client::JsonGameHighScore : public Jsonable {
const Client *client_;
};
-class Client::JsonUpdateTypes : public Jsonable {
+class Client::JsonUpdateTypes final : public Jsonable {
public:
explicit JsonUpdateTypes(td::uint32 update_types) : update_types_(update_types) {
}
@@ -2436,7 +2435,7 @@ class Client::JsonUpdateTypes : public Jsonable {
td::uint32 update_types_;
};
-class Client::JsonWebhookInfo : public Jsonable {
+class Client::JsonWebhookInfo final : public Jsonable {
public:
explicit JsonWebhookInfo(const Client *client) : client_(client) {
}
@@ -2474,7 +2473,7 @@ class Client::JsonWebhookInfo : public Jsonable {
const Client *client_;
};
-class Client::JsonStickerSet : public Jsonable {
+class Client::JsonStickerSet final : public Jsonable {
public:
JsonStickerSet(const td_api::stickerSet *sticker_set, const Client *client)
: sticker_set_(sticker_set), client_(client) {
@@ -2500,9 +2499,9 @@ class Client::JsonStickerSet : public Jsonable {
const Client *client_;
};
-class Client::TdOnOkCallback : public TdQueryCallback {
+class Client::TdOnOkCallback final : public TdQueryCallback {
public:
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->code_ != 401 && error->code_ != 406 && error->code_ != 500) {
@@ -2512,12 +2511,12 @@ class Client::TdOnOkCallback : public TdQueryCallback {
}
};
-class Client::TdOnAuthorizationCallback : public TdQueryCallback {
+class Client::TdOnAuthorizationCallback final : public TdQueryCallback {
public:
explicit TdOnAuthorizationCallback(Client *client) : client_(client) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
bool was_ready = client_->authorization_state_->get_id() != td_api::authorizationStateWaitPhoneNumber::ID;
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
@@ -2537,12 +2536,12 @@ class Client::TdOnAuthorizationCallback : public TdQueryCallback {
Client *client_;
};
-class Client::TdOnInitCallback : public TdQueryCallback {
+class Client::TdOnInitCallback final : public TdQueryCallback {
public:
explicit TdOnInitCallback(Client *client) : client_(client) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
LOG(WARNING) << "Failed to initialize due to " << td::oneline(to_string(result));
client_->close();
@@ -2553,13 +2552,13 @@ class Client::TdOnInitCallback : public TdQueryCallback {
Client *client_;
};
-class Client::TdOnGetUserProfilePhotosCallback : public TdQueryCallback {
+class Client::TdOnGetUserProfilePhotosCallback final : public TdQueryCallback {
public:
TdOnGetUserProfilePhotosCallback(const Client *client, PromisedQueryPtr query)
: client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2574,12 +2573,12 @@ class Client::TdOnGetUserProfilePhotosCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnSendMessageCallback : public TdQueryCallback {
+class Client::TdOnSendMessageCallback final : public TdQueryCallback {
public:
TdOnSendMessageCallback(Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2594,12 +2593,12 @@ class Client::TdOnSendMessageCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnSendMessageAlbumCallback : public TdQueryCallback {
+class Client::TdOnSendMessageAlbumCallback final : public TdQueryCallback {
public:
TdOnSendMessageAlbumCallback(Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2617,7 +2616,7 @@ class Client::TdOnSendMessageAlbumCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnDeleteFailedToSendMessageCallback : public TdQueryCallback {
+class Client::TdOnDeleteFailedToSendMessageCallback final : public TdQueryCallback {
public:
TdOnDeleteFailedToSendMessageCallback(Client *client, int64 chat_id, int64 message_id)
: client_(client)
@@ -2626,7 +2625,7 @@ class Client::TdOnDeleteFailedToSendMessageCallback : public TdQueryCallback {
, old_chat_description_(client->get_chat_description(chat_id)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->code_ != 401 && !client_->need_close_ && !client_->closing_ && !client_->logging_out_) {
@@ -2651,12 +2650,12 @@ class Client::TdOnDeleteFailedToSendMessageCallback : public TdQueryCallback {
td::string old_chat_description_;
};
-class Client::TdOnEditMessageCallback : public TdQueryCallback {
+class Client::TdOnEditMessageCallback final : public TdQueryCallback {
public:
TdOnEditMessageCallback(const Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2679,12 +2678,12 @@ class Client::TdOnEditMessageCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnEditInlineMessageCallback : public TdQueryCallback {
+class Client::TdOnEditInlineMessageCallback final : public TdQueryCallback {
public:
explicit TdOnEditInlineMessageCallback(PromisedQueryPtr query) : query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2697,13 +2696,13 @@ class Client::TdOnEditInlineMessageCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnStopPollCallback : public TdQueryCallback {
+class Client::TdOnStopPollCallback final : public TdQueryCallback {
public:
TdOnStopPollCallback(const Client *client, int64 chat_id, int64 message_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), message_id_(message_id), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2728,13 +2727,13 @@ class Client::TdOnStopPollCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnOkQueryCallback : public TdQueryCallback {
+class Client::TdOnOkQueryCallback final : public TdQueryCallback {
public:
explicit TdOnOkQueryCallback(PromisedQueryPtr query) : query_(std::move(query)) {
CHECK(query_ != nullptr);
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -2748,13 +2747,13 @@ class Client::TdOnOkQueryCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckUserCallback : public TdQueryCallback {
+class Client::TdOnCheckUserCallback final : public TdQueryCallback {
public:
TdOnCheckUserCallback(const Client *client, PromisedQueryPtr query, OnSuccess on_success)
: client_(client), query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result), "user not found");
}
@@ -2774,13 +2773,13 @@ class Client::TdOnCheckUserCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckUserNoFailCallback : public TdQueryCallback {
+class Client::TdOnCheckUserNoFailCallback final : public TdQueryCallback {
public:
TdOnCheckUserNoFailCallback(PromisedQueryPtr query, OnSuccess on_success)
: query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
on_success_(std::move(query_));
}
@@ -2790,7 +2789,7 @@ class Client::TdOnCheckUserNoFailCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckChatCallback : public TdQueryCallback {
+class Client::TdOnCheckChatCallback final : public TdQueryCallback {
public:
TdOnCheckChatCallback(const Client *client, bool only_supergroup, AccessRights access_rights, PromisedQueryPtr query,
OnSuccess on_success)
@@ -2801,7 +2800,7 @@ class Client::TdOnCheckChatCallback : public TdQueryCallback {
, on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result), "chat not found");
}
@@ -2827,13 +2826,13 @@ class Client::TdOnCheckChatCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckChatNoFailCallback : public TdQueryCallback {
+class Client::TdOnCheckChatNoFailCallback final : public TdQueryCallback {
public:
TdOnCheckChatNoFailCallback(int64 chat_id, PromisedQueryPtr query, OnSuccess on_success)
: chat_id_(chat_id), query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
on_success_(chat_id_, std::move(query_));
}
@@ -2844,13 +2843,13 @@ class Client::TdOnCheckChatNoFailCallback : public TdQueryCallback {
};
template
-class Client::TdOnSearchStickerSetCallback : public TdQueryCallback {
+class Client::TdOnSearchStickerSetCallback final : public TdQueryCallback {
public:
TdOnSearchStickerSetCallback(PromisedQueryPtr query, OnSuccess on_success)
: query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result), "sticker set not found");
}
@@ -2865,13 +2864,13 @@ class Client::TdOnSearchStickerSetCallback : public TdQueryCallback {
OnSuccess on_success_;
};
-class Client::TdOnResolveBotUsernameCallback : public TdQueryCallback {
+class Client::TdOnResolveBotUsernameCallback final : public TdQueryCallback {
public:
TdOnResolveBotUsernameCallback(Client *client, td::string username)
: client_(client), username_(std::move(username)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return client_->on_resolve_bot_username(username_, 0);
}
@@ -2898,7 +2897,7 @@ class Client::TdOnResolveBotUsernameCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckMessageCallback : public TdQueryCallback {
+class Client::TdOnCheckMessageCallback final : public TdQueryCallback {
public:
TdOnCheckMessageCallback(Client *client, int64 chat_id, int64 message_id, bool allow_empty, Slice message_type,
PromisedQueryPtr query, OnSuccess on_success)
@@ -2911,7 +2910,7 @@ class Client::TdOnCheckMessageCallback : public TdQueryCallback {
, on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->code_ == 429) {
@@ -2941,13 +2940,13 @@ class Client::TdOnCheckMessageCallback : public TdQueryCallback {
};
template
-class Client::TdOnCheckRemoteFileIdCallback : public TdQueryCallback {
+class Client::TdOnCheckRemoteFileIdCallback final : public TdQueryCallback {
public:
TdOnCheckRemoteFileIdCallback(PromisedQueryPtr query, OnSuccess on_success)
: query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result), "invalid file_id");
}
@@ -2962,13 +2961,13 @@ class Client::TdOnCheckRemoteFileIdCallback : public TdQueryCallback {
};
template
-class Client::TdOnGetChatMemberCallback : public TdQueryCallback {
+class Client::TdOnGetChatMemberCallback final : public TdQueryCallback {
public:
TdOnGetChatMemberCallback(PromisedQueryPtr query, OnSuccess on_success)
: query_(std::move(query)), on_success_(std::move(on_success)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result), "user not found");
}
@@ -2982,12 +2981,12 @@ class Client::TdOnGetChatMemberCallback : public TdQueryCallback {
OnSuccess on_success_;
};
-class Client::TdOnDownloadFileCallback : public TdQueryCallback {
+class Client::TdOnDownloadFileCallback final : public TdQueryCallback {
public:
TdOnDownloadFileCallback(Client *client, int32 file_id) : client_(client), file_id_(file_id) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
return client_->on_file_download(file_id_, Status::Error(error->code_, error->message_));
@@ -3004,9 +3003,9 @@ class Client::TdOnDownloadFileCallback : public TdQueryCallback {
int32 file_id_;
};
-class Client::TdOnCancelDownloadFileCallback : public TdQueryCallback {
+class Client::TdOnCancelDownloadFileCallback final : public TdQueryCallback {
public:
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
LOG(ERROR) << "Failed to cancel download file";
return;
@@ -3015,12 +3014,12 @@ class Client::TdOnCancelDownloadFileCallback : public TdQueryCallback {
}
};
-class Client::TdOnGetReplyMessageCallback : public TdQueryCallback {
+class Client::TdOnGetReplyMessageCallback final : public TdQueryCallback {
public:
TdOnGetReplyMessageCallback(Client *client, int64 chat_id) : client_(client), chat_id_(chat_id) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return client_->on_get_reply_message(chat_id_, nullptr);
}
@@ -3034,12 +3033,12 @@ class Client::TdOnGetReplyMessageCallback : public TdQueryCallback {
int64 chat_id_;
};
-class Client::TdOnGetEditedMessageCallback : public TdQueryCallback {
+class Client::TdOnGetEditedMessageCallback final : public TdQueryCallback {
public:
explicit TdOnGetEditedMessageCallback(Client *client) : client_(client) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->code_ == 429) {
@@ -3056,13 +3055,13 @@ class Client::TdOnGetEditedMessageCallback : public TdQueryCallback {
Client *client_;
};
-class Client::TdOnGetCallbackQueryMessageCallback : public TdQueryCallback {
+class Client::TdOnGetCallbackQueryMessageCallback final : public TdQueryCallback {
public:
TdOnGetCallbackQueryMessageCallback(Client *client, int64 user_id, int state)
: client_(client), user_id_(user_id), state_(state) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->code_ == 429) {
@@ -3081,7 +3080,7 @@ class Client::TdOnGetCallbackQueryMessageCallback : public TdQueryCallback {
int state_;
};
-class Client::TdOnGetStickerSetCallback : public TdQueryCallback {
+class Client::TdOnGetStickerSetCallback final : public TdQueryCallback {
public:
TdOnGetStickerSetCallback(Client *client, int64 set_id, int64 new_callback_query_user_id, int64 new_message_chat_id)
: client_(client)
@@ -3090,7 +3089,7 @@ class Client::TdOnGetStickerSetCallback : public TdQueryCallback {
, new_message_chat_id_(new_message_chat_id) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
if (error->message_ != "STICKERSET_INVALID" && error->code_ != 401 && error->code_ != 500) {
@@ -3113,13 +3112,13 @@ class Client::TdOnGetStickerSetCallback : public TdQueryCallback {
int64 new_message_chat_id_;
};
-class Client::TdOnGetChatStickerSetCallback : public TdQueryCallback {
+class Client::TdOnGetChatStickerSetCallback final : public TdQueryCallback {
public:
TdOnGetChatStickerSetCallback(Client *client, int64 chat_id, int64 pinned_message_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), pinned_message_id_(pinned_message_id), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
auto chat_info = client_->get_chat(chat_id_);
CHECK(chat_info != nullptr);
@@ -3141,13 +3140,13 @@ class Client::TdOnGetChatStickerSetCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetChatPinnedMessageCallback : public TdQueryCallback {
+class Client::TdOnGetChatPinnedMessageCallback final : public TdQueryCallback {
public:
TdOnGetChatPinnedMessageCallback(Client *client, int64 chat_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
@@ -3187,13 +3186,13 @@ class Client::TdOnGetChatPinnedMessageCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetChatPinnedMessageToUnpinCallback : public TdQueryCallback {
+class Client::TdOnGetChatPinnedMessageToUnpinCallback final : public TdQueryCallback {
public:
TdOnGetChatPinnedMessageToUnpinCallback(Client *client, int64 chat_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
int64 pinned_message_id = 0;
if (result->get_id() == td_api::error::ID) {
auto error = move_object_as(result);
@@ -3220,12 +3219,12 @@ class Client::TdOnGetChatPinnedMessageToUnpinCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetMyCommandsCallback : public TdQueryCallback {
+class Client::TdOnGetMyCommandsCallback final : public TdQueryCallback {
public:
explicit TdOnGetMyCommandsCallback(PromisedQueryPtr query) : query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3240,13 +3239,13 @@ class Client::TdOnGetMyCommandsCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetChatFullInfoCallback : public TdQueryCallback {
+class Client::TdOnGetChatFullInfoCallback final : public TdQueryCallback {
public:
TdOnGetChatFullInfoCallback(Client *client, int64 chat_id, PromisedQueryPtr query)
: client_(client), chat_id_(chat_id), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3263,13 +3262,13 @@ class Client::TdOnGetChatFullInfoCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetGroupMembersCallback : public TdQueryCallback {
+class Client::TdOnGetGroupMembersCallback final : public TdQueryCallback {
public:
TdOnGetGroupMembersCallback(const Client *client, bool administrators_only, PromisedQueryPtr query)
: client_(client), administrators_only_(administrators_only), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3286,13 +3285,13 @@ class Client::TdOnGetGroupMembersCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetSupergroupMembersCallback : public TdQueryCallback {
+class Client::TdOnGetSupergroupMembersCallback final : public TdQueryCallback {
public:
TdOnGetSupergroupMembersCallback(const Client *client, Client::ChatType chat_type, PromisedQueryPtr query)
: client_(client), chat_type_(chat_type), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3308,12 +3307,12 @@ class Client::TdOnGetSupergroupMembersCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetSupergroupMembersCountCallback : public TdQueryCallback {
+class Client::TdOnGetSupergroupMembersCountCallback final : public TdQueryCallback {
public:
explicit TdOnGetSupergroupMembersCountCallback(PromisedQueryPtr query) : query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3327,12 +3326,12 @@ class Client::TdOnGetSupergroupMembersCountCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnReplacePrimaryChatInviteLinkCallback : public TdQueryCallback {
+class Client::TdOnReplacePrimaryChatInviteLinkCallback final : public TdQueryCallback {
public:
explicit TdOnReplacePrimaryChatInviteLinkCallback(PromisedQueryPtr query) : query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3346,13 +3345,13 @@ class Client::TdOnReplacePrimaryChatInviteLinkCallback : public TdQueryCallback
PromisedQueryPtr query_;
};
-class Client::TdOnGetChatInviteLinkCallback : public TdQueryCallback {
+class Client::TdOnGetChatInviteLinkCallback final : public TdQueryCallback {
public:
TdOnGetChatInviteLinkCallback(const Client *client, PromisedQueryPtr query)
: client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3373,13 +3372,13 @@ class Client::TdOnGetChatInviteLinkCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnGetGameHighScoresCallback : public TdQueryCallback {
+class Client::TdOnGetGameHighScoresCallback final : public TdQueryCallback {
public:
TdOnGetGameHighScoresCallback(const Client *client, PromisedQueryPtr query)
: client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3396,12 +3395,12 @@ class Client::TdOnGetGameHighScoresCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnReturnFileCallback : public TdQueryCallback {
+class Client::TdOnReturnFileCallback final : public TdQueryCallback {
public:
TdOnReturnFileCallback(const Client *client, PromisedQueryPtr query) : client_(client), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3416,13 +3415,13 @@ class Client::TdOnReturnFileCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnReturnStickerSetCallback : public TdQueryCallback {
+class Client::TdOnReturnStickerSetCallback final : public TdQueryCallback {
public:
TdOnReturnStickerSetCallback(Client *client, bool return_sticker_set, PromisedQueryPtr query)
: client_(client), return_sticker_set_(return_sticker_set), query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3443,12 +3442,12 @@ class Client::TdOnReturnStickerSetCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
-class Client::TdOnSendCustomRequestCallback : public TdQueryCallback {
+class Client::TdOnSendCustomRequestCallback final : public TdQueryCallback {
public:
explicit TdOnSendCustomRequestCallback(PromisedQueryPtr query) : query_(std::move(query)) {
}
- void on_result(object_ptr result) override {
+ void on_result(object_ptr result) final {
if (result->get_id() == td_api::error::ID) {
return fail_query_with_error(std::move(query_), move_object_as(result));
}
@@ -3548,14 +3547,14 @@ void Client::start_up() {
}
dir_ = parameters_->working_directory_ + suff;
- class TdCallback : public td::TdCallback {
+ class TdCallback final : public td::TdCallback {
public:
explicit TdCallback(td::ActorId client) : client_(std::move(client)) {
}
- void on_result(td::uint64 id, object_ptr result) override {
+ void on_result(td::uint64 id, object_ptr result) final {
send_closure_later(client_, &Client::on_result, id, std::move(result));
}
- void on_error(td::uint64 id, object_ptr result) override {
+ void on_error(td::uint64 id, object_ptr result) final {
send_closure_later(client_, &Client::on_result, id, std::move(result));
}
@@ -4603,7 +4602,7 @@ void Client::on_closed() {
if (logging_out_) {
parameters_->shared_data_->webhook_db_->erase(bot_token_with_dc_);
- class RmWorker : public td::Actor {
+ class RmWorker final : public td::Actor {
public:
RmWorker(td::string dir, td::ActorId parent) : dir_(std::move(dir)), parent_(std::move(parent)) {
}
@@ -4612,13 +4611,13 @@ void Client::on_closed() {
td::string dir_;
td::ActorId parent_;
- void start_up() override {
+ void start_up() final {
CHECK(dir_.size() >= 24);
CHECK(dir_.back() == TD_DIR_SLASH);
td::rmrf(dir_).ignore();
stop();
}
- void tear_down() override {
+ void tear_down() final {
send_closure(parent_, &Client::finish_closing);
}
};
@@ -8287,7 +8286,7 @@ void Client::fail_query_conflict(Slice message, PromisedQueryPtr &&query) {
}
}
-class Client::JsonUpdates : public Jsonable {
+class Client::JsonUpdates final : public Jsonable {
public:
explicit JsonUpdates(td::Span updates) : updates_(updates) {
}
@@ -8797,11 +8796,11 @@ bool Client::update_allowed_update_types(const Query *query) {
}
template
-class UpdateJsonable : public td::VirtuallyJsonable {
+class UpdateJsonable final : public td::VirtuallyJsonable {
public:
explicit UpdateJsonable(const T &update) : update(update) {
}
- void store(JsonValueScope *scope) const override {
+ void store(JsonValueScope *scope) const final {
*scope << update;
}
@@ -9760,7 +9759,7 @@ td::int64 Client::as_tdlib_message_id(int32 message_id) {
}
td::int32 Client::as_client_message_id(int64 message_id) {
- int32 result = static_cast(message_id >> 20);
+ auto result = static_cast(message_id >> 20);
CHECK(as_tdlib_message_id(result) == message_id);
return result;
}
diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h
index fee9aad..3a9c638 100644
--- a/telegram-bot-api/Client.h
+++ b/telegram-bot-api/Client.h
@@ -11,6 +11,7 @@
#include "telegram-bot-api/WebhookActor.h"
#include "td/telegram/ClientActor.h"
+#include "td/telegram/td_api.h"
#include "td/actor/actor.h"
#include "td/actor/PromiseFuture.h"
@@ -35,12 +36,12 @@ struct ClientParameters;
namespace td_api = td::td_api;
-class Client : public WebhookActor::Callback {
+class Client final : public WebhookActor::Callback {
public:
Client(td::ActorShared<> parent, const td::string &bot_token, bool is_test_dc, td::int64 tqueue_id,
std::shared_ptr parameters, td::ActorId stat_actor);
- void send(PromisedQueryPtr query) override;
+ void send(PromisedQueryPtr query) final;
void close();
@@ -519,11 +520,11 @@ class Client : public WebhookActor::Callback {
Status process_get_webhook_info_query(PromisedQueryPtr &query);
Status process_get_file_query(PromisedQueryPtr &query);
- void webhook_verified(td::string cached_ip_address) override;
- void webhook_success() override;
- void webhook_error(Status status) override;
- void webhook_closed(Status status) override;
- void hangup_shared() override;
+ void webhook_verified(td::string cached_ip_address) final;
+ void webhook_success() final;
+ void webhook_error(Status status) final;
+ void webhook_closed(Status status) final;
+ void hangup_shared() final;
int32 get_webhook_max_connections(const Query *query) const;
static bool get_webhook_fix_ip_address(const Query *query);
void do_set_webhook(PromisedQueryPtr query, bool was_deleted);
@@ -562,13 +563,13 @@ class Client : public WebhookActor::Callback {
void long_poll_wakeup(bool force_flag);
- void start_up() override;
+ void start_up() final;
- void raw_event(const td::Event::Raw &event) override;
+ void raw_event(const td::Event::Raw &event) final;
- void loop() override;
+ void loop() final;
- void timeout_expired() override;
+ void timeout_expired() final;
struct UserInfo {
enum class Type { Regular, Deleted, Bot, Unknown };
diff --git a/telegram-bot-api/ClientManager.cpp b/telegram-bot-api/ClientManager.cpp
index 09a905f..f0f023d 100644
--- a/telegram-bot-api/ClientManager.cpp
+++ b/telegram-bot-api/ClientManager.cpp
@@ -11,6 +11,7 @@
#include "telegram-bot-api/WebhookActor.h"
#include "td/telegram/ClientActor.h"
+#include "td/telegram/td_api.h"
#include "td/db/binlog/Binlog.h"
#include "td/db/binlog/ConcurrentBinlog.h"
@@ -104,7 +105,7 @@ void ClientManager::send(PromisedQueryPtr query) {
flood_control.add_limit(60, 20); // 20 in a minute
flood_control.add_limit(60 * 60, 600); // 600 in an hour
}
- td::uint32 now = static_cast(td::Time::now());
+ auto now = static_cast(td::Time::now());
td::uint32 wakeup_at = flood_control.get_wakeup_at();
if (wakeup_at > now) {
LOG(INFO) << "Failed to create Client from IP address " << ip_address;
diff --git a/telegram-bot-api/ClientManager.h b/telegram-bot-api/ClientManager.h
index e376490..5720d98 100644
--- a/telegram-bot-api/ClientManager.h
+++ b/telegram-bot-api/ClientManager.h
@@ -73,9 +73,9 @@ class ClientManager final : public td::Actor {
static PromisedQueryPtr get_webhook_restore_query(td::Slice token, td::Slice webhook_info,
std::shared_ptr shared_data);
- void start_up() override;
- void raw_event(const td::Event::Raw &event) override;
- void hangup_shared() override;
+ void start_up() final;
+ void raw_event(const td::Event::Raw &event) final;
+ void hangup_shared() final;
void close_db();
void finish_close();
};
diff --git a/telegram-bot-api/ClientParameters.h b/telegram-bot-api/ClientParameters.h
index 79607f7..455e72f 100644
--- a/telegram-bot-api/ClientParameters.h
+++ b/telegram-bot-api/ClientParameters.h
@@ -6,13 +6,13 @@
//
#pragma once
-#include "td/actor/actor.h"
-
#include "td/db/KeyValueSyncInterface.h"
#include "td/db/TQueue.h"
#include "td/net/GetHostByNameActor.h"
+#include "td/actor/actor.h"
+
#include "td/utils/common.h"
#include "td/utils/List.h"
#include "td/utils/port/IPAddress.h"
diff --git a/telegram-bot-api/HttpConnection.h b/telegram-bot-api/HttpConnection.h
index a4b1160..d631244 100644
--- a/telegram-bot-api/HttpConnection.h
+++ b/telegram-bot-api/HttpConnection.h
@@ -9,12 +9,12 @@
#include "telegram-bot-api/ClientManager.h"
#include "telegram-bot-api/Query.h"
-#include "td/actor/actor.h"
-#include "td/actor/PromiseFuture.h"
-
#include "td/net/HttpInboundConnection.h"
#include "td/net/HttpQuery.h"
+#include "td/actor/actor.h"
+#include "td/actor/PromiseFuture.h"
+
#include "td/utils/buffer.h"
#include "td/utils/Slice.h"
@@ -24,15 +24,15 @@ namespace telegram_bot_api {
struct SharedData;
-class HttpConnection : public td::HttpInboundConnection::Callback {
+class HttpConnection final : public td::HttpInboundConnection::Callback {
public:
explicit HttpConnection(td::ActorId client_manager, std::shared_ptr shared_data)
: client_manager_(client_manager), shared_data_(std::move(shared_data)) {
}
- void handle(td::unique_ptr http_query, td::ActorOwn connection) override;
+ void handle(td::unique_ptr http_query, td::ActorOwn connection) final;
- void wakeup() override;
+ void wakeup() final;
private:
td::FutureActor> result_;
@@ -40,7 +40,7 @@ class HttpConnection : public td::HttpInboundConnection::Callback {
td::ActorOwn connection_;
std::shared_ptr shared_data_;
- void hangup() override {
+ void hangup() final {
connection_.release();
stop();
}
diff --git a/telegram-bot-api/HttpServer.h b/telegram-bot-api/HttpServer.h
index b500bab..f7d0009 100644
--- a/telegram-bot-api/HttpServer.h
+++ b/telegram-bot-api/HttpServer.h
@@ -6,11 +6,11 @@
//
#pragma once
-#include "td/actor/actor.h"
-
#include "td/net/HttpInboundConnection.h"
#include "td/net/TcpListener.h"
+#include "td/actor/actor.h"
+
#include "td/utils/BufferedFd.h"
#include "td/utils/FloodControlFast.h"
#include "td/utils/format.h"
@@ -23,7 +23,7 @@
namespace telegram_bot_api {
-class HttpServer : public td::TcpListener::Callback {
+class HttpServer final : public td::TcpListener::Callback {
public:
HttpServer(td::string ip_address, int port,
std::function()> creator)
@@ -39,7 +39,7 @@ class HttpServer : public td::TcpListener::Callback {
td::ActorOwn listener_;
td::FloodControlFast flood_control_;
- void start_up() override {
+ void start_up() final {
auto now = td::Time::now();
auto wakeup_at = flood_control_.get_wakeup_at();
if (wakeup_at > now) {
@@ -53,13 +53,13 @@ class HttpServer : public td::TcpListener::Callback {
actor_shared(this, 1), ip_address_);
}
- void hangup_shared() override {
+ void hangup_shared() final {
LOG(ERROR) << "TCP listener was closed";
listener_.release();
yield();
}
- void accept(td::SocketFd fd) override {
+ void accept(td::SocketFd fd) final {
auto scheduler_count = td::Scheduler::instance()->sched_count();
auto scheduler_id = scheduler_count - 1;
if (scheduler_id > 0) {
@@ -70,7 +70,7 @@ class HttpServer : public td::TcpListener::Callback {
.release();
}
- void loop() override {
+ void loop() final {
if (listener_.empty()) {
start_up();
}
diff --git a/telegram-bot-api/HttpStatConnection.h b/telegram-bot-api/HttpStatConnection.h
index 5ef7db9..614f5ca 100644
--- a/telegram-bot-api/HttpStatConnection.h
+++ b/telegram-bot-api/HttpStatConnection.h
@@ -8,30 +8,30 @@
#include "telegram-bot-api/ClientManager.h"
-#include "td/actor/actor.h"
-#include "td/actor/PromiseFuture.h"
-
#include "td/net/HttpInboundConnection.h"
#include "td/net/HttpQuery.h"
+#include "td/actor/actor.h"
+#include "td/actor/PromiseFuture.h"
+
#include "td/utils/buffer.h"
namespace telegram_bot_api {
-class HttpStatConnection : public td::HttpInboundConnection::Callback {
+class HttpStatConnection final : public td::HttpInboundConnection::Callback {
public:
explicit HttpStatConnection(td::ActorId client_manager) : client_manager_(client_manager) {
}
- void handle(td::unique_ptr http_query, td::ActorOwn connection) override;
+ void handle(td::unique_ptr http_query, td::ActorOwn connection) final;
- void wakeup() override;
+ void wakeup() final;
private:
td::FutureActor result_;
td::ActorId client_manager_;
td::ActorOwn connection_;
- void hangup() override {
+ void hangup() final {
connection_.release();
stop();
}
diff --git a/telegram-bot-api/Query.h b/telegram-bot-api/Query.h
index 92cb9bb..f5d15f8 100644
--- a/telegram-bot-api/Query.h
+++ b/telegram-bot-api/Query.h
@@ -8,11 +8,11 @@
#include "telegram-bot-api/ClientParameters.h"
+#include "td/net/HttpFile.h"
+
#include "td/actor/actor.h"
#include "td/actor/PromiseFuture.h"
-#include "td/net/HttpFile.h"
-
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/JsonBuilder.h"
@@ -30,7 +30,7 @@ namespace telegram_bot_api {
class BotStatActor;
-class Query : public td::ListNode {
+class Query final : public td::ListNode {
public:
enum class State : td::int8 { Query, OK, Error };
@@ -166,7 +166,7 @@ td::StringBuilder &operator<<(td::StringBuilder &sb, const Query &query);
// https://stackoverflow.com/questions/26947704/implicit-conversion-failure-from-initializer-list
extern std::unordered_map> empty_parameters;
-class JsonParameters : public td::Jsonable {
+class JsonParameters final : public td::Jsonable {
public:
explicit JsonParameters(const std::unordered_map> ¶meters)
: parameters_(parameters) {
@@ -184,7 +184,7 @@ class JsonParameters : public td::Jsonable {
};
template
-class JsonQueryOk : public td::Jsonable {
+class JsonQueryOk final : public td::Jsonable {
public:
JsonQueryOk(const T &result, td::Slice description) : result_(result), description_(description) {
}
@@ -202,7 +202,7 @@ class JsonQueryOk : public td::Jsonable {
td::Slice description_;
};
-class JsonQueryError : public td::Jsonable {
+class JsonQueryError final : public td::Jsonable {
public:
JsonQueryError(
int error_code, td::Slice description,
diff --git a/telegram-bot-api/Stats.h b/telegram-bot-api/Stats.h
index 06e6606..3b317fc 100644
--- a/telegram-bot-api/Stats.h
+++ b/telegram-bot-api/Stats.h
@@ -156,7 +156,7 @@ class BotStatActor final : public td::Actor {
BotStatActor(const BotStatActor &) = delete;
BotStatActor &operator=(const BotStatActor &other) = delete;
BotStatActor(BotStatActor &&) = default;
- BotStatActor &operator=(BotStatActor &&other) {
+ BotStatActor &operator=(BotStatActor &&other) noexcept {
if (!empty()) {
do_stop();
}
@@ -165,7 +165,7 @@ class BotStatActor final : public td::Actor {
parent_ = other.parent_;
return *this;
}
- ~BotStatActor() override = default;
+ ~BotStatActor() final = default;
template
void add_event(const EventT &event, double now) {
diff --git a/telegram-bot-api/WebhookActor.cpp b/telegram-bot-api/WebhookActor.cpp
index ce51f88..1d7a559 100644
--- a/telegram-bot-api/WebhookActor.cpp
+++ b/telegram-bot-api/WebhookActor.cpp
@@ -152,11 +152,11 @@ td::Status WebhookActor::create_connection() {
}
VLOG(webhook) << "Create connection through proxy " << parameters_->webhook_proxy_ip_address_;
- class Callback : public td::TransparentProxy::Callback {
+ class Callback final : public td::TransparentProxy::Callback {
public:
Callback(td::ActorId actor, td::int64 id) : actor_(actor), id_(id) {
}
- void set_result(td::Result> result) override {
+ void set_result(td::Result> result) final {
send_closure(std::move(actor_), &WebhookActor::on_socket_ready_async, std::move(result), id_);
CHECK(actor_.empty());
}
@@ -169,7 +169,7 @@ td::Status WebhookActor::create_connection() {
send_closure(std::move(actor_), &WebhookActor::on_socket_ready_async, td::Status::Error("Canceled"), id_);
}
}
- void on_connected() override {
+ void on_connected() final {
// nothing to do
}
diff --git a/telegram-bot-api/WebhookActor.h b/telegram-bot-api/WebhookActor.h
index fa98ddb..6067d73 100644
--- a/telegram-bot-api/WebhookActor.h
+++ b/telegram-bot-api/WebhookActor.h
@@ -41,7 +41,7 @@ namespace telegram_bot_api {
struct ClientParameters;
-class WebhookActor : public td::HttpOutboundConnection::Callback {
+class WebhookActor final : public td::HttpOutboundConnection::Callback {
public:
class Callback : public td::Actor {
public:
@@ -139,7 +139,7 @@ class WebhookActor : public td::HttpOutboundConnection::Callback {
double next_ip_address_resolve_time_ = 0;
td::FutureActor future_ip_address_;
- class Connection : public td::ListNode {
+ class Connection final : public td::ListNode {
public:
Connection() = default;
Connection(const Connection &) = delete;
@@ -190,26 +190,26 @@ class WebhookActor : public td::HttpOutboundConnection::Callback {
td::Status send_update() TD_WARN_UNUSED_RESULT;
void send_updates();
- void loop() override;
- void handle(td::unique_ptr response) override;
+ void loop() final;
+ void handle(td::unique_ptr response) final;
- void hangup_shared() override;
+ void hangup_shared() final;
- void hangup() override;
+ void hangup() final;
- void tear_down() override;
+ void tear_down() final;
- void start_up() override;
+ void start_up() final;
bool check_ip_address(const td::IPAddress &addr) const;
void on_error(td::Status status);
- void on_connection_error(td::Status error) override;
+ void on_connection_error(td::Status error) final;
void on_webhook_error(td::Slice error);
void on_webhook_verified();
};
-class JsonUpdate : public td::Jsonable {
+class JsonUpdate final : public td::Jsonable {
public:
JsonUpdate(td::int32 id, td::Slice update) : id_(id), update_(update) {
}
diff --git a/telegram-bot-api/telegram-bot-api.cpp b/telegram-bot-api/telegram-bot-api.cpp
index cf423ee..e42390d 100644
--- a/telegram-bot-api/telegram-bot-api.cpp
+++ b/telegram-bot-api/telegram-bot-api.cpp
@@ -310,16 +310,16 @@ int main(int argc, char *argv[]) {
options.add_checked_option('c', "max-connections", "maximum number of open file descriptors",
td::OptionParser::parse_integer(max_connections));
- options.add_checked_option(
- '\0', "proxy", PSLICE() << "HTTP proxy server for outgoing webhook requests in the format http://host:port",
- [&](td::Slice address) {
- if (td::begins_with(address, "http://")) {
- address.remove_prefix(7);
- } else if (td::begins_with(address, "https://")) {
- address.remove_prefix(8);
- }
- return parameters->webhook_proxy_ip_address_.init_host_port(address.str());
- });
+ options.add_checked_option('\0', "proxy",
+ "HTTP proxy server for outgoing webhook requests in the format http://host:port",
+ [&](td::Slice address) {
+ if (td::begins_with(address, "http://")) {
+ address.remove_prefix(7);
+ } else if (td::begins_with(address, "https://")) {
+ address.remove_prefix(8);
+ }
+ return parameters->webhook_proxy_ip_address_.init_host_port(address.str());
+ });
options.add_check([&] {
if (parameters->api_id_ <= 0 || parameters->api_hash_.empty()) {
return td::Status::Error("You must provide valid api-id and api-hash obtained at https://my.telegram.org");