From fcbf9d65f1539b0dc159904564d6047661914597 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Fri, 7 Jan 2022 19:18:04 +0100 Subject: [PATCH] TDLib 1.8.0: Headers and sender -> sender_id changes --- qml/components/InReplyToRow.qml | 2 +- qml/components/MessageListViewItem.qml | 6 +- qml/components/MessageListViewItemSimple.qml | 6 +- qml/components/MessageOverlayFlickable.qml | 8 +- qml/components/PinnedMessageItem.qml | 2 +- qml/js/functions.js | 8 +- qml/pages/ChatPage.qml | 4 +- qml/pages/PollResultsPage.qml | 2 +- src/chatlistmodel.cpp | 10 +- src/chatmodel.cpp | 8 +- src/notificationmanager.cpp | 4 +- tdlib/include/td/telegram/Client.h | 232 ++--- tdlib/include/td/telegram/td_api.h | 938 +++++++++++-------- tdlib/include/td/telegram/td_api.hpp | 267 +++--- tdlib/include/td/telegram/td_json_client.h | 163 ++-- tdlib/include/td/tl/TlObject.h | 2 +- 16 files changed, 930 insertions(+), 732 deletions(-) diff --git a/qml/components/InReplyToRow.qml b/qml/components/InReplyToRow.qml index 6961071..7cfaad3 100644 --- a/qml/components/InReplyToRow.qml +++ b/qml/components/InReplyToRow.qml @@ -37,7 +37,7 @@ Row { onInReplyToMessageChanged: { if (inReplyToMessage) { - inReplyToUserText.text = (inReplyToMessage.sender["@type"] === "messageSenderChat" ? page.chatInformation.title : (inReplyToRow.inReplyToMessage.sender.user_id !== inReplyToRow.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(inReplyToRow.inReplyToMessage.sender.user_id)), inReplyToUserText.font.pixelSize) : qsTr("You")); + inReplyToUserText.text = (inReplyToMessage.sender_id["@type"] === "messageSenderChat" ? page.chatInformation.title : (inReplyToRow.inReplyToMessage.sender_id.user_id !== inReplyToRow.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(inReplyToRow.inReplyToMessage.sender_id.user_id)), inReplyToUserText.font.pixelSize) : qsTr("You")); inReplyToMessageText.text = Emoji.emojify(Functions.getMessageText(inReplyToRow.inReplyToMessage, true, inReplyToRow.myUserId, false), inReplyToMessageText.font.pixelSize); } } diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 3dfa05a..85ae5e5 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -32,8 +32,8 @@ ListItem { property int messageViewCount property var myMessage property bool canReplyToMessage - readonly property bool isAnonymous: myMessage.sender["@type"] === "messageSenderChat" - readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id) + readonly property bool isAnonymous: myMessage.sender_id["@type"] === "messageSenderChat" + readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender_id.user_id) property QtObject precalculatedValues: ListView.view.precalculatedValues readonly property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor readonly property int textAlign: isOwnMessage ? Text.AlignRight : Text.AlignLeft @@ -41,7 +41,7 @@ ListItem { readonly property bool isSelected: messageListItem.precalculatedValues.pageIsSelecting && page.selectedMessages.some(function(existingMessage) { return existingMessage.id === messageId }); - readonly property bool isOwnMessage: page.myUserId === myMessage.sender.user_id + readonly property bool isOwnMessage: page.myUserId === myMessage.sender_id.user_id readonly property bool canDeleteMessage: myMessage.can_be_deleted_for_all_users || (myMessage.can_be_deleted_only_for_self && myMessage.chat_id === page.myUserId) property bool hasContentComponent property bool additionalOptionsOpened diff --git a/qml/components/MessageListViewItemSimple.qml b/qml/components/MessageListViewItemSimple.qml index e36416c..832b9b2 100644 --- a/qml/components/MessageListViewItemSimple.qml +++ b/qml/components/MessageListViewItemSimple.qml @@ -25,9 +25,9 @@ import "../js/debug.js" as Debug Item { id: messageListItem property var myMessage: display - property bool senderIsUser: myMessage.sender["@type"] === "messageSenderUser" - property var userInformation: senderIsUser ? tdLibWrapper.getUserInformation(myMessage.sender.user_id) : null - property bool isOwnMessage: senderIsUser && chatPage.myUserId === myMessage.sender.user_id + property bool senderIsUser: myMessage.sender_id["@type"] === "messageSenderUser" + property var userInformation: senderIsUser ? tdLibWrapper.getUserInformation(myMessage.sender_id.user_id) : null + property bool isOwnMessage: senderIsUser && chatPage.myUserId === myMessage.sender_id.user_id property var linkedMessage height: backgroundRectangle.height + Theme.paddingMedium diff --git a/qml/components/MessageOverlayFlickable.qml b/qml/components/MessageOverlayFlickable.qml index ae2f2c3..274a284 100644 --- a/qml/components/MessageOverlayFlickable.qml +++ b/qml/components/MessageOverlayFlickable.qml @@ -32,9 +32,9 @@ Flickable { property var overlayMessage; property bool showHeader: true - readonly property var userInformation: tdLibWrapper.getUserInformation(overlayMessage.sender.user_id); - readonly property bool isOwnMessage: tdLibWrapper.getUserInformation().id === overlayMessage.sender.user_id; - readonly property bool isAnonymous: overlayMessage.sender["@type"] === "messageSenderChat" + readonly property var userInformation: tdLibWrapper.getUserInformation(overlayMessage.sender_id.user_id); + readonly property bool isOwnMessage: tdLibWrapper.getUserInformation().id === overlayMessage.sender_id.user_id; + readonly property bool isAnonymous: overlayMessage.sender_id["@type"] === "messageSenderChat" property bool hasContentComponent: overlayMessage.content && chatView.delegateMessagesContent.indexOf(overlayMessage.content['@type']) > -1 signal requestClose; @@ -44,7 +44,7 @@ Flickable { var otherChatInformation = tdLibWrapper.getChat(forwardInformation.origin.chat_id); return Emoji.emojify(otherChatInformation.title, fontSize); case "messageForwardOriginUser": - var otherUserInformation = tdLibWrapper.getUserInformation(forwardInformation.origin.sender.user_id); + var otherUserInformation = tdLibWrapper.getUserInformation(forwardInformation.origin.sender_id.user_id); return Emoji.emojify(Functions.getUserName(otherUserInformation), fontSize); default: return Emoji.emojify(forwardInformation.origin.sender_name, fontSize); diff --git a/qml/components/PinnedMessageItem.qml b/qml/components/PinnedMessageItem.qml index 8d048dc..07643f1 100644 --- a/qml/components/PinnedMessageItem.qml +++ b/qml/components/PinnedMessageItem.qml @@ -33,7 +33,7 @@ Item { onPinnedMessageChanged: { if (pinnedMessage) { Debug.log("[ChatPage] Activating pinned message"); - var messageUserText = (pinnedMessage.sender.user_id !== chatPage.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(pinnedMessage.sender.user_id)), pinnedMessageUserText.font.pixelSize) : qsTr("You"); + var messageUserText = (pinnedMessage.sender_id.user_id !== chatPage.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(pinnedMessage.sender_id.user_id)), pinnedMessageUserText.font.pixelSize) : qsTr("You"); pinnedMessageUserText.text = (messageUserText === "" ? qsTr("Pinned Message") : messageUserText ); pinnedMessageText.text = Emoji.emojify(Functions.getMessageText(pinnedMessage, true, chatPage.myUserId, false), pinnedMessageText.font.pixelSize); pinnedMessageItem.visible = true; diff --git a/qml/js/functions.js b/qml/js/functions.js index cb09efd..6a6a587 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -36,7 +36,7 @@ function getMessageText(message, simple, currentUserId, ignoreEntities) { var myself = false; if ( message['@type'] !== "sponsoredMessage" ) { - myself = ( message.sender['@type'] === "messageSenderUser" && message.sender.user_id.toString() === currentUserId.toString() ); + myself = ( message.sender_id['@type'] === "messageSenderUser" && message.sender_id.user_id.toString() === currentUserId.toString() ); } switch(message.content['@type']) { @@ -97,7 +97,7 @@ function getMessageText(message, simple, currentUserId, ignoreEntities) { case 'messageChatJoinByLink': return myself ? qsTr("joined this chat", "myself") : qsTr("joined this chat"); case 'messageChatAddMembers': - if (message.sender['@type'] === "messageSenderUser" && message.sender.user_id === message.content.member_user_ids[0]) { + if (message.sender_id['@type'] === "messageSenderUser" && message.sender_id.user_id === message.content.member_user_ids[0]) { return myself ? qsTr("were added to this chat", "myself") : qsTr("was added to this chat"); } else { var addedUserNames = ""; @@ -110,7 +110,7 @@ function getMessageText(message, simple, currentUserId, ignoreEntities) { return myself ? qsTr("have added %1 to the chat", "myself").arg(addedUserNames) : qsTr("has added %1 to the chat").arg(addedUserNames); } case 'messageChatDeleteMember': - if (message.sender['@type'] === "messageSenderUser" && message.sender.user_id === message.content.user_id) { + if (message.sender_id['@type'] === "messageSenderUser" && message.sender_id.user_id === message.content.user_id) { return myself ? qsTr("left this chat", "myself") : qsTr("left this chat"); } else { return myself ? qsTr("have removed %1 from the chat", "myself").arg(getUserName(tdLibWrapper.getUserInformation(message.content.user_id))) : qsTr("has removed %1 from the chat").arg(getUserName(tdLibWrapper.getUserInformation(message.content.user_id))); @@ -469,7 +469,7 @@ function getMessagesArrayText(messages) { var lastSenderName = ""; var lines = []; for(var i = 0; i < messages.length; i += 1) { - var senderName = getUserName(tdLibWrapper.getUserInformation(messages[i].sender.user_id)); + var senderName = getUserName(tdLibWrapper.getUserInformation(messages[i].sender_id.user_id)); if(senderName !== lastSenderName) { lines.push(senderName); } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index de965ba..66b1037 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -203,7 +203,7 @@ Page { messageStatusSuffix += " - " + qsTr("edited"); } - if (chatPage.myUserId === message.sender.user_id) { + if (chatPage.myUserId === message.sender_id.user_id) { messageStatusSuffix += "  " if (listItemIndex <= lastReadSentIndex) { // Read by other party @@ -610,7 +610,7 @@ Page { chatViewStartupReadTimer.restart(); } onNewMessageReceived: { - if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender.user_id === chatPage.myUserId) { + if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { Debug.log("[ChatPage] Own message received or was scrolled to bottom, scrolling down to see it..."); chatView.scrollToIndex(chatView.count - 1); viewMessageTimer.queueViewMessage(chatView.count - 1); diff --git a/qml/pages/PollResultsPage.qml b/qml/pages/PollResultsPage.qml index e319705..69dabb7 100644 --- a/qml/pages/PollResultsPage.qml +++ b/qml/pages/PollResultsPage.qml @@ -33,7 +33,7 @@ Page { property var pollData: message.content.poll - property var userInformation: tdLibWrapper.getUserInformation(message.sender.user_id) + property var userInformation: tdLibWrapper.getUserInformation(message.sender_id.user_id) property bool isQuiz: pollData.type['@type'] === "pollTypeQuiz" diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index b4e9397..01f84ad 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -37,7 +37,7 @@ namespace { const QString CONTENT("content"); const QString LAST_MESSAGE("last_message"); const QString DRAFT_MESSAGE("draft_message"); - const QString SENDER("sender"); + const QString SENDER_ID("sender_id"); const QString USER_ID("user_id"); const QString BASIC_GROUP_ID("basic_group_id"); const QString SUPERGROUP_ID("supergroup_id"); @@ -171,17 +171,17 @@ qlonglong ChatListModel::ChatData::lastReadInboxMessageId() const qlonglong ChatListModel::ChatData::senderUserId() const { - return lastMessage(SENDER).toMap().value(USER_ID).toLongLong(); + return lastMessage(SENDER_ID).toMap().value(USER_ID).toLongLong(); } qlonglong ChatListModel::ChatData::senderChatId() const { - return lastMessage(SENDER).toMap().value(CHAT_ID).toLongLong(); + return lastMessage(SENDER_ID).toMap().value(CHAT_ID).toLongLong(); } bool ChatListModel::ChatData::senderIsChat() const { - return lastMessage(SENDER).toMap().value(_TYPE).toString() == "messageSenderChat"; + return lastMessage(SENDER_ID).toMap().value(_TYPE).toString() == "messageSenderChat"; } qlonglong ChatListModel::ChatData::senderMessageDate() const @@ -192,7 +192,7 @@ qlonglong ChatListModel::ChatData::senderMessageDate() const QString ChatListModel::ChatData::senderMessageText() const { qlonglong myUserId = tdLibWrapper->getUserInformation().value(ID).toLongLong(); - return FernschreiberUtils::getMessageShortText(tdLibWrapper, lastMessage(CONTENT).toMap(), isChannel(), myUserId, lastMessage(SENDER).toMap() ); + return FernschreiberUtils::getMessageShortText(tdLibWrapper, lastMessage(CONTENT).toMap(), isChannel(), myUserId, lastMessage(SENDER_ID).toMap() ); } diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 5a516bd..22f1fd9 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -35,7 +35,7 @@ namespace { const QString UNREAD_COUNT("unread_count"); const QString LAST_READ_INBOX_MESSAGE_ID("last_read_inbox_message_id"); const QString LAST_READ_OUTBOX_MESSAGE_ID("last_read_outbox_message_id"); - const QString SENDER("sender"); + const QString SENDER_ID("sender_id"); const QString USER_ID("user_id"); const QString PINNED_MESSAGE_ID("pinned_message_id"); const QString REPLY_MARKUP("reply_markup"); @@ -129,17 +129,17 @@ QVector ChatModel::MessageData::flagsToRoles(uint flags) int ChatModel::MessageData::senderUserId() const { - return messageData.value(SENDER).toMap().value(USER_ID).toInt(); + return messageData.value(SENDER_ID).toMap().value(USER_ID).toInt(); } qlonglong ChatModel::MessageData::senderChatId() const { - return messageData.value(SENDER).toMap().value(CHAT_ID).toLongLong(); + return messageData.value(SENDER_ID).toMap().value(CHAT_ID).toLongLong(); } bool ChatModel::MessageData::senderIsChat() const { - return messageData.value(SENDER).toMap().value(_TYPE).toString() == "messageSenderChat"; + return messageData.value(SENDER_ID).toMap().value(_TYPE).toString() == "messageSenderChat"; } QVector ChatModel::MessageData::diff(const MessageData *message) const diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index b887d08..f814d9a 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -43,7 +43,7 @@ namespace { const QString MESSAGE("message"); const QString FIRST_NAME("first_name"); const QString LAST_NAME("last_name"); - const QString SENDER("sender"); + const QString SENDER_ID("sender_id"); const QString USER_ID("user_id"); const QString NOTIFICATIONS("notifications"); const QString NOTIFICATION_GROUP_ID("notification_group_id"); @@ -336,7 +336,7 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat } QString notificationBody; - const QVariantMap senderInformation = messageMap.value(SENDER).toMap(); + const QVariantMap senderInformation = messageMap.value(SENDER_ID).toMap(); if (notificationGroup->totalCount == 1 && !messageMap.isEmpty()) { LOG("Group" << notificationGroup->notificationGroupId << "has 1 notification"); if (chatInformation && (chatInformation->type == TDLibWrapper::ChatTypeBasicGroup || diff --git a/tdlib/include/td/telegram/Client.h b/tdlib/include/td/telegram/Client.h index 1e3bc29..211d17f 100644 --- a/tdlib/include/td/telegram/Client.h +++ b/tdlib/include/td/telegram/Client.h @@ -17,122 +17,7 @@ namespace td { /** - * Native C++ interface for interaction with TDLib. - * - * The TDLib instance is created for the lifetime of the Client object. - * Requests to TDLib can be sent using the Client::send method from any thread. - * New updates and responses to requests can be received using the Client::receive method from any thread, - * this function must not be called simultaneously from two different threads. Also note that all updates and - * responses to requests should be applied in the same order as they were received, to ensure consistency. - * Given this information, it's advisable to call this function from a dedicated thread. - * Some service TDLib requests can be executed synchronously from any thread using the Client::execute method. - * - * General pattern of usage: - * \code - * std::shared_ptr client = std::make_shared(); - * // somehow share the client with other threads, which will be able to send requests via client->send - * - * const double WAIT_TIMEOUT = 10.0; // seconds - * bool is_closed = false; // should be set to true, when updateAuthorizationState with - * // authorizationStateClosed is received - * while (!is_closed) { - * auto response = client->receive(WAIT_TIMEOUT); - * if (response.object == nullptr) { - * continue; - * } - * - * if (response.id == 0) { - * // process response.object as an incoming update of type td_api::Update - * } else { - * // process response.object as an answer to a sent request with id response.id - * } - * } - * \endcode - */ -class Client final { - public: - /** - * Creates a new TDLib client. - */ - Client(); - - /** - * A request to the TDLib. - */ - struct Request { - /** - * Request identifier. - * Responses to TDLib requests will have the same id as the corresponding request. - * Updates from TDLib will have id == 0, incoming requests are thus disallowed to have id == 0. - */ - std::uint64_t id; - - /** - * TDLib API function representing a request to TDLib. - */ - td_api::object_ptr function; - }; - - /** - * Sends request to TDLib. May be called from any thread. - * \param[in] request Request to TDLib. - */ - void send(Request &&request); - - /** - * A response to a request, or an incoming update from TDLib. - */ - struct Response { - /** - * TDLib request identifier, which corresponds to the response, or 0 for incoming updates from TDLib. - */ - std::uint64_t id; - - /** - * TDLib API object representing a response to a TDLib request or an incoming update. - */ - td_api::object_ptr object; - }; - - /** - * Receives incoming updates and request responses from TDLib. May be called from any thread, but shouldn't be - * called simultaneously from two different threads. - * \param[in] timeout The maximum number of seconds allowed for this function to wait for new data. - * \return An incoming update or request response. The object returned in the response may be a nullptr - * if the timeout expires. - */ - Response receive(double timeout); - - /** - * Synchronously executes TDLib requests. Only a few requests can be executed synchronously. - * May be called from any thread. - * \param[in] request Request to the TDLib. - * \return The request response. - */ - static Response execute(Request &&request); - - /** - * Destroys the client and TDLib instance. - */ - ~Client(); - - /** - * Move constructor. - */ - Client(Client &&other) noexcept; - - /** - * Move assignment operator. - */ - Client &operator=(Client &&other) noexcept; - - private: - class Impl; - std::unique_ptr impl_; -}; - -/** - * The future native C++ interface for interaction with TDLib. + * The native C++ interface for interaction with TDLib. * * A TDLib client instance can be created through the method ClientManager::create_client_id. * Requests can be sent using the method ClientManager::send from any thread. @@ -286,4 +171,119 @@ class ClientManager final { std::unique_ptr impl_; }; +/** + * Old native C++ interface for interaction with TDLib to be removed in TDLib 2.0.0. + * + * The TDLib instance is created for the lifetime of the Client object. + * Requests to TDLib can be sent using the Client::send method from any thread. + * New updates and responses to requests can be received using the Client::receive method from any thread, + * this function must not be called simultaneously from two different threads. Also note that all updates and + * responses to requests should be applied in the same order as they were received, to ensure consistency. + * Given this information, it's advisable to call this function from a dedicated thread. + * Some service TDLib requests can be executed synchronously from any thread using the Client::execute method. + * + * General pattern of usage: + * \code + * std::shared_ptr client = std::make_shared(); + * // somehow share the client with other threads, which will be able to send requests via client->send + * + * const double WAIT_TIMEOUT = 10.0; // seconds + * bool is_closed = false; // should be set to true, when updateAuthorizationState with + * // authorizationStateClosed is received + * while (!is_closed) { + * auto response = client->receive(WAIT_TIMEOUT); + * if (response.object == nullptr) { + * continue; + * } + * + * if (response.id == 0) { + * // process response.object as an incoming update of type td_api::Update + * } else { + * // process response.object as an answer to a sent request with id response.id + * } + * } + * \endcode + */ +class Client final { + public: + /** + * Creates a new TDLib client. + */ + Client(); + + /** + * A request to the TDLib. + */ + struct Request { + /** + * Request identifier. + * Responses to TDLib requests will have the same id as the corresponding request. + * Updates from TDLib will have id == 0, incoming requests are thus disallowed to have id == 0. + */ + std::uint64_t id; + + /** + * TDLib API function representing a request to TDLib. + */ + td_api::object_ptr function; + }; + + /** + * Sends request to TDLib. May be called from any thread. + * \param[in] request Request to TDLib. + */ + void send(Request &&request); + + /** + * A response to a request, or an incoming update from TDLib. + */ + struct Response { + /** + * TDLib request identifier, which corresponds to the response, or 0 for incoming updates from TDLib. + */ + std::uint64_t id; + + /** + * TDLib API object representing a response to a TDLib request or an incoming update. + */ + td_api::object_ptr object; + }; + + /** + * Receives incoming updates and request responses from TDLib. May be called from any thread, but shouldn't be + * called simultaneously from two different threads. + * \param[in] timeout The maximum number of seconds allowed for this function to wait for new data. + * \return An incoming update or request response. The object returned in the response may be a nullptr + * if the timeout expires. + */ + Response receive(double timeout); + + /** + * Synchronously executes TDLib requests. Only a few requests can be executed synchronously. + * May be called from any thread. + * \param[in] request Request to the TDLib. + * \return The request response. + */ + static Response execute(Request &&request); + + /** + * Destroys the client and TDLib instance. + */ + ~Client(); + + /** + * Move constructor. + */ + Client(Client &&other) noexcept; + + /** + * Move assignment operator. + */ + Client &operator=(Client &&other) noexcept; + + private: + class Impl; + std::unique_ptr impl_; +}; + } // namespace td diff --git a/tdlib/include/td/telegram/td_api.h b/tdlib/include/td/telegram/td_api.h index 20ea31f..dc4b818 100644 --- a/tdlib/include/td/telegram/td_api.h +++ b/tdlib/include/td/telegram/td_api.h @@ -230,8 +230,6 @@ class CheckStickerSetNameResult; class closedVectorPath; -class colorReplacement; - class connectedWebsite; class connectedWebsites; @@ -568,8 +566,6 @@ class shippingOption; class sponsoredMessage; -class sponsoredMessages; - class StatisticalGraph; class statisticalValue; @@ -750,14 +746,14 @@ class animatedChatPhoto final : public Object { class animatedEmoji final : public Object { public: object_ptr sticker_; - array> color_replacements_; + int32 fitzpatrick_type_; object_ptr sound_; animatedEmoji(); - animatedEmoji(object_ptr &&sticker_, array> &&color_replacements_, object_ptr &&sound_); + animatedEmoji(object_ptr &&sticker_, int32 fitzpatrick_type_, object_ptr &&sound_); - static const std::int32_t ID = 1130906050; + static const std::int32_t ID = -1816658231; std::int32_t get_id() const final { return ID; } @@ -915,6 +911,23 @@ class authenticationCodeTypeFlashCall final : public AuthenticationCodeType { void store(TlStorerToString &s, const char *field_name) const final; }; +class authenticationCodeTypeMissedCall final : public AuthenticationCodeType { + public: + string phone_number_prefix_; + int32 length_; + + authenticationCodeTypeMissedCall(); + + authenticationCodeTypeMissedCall(string const &phone_number_prefix_, int32 length_); + + static const std::int32_t ID = 700123783; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class AuthorizationState: public Object { public: }; @@ -2030,6 +2043,8 @@ class chat final : public Object { object_ptr permissions_; object_ptr last_message_; array> positions_; + object_ptr message_sender_id_; + bool has_protected_content_; bool is_marked_as_unread_; bool is_blocked_; bool has_scheduled_messages_; @@ -2042,7 +2057,7 @@ class chat final : public Object { int53 last_read_outbox_message_id_; int32 unread_mention_count_; object_ptr notification_settings_; - int32 message_ttl_setting_; + int32 message_ttl_; string theme_name_; object_ptr action_bar_; object_ptr video_chat_; @@ -2053,9 +2068,9 @@ class chat final : public Object { chat(); - chat(int53 id_, object_ptr &&type_, string const &title_, object_ptr &&photo_, object_ptr &&permissions_, object_ptr &&last_message_, array> &&positions_, bool is_marked_as_unread_, bool is_blocked_, bool has_scheduled_messages_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_be_reported_, bool default_disable_notification_, int32 unread_count_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int32 unread_mention_count_, object_ptr &¬ification_settings_, int32 message_ttl_setting_, string const &theme_name_, object_ptr &&action_bar_, object_ptr &&video_chat_, object_ptr &&pending_join_requests_, int53 reply_markup_message_id_, object_ptr &&draft_message_, string const &client_data_); + chat(int53 id_, object_ptr &&type_, string const &title_, object_ptr &&photo_, object_ptr &&permissions_, object_ptr &&last_message_, array> &&positions_, object_ptr &&message_sender_id_, bool has_protected_content_, bool is_marked_as_unread_, bool is_blocked_, bool has_scheduled_messages_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_be_reported_, bool default_disable_notification_, int32 unread_count_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int32 unread_mention_count_, object_ptr &¬ification_settings_, int32 message_ttl_, string const &theme_name_, object_ptr &&action_bar_, object_ptr &&video_chat_, object_ptr &&pending_join_requests_, int53 reply_markup_message_id_, object_ptr &&draft_message_, string const &client_data_); - static const std::int32_t ID = -655973775; + static const std::int32_t ID = 1617921149; std::int32_t get_id() const final { return ID; } @@ -2369,6 +2384,24 @@ class chatActionBarSharePhoneNumber final : public ChatActionBar { void store(TlStorerToString &s, const char *field_name) const final; }; +class chatActionBarJoinRequest final : public ChatActionBar { + public: + string title_; + bool is_channel_; + int32 request_date_; + + chatActionBarJoinRequest(); + + chatActionBarJoinRequest(string const &title_, bool is_channel_, int32 request_date_); + + static const std::int32_t ID = 1037140744; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class chatAdministrator final : public Object { public: int53 user_id_; @@ -2407,14 +2440,14 @@ class chatEvent final : public Object { public: int64 id_; int32 date_; - int53 user_id_; + object_ptr member_id_; object_ptr action_; chatEvent(); - chatEvent(int64 id_, int32 date_, int53 user_id_, object_ptr &&action_); + chatEvent(int64 id_, int32 date_, object_ptr &&member_id_, object_ptr &&action_); - static const std::int32_t ID = -99101703; + static const std::int32_t ID = -652102704; std::int32_t get_id() const final { return ID; } @@ -2754,16 +2787,16 @@ class chatEventSlowModeDelayChanged final : public ChatEventAction { void store(TlStorerToString &s, const char *field_name) const final; }; -class chatEventMessageTtlSettingChanged final : public ChatEventAction { +class chatEventMessageTtlChanged final : public ChatEventAction { public: - int32 old_message_ttl_setting_; - int32 new_message_ttl_setting_; + int32 old_message_ttl_; + int32 new_message_ttl_; - chatEventMessageTtlSettingChanged(); + chatEventMessageTtlChanged(); - chatEventMessageTtlSettingChanged(int32 old_message_ttl_setting_, int32 new_message_ttl_setting_); + chatEventMessageTtlChanged(int32 old_message_ttl_, int32 new_message_ttl_); - static const std::int32_t ID = -1340179286; + static const std::int32_t ID = 776386995; std::int32_t get_id() const final { return ID; } @@ -2787,6 +2820,22 @@ class chatEventSignMessagesToggled final : public ChatEventAction { void store(TlStorerToString &s, const char *field_name) const final; }; +class chatEventHasProtectedContentToggled final : public ChatEventAction { + public: + bool has_protected_content_; + + chatEventHasProtectedContentToggled(); + + explicit chatEventHasProtectedContentToggled(bool has_protected_content_); + + static const std::int32_t ID = -184270335; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class chatEventStickerSetChanged final : public ChatEventAction { public: int64 old_sticker_set_id_; @@ -2902,15 +2951,15 @@ class chatEventVideoChatCreated final : public ChatEventAction { void store(TlStorerToString &s, const char *field_name) const final; }; -class chatEventVideoChatDiscarded final : public ChatEventAction { +class chatEventVideoChatEnded final : public ChatEventAction { public: int32 group_call_id_; - chatEventVideoChatDiscarded(); + chatEventVideoChatEnded(); - explicit chatEventVideoChatDiscarded(int32 group_call_id_); + explicit chatEventVideoChatEnded(int32 group_call_id_); - static const std::int32_t ID = -774616761; + static const std::int32_t ID = 1630039112; std::int32_t get_id() const final { return ID; } @@ -3064,7 +3113,7 @@ class chatInviteLink final : public Object { int53 creator_user_id_; int32 date_; int32 edit_date_; - int32 expire_date_; + int32 expiration_date_; int32 member_limit_; int32 member_count_; int32 pending_join_request_count_; @@ -3074,9 +3123,9 @@ class chatInviteLink final : public Object { chatInviteLink(); - chatInviteLink(string const &invite_link_, string const &name_, int53 creator_user_id_, int32 date_, int32 edit_date_, int32 expire_date_, int32 member_limit_, int32 member_count_, int32 pending_join_request_count_, bool creates_join_request_, bool is_primary_, bool is_revoked_); + chatInviteLink(string const &invite_link_, string const &name_, int53 creator_user_id_, int32 date_, int32 edit_date_, int32 expiration_date_, int32 member_limit_, int32 member_count_, int32 pending_join_request_count_, bool creates_join_request_, bool is_primary_, bool is_revoked_); - static const std::int32_t ID = 27751711; + static const std::int32_t ID = -205812476; std::int32_t get_id() const final { return ID; } @@ -4239,23 +4288,6 @@ class closedVectorPath final : public Object { void store(TlStorerToString &s, const char *field_name) const final; }; -class colorReplacement final : public Object { - public: - int32 old_color_; - int32 new_color_; - - colorReplacement(); - - colorReplacement(int32 old_color_, int32 new_color_); - - static const std::int32_t ID = -1463786596; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class connectedWebsite final : public Object { public: int64 id_; @@ -5611,6 +5643,22 @@ class inlineKeyboardButtonTypeBuy final : public InlineKeyboardButtonType { void store(TlStorerToString &s, const char *field_name) const final; }; +class inlineKeyboardButtonTypeUser final : public InlineKeyboardButtonType { + public: + int53 user_id_; + + inlineKeyboardButtonTypeUser(); + + explicit inlineKeyboardButtonTypeUser(int53 user_id_); + + static const std::int32_t ID = 1836574114; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class InlineQueryResult: public Object { public: }; @@ -8163,7 +8211,7 @@ class maskPosition final : public Object { class message final : public Object { public: int53 id_; - object_ptr sender_; + object_ptr sender_id_; int53 chat_id_; object_ptr sending_state_; object_ptr scheduling_state_; @@ -8171,6 +8219,7 @@ class message final : public Object { bool is_pinned_; bool can_be_edited_; bool can_be_forwarded_; + bool can_be_saved_; bool can_be_deleted_only_for_self_; bool can_be_deleted_for_all_users_; bool can_get_statistics_; @@ -8198,9 +8247,9 @@ class message final : public Object { message(); - message(int53 id_, object_ptr &&sender_, int53 chat_id_, object_ptr &&sending_state_, object_ptr &&scheduling_state_, bool is_outgoing_, bool is_pinned_, bool can_be_edited_, bool can_be_forwarded_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_get_statistics_, bool can_get_message_thread_, bool can_get_viewers_, bool can_get_media_timestamp_links_, bool has_timestamped_media_, bool is_channel_post_, bool contains_unread_mention_, int32 date_, int32 edit_date_, object_ptr &&forward_info_, object_ptr &&interaction_info_, int53 reply_in_chat_id_, int53 reply_to_message_id_, int53 message_thread_id_, int32 ttl_, double ttl_expires_in_, int53 via_bot_user_id_, string const &author_signature_, int64 media_album_id_, string const &restriction_reason_, object_ptr &&content_, object_ptr &&reply_markup_); + message(int53 id_, object_ptr &&sender_id_, int53 chat_id_, object_ptr &&sending_state_, object_ptr &&scheduling_state_, bool is_outgoing_, bool is_pinned_, bool can_be_edited_, bool can_be_forwarded_, bool can_be_saved_, bool can_be_deleted_only_for_self_, bool can_be_deleted_for_all_users_, bool can_get_statistics_, bool can_get_message_thread_, bool can_get_viewers_, bool can_get_media_timestamp_links_, bool has_timestamped_media_, bool is_channel_post_, bool contains_unread_mention_, int32 date_, int32 edit_date_, object_ptr &&forward_info_, object_ptr &&interaction_info_, int53 reply_in_chat_id_, int53 reply_to_message_id_, int53 message_thread_id_, int32 ttl_, double ttl_expires_in_, int53 via_bot_user_id_, string const &author_signature_, int64 media_album_id_, string const &restriction_reason_, object_ptr &&content_, object_ptr &&reply_markup_); - static const std::int32_t ID = -484595207; + static const std::int32_t ID = -961280585; std::int32_t get_id() const final { return ID; } @@ -9027,15 +9076,15 @@ class messagePassportDataReceived final : public MessageContent { class messageProximityAlertTriggered final : public MessageContent { public: - object_ptr traveler_; - object_ptr watcher_; + object_ptr traveler_id_; + object_ptr watcher_id_; int32 distance_; messageProximityAlertTriggered(); - messageProximityAlertTriggered(object_ptr &&traveler_, object_ptr &&watcher_, int32 distance_); + messageProximityAlertTriggered(object_ptr &&traveler_id_, object_ptr &&watcher_id_, int32 distance_); - static const std::int32_t ID = -1311617562; + static const std::int32_t ID = 67761875; std::int32_t get_id() const final { return ID; } @@ -9324,16 +9373,16 @@ class messagePositions final : public Object { class messageReplyInfo final : public Object { public: int32 reply_count_; - array> recent_repliers_; + array> recent_replier_ids_; int53 last_read_inbox_message_id_; int53 last_read_outbox_message_id_; int53 last_message_id_; messageReplyInfo(); - messageReplyInfo(int32 reply_count_, array> &&recent_repliers_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int53 last_message_id_); + messageReplyInfo(int32 reply_count_, array> &&recent_replier_ids_, int53 last_read_inbox_message_id_, int53 last_read_outbox_message_id_, int53 last_message_id_); - static const std::int32_t ID = -1443221826; + static const std::int32_t ID = -2093702263; std::int32_t get_id() const final { return ID; } @@ -9467,13 +9516,14 @@ class messageSendingStateFailed final : public MessageSendingState { int32 error_code_; string error_message_; bool can_retry_; + bool need_another_sender_; double retry_after_; messageSendingStateFailed(); - messageSendingStateFailed(int32 error_code_, string const &error_message_, bool can_retry_, double retry_after_); + messageSendingStateFailed(int32 error_code_, string const &error_message_, bool can_retry_, bool need_another_sender_, double retry_after_); - static const std::int32_t ID = 2054476087; + static const std::int32_t ID = -1741887228; std::int32_t get_id() const final { return ID; } @@ -9871,16 +9921,16 @@ class notificationTypeNewCall final : public NotificationType { class notificationTypeNewPushMessage final : public NotificationType { public: int53 message_id_; - object_ptr sender_; + object_ptr sender_id_; string sender_name_; bool is_outgoing_; object_ptr content_; notificationTypeNewPushMessage(); - notificationTypeNewPushMessage(int53 message_id_, object_ptr &&sender_, string const &sender_name_, bool is_outgoing_, object_ptr &&content_); + notificationTypeNewPushMessage(int53 message_id_, object_ptr &&sender_id_, string const &sender_name_, bool is_outgoing_, object_ptr &&content_); - static const std::int32_t ID = -1999850882; + static const std::int32_t ID = -711680462; std::int32_t get_id() const final { return ID; } @@ -11444,14 +11494,16 @@ class personalDocument final : public Object { class phoneNumberAuthenticationSettings final : public Object { public: bool allow_flash_call_; + bool allow_missed_call_; bool is_current_phone_number_; bool allow_sms_retriever_api_; + array authentication_tokens_; phoneNumberAuthenticationSettings(); - phoneNumberAuthenticationSettings(bool allow_flash_call_, bool is_current_phone_number_, bool allow_sms_retriever_api_); + phoneNumberAuthenticationSettings(bool allow_flash_call_, bool allow_missed_call_, bool is_current_phone_number_, bool allow_sms_retriever_api_, array &&authentication_tokens_); - static const std::int32_t ID = -859198743; + static const std::int32_t ID = -421219756; std::int32_t get_id() const final { return ID; } @@ -12885,32 +12937,6 @@ class searchMessagesFilterChatPhoto final : public SearchMessagesFilter { void store(TlStorerToString &s, const char *field_name) const final; }; -class searchMessagesFilterCall final : public SearchMessagesFilter { - public: - - searchMessagesFilterCall(); - - static const std::int32_t ID = 1305231012; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class searchMessagesFilterMissedCall final : public SearchMessagesFilter { - public: - - searchMessagesFilterMissedCall(); - - static const std::int32_t ID = 970663098; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class searchMessagesFilterVideoNote final : public SearchMessagesFilter { public: @@ -13074,6 +13100,8 @@ class session final : public Object { int64 id_; bool is_current_; bool is_password_pending_; + bool can_accept_secret_chats_; + bool can_accept_calls_; int32 api_id_; string application_name_; string application_version_; @@ -13089,9 +13117,9 @@ class session final : public Object { session(); - session(int64 id_, bool is_current_, bool is_password_pending_, int32 api_id_, string const &application_name_, string const &application_version_, bool is_official_application_, string const &device_model_, string const &platform_, string const &system_version_, int32 log_in_date_, int32 last_active_date_, string const &ip_, string const &country_, string const ®ion_); + session(int64 id_, bool is_current_, bool is_password_pending_, bool can_accept_secret_chats_, bool can_accept_calls_, int32 api_id_, string const &application_name_, string const &application_version_, bool is_official_application_, string const &device_model_, string const &platform_, string const &system_version_, int32 log_in_date_, int32 last_active_date_, string const &ip_, string const &country_, string const ®ion_); - static const std::int32_t ID = 1920553176; + static const std::int32_t ID = 1068672887; std::int32_t get_id() const final { return ID; } @@ -13102,12 +13130,13 @@ class session final : public Object { class sessions final : public Object { public: array> sessions_; + int32 inactive_session_ttl_days_; sessions(); - explicit sessions(array> &&sessions_); + sessions(array> &&sessions_, int32 inactive_session_ttl_days_); - static const std::int32_t ID = -463118121; + static const std::int32_t ID = 842912274; std::int32_t get_id() const final { return ID; } @@ -13135,32 +13164,16 @@ class shippingOption final : public Object { class sponsoredMessage final : public Object { public: - int32 id_; + int53 message_id_; int53 sponsor_chat_id_; object_ptr link_; object_ptr content_; sponsoredMessage(); - sponsoredMessage(int32 id_, int53 sponsor_chat_id_, object_ptr &&link_, object_ptr &&content_); + sponsoredMessage(int53 message_id_, int53 sponsor_chat_id_, object_ptr &&link_, object_ptr &&content_); - static const std::int32_t ID = 217830434; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class sponsoredMessages final : public Object { - public: - array> messages_; - - sponsoredMessages(); - - explicit sponsoredMessages(array> &&messages_); - - static const std::int32_t ID = -2083804091; + static const std::int32_t ID = -1734768993; std::int32_t get_id() const final { return ID; } @@ -13471,12 +13484,12 @@ class suggestedActionCheckPhoneNumber final : public SuggestedAction { void store(TlStorerToString &s, const char *field_name) const final; }; -class suggestedActionSeeTicksHint final : public SuggestedAction { +class suggestedActionViewChecksHint final : public SuggestedAction { public: - suggestedActionSeeTicksHint(); + suggestedActionViewChecksHint(); - static const std::int32_t ID = 1061871714; + static const std::int32_t ID = 891303239; std::int32_t get_id() const final { return ID; } @@ -13500,6 +13513,22 @@ class suggestedActionConvertToBroadcastGroup final : public SuggestedAction { void store(TlStorerToString &s, const char *field_name) const final; }; +class suggestedActionSetPassword final : public SuggestedAction { + public: + int32 authorization_delay_; + + suggestedActionSetPassword(); + + explicit suggestedActionSetPassword(int32 authorization_delay_); + + static const std::int32_t ID = 1863613848; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class supergroup final : public Object { public: int53 id_; @@ -14833,91 +14862,6 @@ class updateChatPosition final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; -class updateChatIsMarkedAsUnread final : public Update { - public: - int53 chat_id_; - bool is_marked_as_unread_; - - updateChatIsMarkedAsUnread(); - - updateChatIsMarkedAsUnread(int53 chat_id_, bool is_marked_as_unread_); - - static const std::int32_t ID = 1468347188; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatIsBlocked final : public Update { - public: - int53 chat_id_; - bool is_blocked_; - - updateChatIsBlocked(); - - updateChatIsBlocked(int53 chat_id_, bool is_blocked_); - - static const std::int32_t ID = -1998946752; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatHasScheduledMessages final : public Update { - public: - int53 chat_id_; - bool has_scheduled_messages_; - - updateChatHasScheduledMessages(); - - updateChatHasScheduledMessages(int53 chat_id_, bool has_scheduled_messages_); - - static const std::int32_t ID = 2064958167; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatVideoChat final : public Update { - public: - int53 chat_id_; - object_ptr video_chat_; - - updateChatVideoChat(); - - updateChatVideoChat(int53 chat_id_, object_ptr &&video_chat_); - - static const std::int32_t ID = 637226150; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatDefaultDisableNotification final : public Update { - public: - int53 chat_id_; - bool default_disable_notification_; - - updateChatDefaultDisableNotification(); - - updateChatDefaultDisableNotification(int53 chat_id_, bool default_disable_notification_); - - static const std::int32_t ID = 464087707; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class updateChatReadInbox final : public Update { public: int53 chat_id_; @@ -14953,74 +14897,6 @@ class updateChatReadOutbox final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; -class updateChatUnreadMentionCount final : public Update { - public: - int53 chat_id_; - int32 unread_mention_count_; - - updateChatUnreadMentionCount(); - - updateChatUnreadMentionCount(int53 chat_id_, int32 unread_mention_count_); - - static const std::int32_t ID = -2131461348; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatNotificationSettings final : public Update { - public: - int53 chat_id_; - object_ptr notification_settings_; - - updateChatNotificationSettings(); - - updateChatNotificationSettings(int53 chat_id_, object_ptr &¬ification_settings_); - - static const std::int32_t ID = -803163050; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateScopeNotificationSettings final : public Update { - public: - object_ptr scope_; - object_ptr notification_settings_; - - updateScopeNotificationSettings(); - - updateScopeNotificationSettings(object_ptr &&scope_, object_ptr &¬ification_settings_); - - static const std::int32_t ID = -1203975309; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - -class updateChatMessageTtlSetting final : public Update { - public: - int53 chat_id_; - int32 message_ttl_setting_; - - updateChatMessageTtlSetting(); - - updateChatMessageTtlSetting(int53 chat_id_, int32 message_ttl_setting_); - - static const std::int32_t ID = 970801976; - std::int32_t get_id() const final { - return ID; - } - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class updateChatActionBar final : public Update { public: int53 chat_id_; @@ -15038,16 +14914,68 @@ class updateChatActionBar final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; -class updateChatTheme final : public Update { +class updateChatDraftMessage final : public Update { public: int53 chat_id_; - string theme_name_; + object_ptr draft_message_; + array> positions_; - updateChatTheme(); + updateChatDraftMessage(); - updateChatTheme(int53 chat_id_, string const &theme_name_); + updateChatDraftMessage(int53 chat_id_, object_ptr &&draft_message_, array> &&positions_); - static const std::int32_t ID = 838063205; + static const std::int32_t ID = 1455190380; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatMessageSender final : public Update { + public: + int53 chat_id_; + object_ptr message_sender_id_; + + updateChatMessageSender(); + + updateChatMessageSender(int53 chat_id_, object_ptr &&message_sender_id_); + + static const std::int32_t ID = 2003849793; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatMessageTtl final : public Update { + public: + int53 chat_id_; + int32 message_ttl_; + + updateChatMessageTtl(); + + updateChatMessageTtl(int53 chat_id_, int32 message_ttl_); + + static const std::int32_t ID = -572479112; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatNotificationSettings final : public Update { + public: + int53 chat_id_; + object_ptr notification_settings_; + + updateChatNotificationSettings(); + + updateChatNotificationSettings(int53 chat_id_, object_ptr &¬ification_settings_); + + static const std::int32_t ID = -803163050; std::int32_t get_id() const final { return ID; } @@ -15089,17 +15017,135 @@ class updateChatReplyMarkup final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; -class updateChatDraftMessage final : public Update { +class updateChatTheme final : public Update { public: int53 chat_id_; - object_ptr draft_message_; - array> positions_; + string theme_name_; - updateChatDraftMessage(); + updateChatTheme(); - updateChatDraftMessage(int53 chat_id_, object_ptr &&draft_message_, array> &&positions_); + updateChatTheme(int53 chat_id_, string const &theme_name_); - static const std::int32_t ID = 1455190380; + static const std::int32_t ID = 838063205; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatUnreadMentionCount final : public Update { + public: + int53 chat_id_; + int32 unread_mention_count_; + + updateChatUnreadMentionCount(); + + updateChatUnreadMentionCount(int53 chat_id_, int32 unread_mention_count_); + + static const std::int32_t ID = -2131461348; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatVideoChat final : public Update { + public: + int53 chat_id_; + object_ptr video_chat_; + + updateChatVideoChat(); + + updateChatVideoChat(int53 chat_id_, object_ptr &&video_chat_); + + static const std::int32_t ID = 637226150; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatDefaultDisableNotification final : public Update { + public: + int53 chat_id_; + bool default_disable_notification_; + + updateChatDefaultDisableNotification(); + + updateChatDefaultDisableNotification(int53 chat_id_, bool default_disable_notification_); + + static const std::int32_t ID = 464087707; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatHasProtectedContent final : public Update { + public: + int53 chat_id_; + bool has_protected_content_; + + updateChatHasProtectedContent(); + + updateChatHasProtectedContent(int53 chat_id_, bool has_protected_content_); + + static const std::int32_t ID = 1800406811; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatHasScheduledMessages final : public Update { + public: + int53 chat_id_; + bool has_scheduled_messages_; + + updateChatHasScheduledMessages(); + + updateChatHasScheduledMessages(int53 chat_id_, bool has_scheduled_messages_); + + static const std::int32_t ID = 2064958167; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatIsBlocked final : public Update { + public: + int53 chat_id_; + bool is_blocked_; + + updateChatIsBlocked(); + + updateChatIsBlocked(int53 chat_id_, bool is_blocked_); + + static const std::int32_t ID = -1998946752; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class updateChatIsMarkedAsUnread final : public Update { + public: + int53 chat_id_; + bool is_marked_as_unread_; + + updateChatIsMarkedAsUnread(); + + updateChatIsMarkedAsUnread(int53 chat_id_, bool is_marked_as_unread_); + + static const std::int32_t ID = 1468347188; std::int32_t get_id() const final { return ID; } @@ -15140,6 +15186,23 @@ class updateChatOnlineMemberCount final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; +class updateScopeNotificationSettings final : public Update { + public: + object_ptr scope_; + object_ptr notification_settings_; + + updateScopeNotificationSettings(); + + updateScopeNotificationSettings(object_ptr &&scope_, object_ptr &¬ification_settings_); + + static const std::int32_t ID = -1203975309; + std::int32_t get_id() const final { + return ID; + } + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class updateNotification final : public Update { public: int32 notification_group_id_; @@ -15232,18 +15295,18 @@ class updateDeleteMessages final : public Update { void store(TlStorerToString &s, const char *field_name) const final; }; -class updateUserChatAction final : public Update { +class updateChatAction final : public Update { public: int53 chat_id_; int53 message_thread_id_; - int53 user_id_; + object_ptr sender_id_; object_ptr action_; - updateUserChatAction(); + updateChatAction(); - updateUserChatAction(int53 chat_id_, int53 message_thread_id_, int53 user_id_, object_ptr &&action_); + updateChatAction(int53 chat_id_, int53 message_thread_id_, object_ptr &&sender_id_, object_ptr &&action_); - static const std::int32_t ID = -335624953; + static const std::int32_t ID = -1698703832; std::int32_t get_id() const final { return ID; } @@ -16141,6 +16204,7 @@ class userFullInfo final : public Object { bool can_be_called_; bool supports_video_calls_; bool has_private_calls_; + bool has_private_forwards_; bool need_phone_number_privacy_exception_; string bio_; string share_text_; @@ -16150,9 +16214,9 @@ class userFullInfo final : public Object { userFullInfo(); - userFullInfo(object_ptr &&photo_, bool is_blocked_, bool can_be_called_, bool supports_video_calls_, bool has_private_calls_, bool need_phone_number_privacy_exception_, string const &bio_, string const &share_text_, string const &description_, int32 group_in_common_count_, array> &&commands_); + userFullInfo(object_ptr &&photo_, bool is_blocked_, bool can_be_called_, bool supports_video_calls_, bool has_private_calls_, bool has_private_forwards_, bool need_phone_number_privacy_exception_, string const &bio_, string const &share_text_, string const &description_, int32 group_in_common_count_, array> &&commands_); - static const std::int32_t ID = -1589269389; + static const std::int32_t ID = 2138747126; std::int32_t get_id() const final { return ID; } @@ -16940,16 +17004,16 @@ class addFavoriteSticker final : public Function { class addLocalMessage final : public Function { public: int53 chat_id_; - object_ptr sender_; + object_ptr sender_id_; int53 reply_to_message_id_; bool disable_notification_; object_ptr input_message_content_; addLocalMessage(); - addLocalMessage(int53 chat_id_, object_ptr &&sender_, int53 reply_to_message_id_, bool disable_notification_, object_ptr &&input_message_content_); + addLocalMessage(int53 chat_id_, object_ptr &&sender_id_, int53 reply_to_message_id_, bool disable_notification_, object_ptr &&input_message_content_); - static const std::int32_t ID = 856399322; + static const std::int32_t ID = -1998878725; std::int32_t get_id() const final { return ID; } @@ -17196,25 +17260,6 @@ class answerShippingQuery final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class approveChatJoinRequest final : public Function { - public: - int53 chat_id_; - int53 user_id_; - - approveChatJoinRequest(); - - approveChatJoinRequest(int53 chat_id_, int53 user_id_); - - static const std::int32_t ID = -1129297147; - std::int32_t get_id() const final { - return ID; - } - - using ReturnType = object_ptr; - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class banChatMember final : public Function { public: int53 chat_id_; @@ -17885,15 +17930,15 @@ class createChatInviteLink final : public Function { public: int53 chat_id_; string name_; - int32 expire_date_; + int32 expiration_date_; int32 member_limit_; bool creates_join_request_; createChatInviteLink(); - createChatInviteLink(int53 chat_id_, string const &name_, int32 expire_date_, int32 member_limit_, bool creates_join_request_); + createChatInviteLink(int53 chat_id_, string const &name_, int32 expiration_date_, int32 member_limit_, bool creates_join_request_); - static const std::int32_t ID = 1798055812; + static const std::int32_t ID = 287744833; std::int32_t get_id() const final { return ID; } @@ -18080,25 +18125,6 @@ class createVideoChat final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class declineChatJoinRequest final : public Function { - public: - int53 chat_id_; - int53 user_id_; - - declineChatJoinRequest(); - - declineChatJoinRequest(int53 chat_id_, int53 user_id_); - - static const std::int32_t ID = 1883315046; - std::int32_t get_id() const final { - return ID; - } - - using ReturnType = object_ptr; - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class deleteAccount final : public Function { public: string reason_; @@ -18231,16 +18257,16 @@ class deleteChatMessagesByDate final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class deleteChatMessagesFromUser final : public Function { +class deleteChatMessagesBySender final : public Function { public: int53 chat_id_; - int53 user_id_; + object_ptr sender_id_; - deleteChatMessagesFromUser(); + deleteChatMessagesBySender(); - deleteChatMessagesFromUser(int53 chat_id_, int53 user_id_); + deleteChatMessagesBySender(int53 chat_id_, object_ptr &&sender_id_); - static const std::int32_t ID = 136988814; + static const std::int32_t ID = -1164235161; std::int32_t get_id() const final { return ID; } @@ -18481,24 +18507,6 @@ class discardCall final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class discardGroupCall final : public Function { - public: - int32 group_call_id_; - - discardGroupCall(); - - explicit discardGroupCall(int32 group_call_id_); - - static const std::int32_t ID = 833933657; - std::int32_t get_id() const final { - return ID; - } - - using ReturnType = object_ptr; - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class disconnectAllWebsites final : public Function { public: @@ -18578,15 +18586,15 @@ class editChatInviteLink final : public Function { int53 chat_id_; string invite_link_; string name_; - int32 expire_date_; + int32 expiration_date_; int32 member_limit_; bool creates_join_request_; editChatInviteLink(); - editChatInviteLink(int53 chat_id_, string const &invite_link_, string const &name_, int32 expire_date_, int32 member_limit_, bool creates_join_request_); + editChatInviteLink(int53 chat_id_, string const &invite_link_, string const &name_, int32 expiration_date_, int32 member_limit_, bool creates_join_request_); - static const std::int32_t ID = 2082402300; + static const std::int32_t ID = 1320303996; std::int32_t get_id() const final { return ID; } @@ -18881,6 +18889,24 @@ class enableProxy final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; +class endGroupCall final : public Function { + public: + int32 group_call_id_; + + endGroupCall(); + + explicit endGroupCall(int32 group_call_id_); + + static const std::int32_t ID = 573131959; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class endGroupCallRecording final : public Function { public: int32 group_call_id_; @@ -19325,6 +19351,24 @@ class getChatAdministrators final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; +class getChatAvailableMessageSenders final : public Function { + public: + int53 chat_id_; + + getChatAvailableMessageSenders(); + + explicit getChatAvailableMessageSenders(int53 chat_id_); + + static const std::int32_t ID = -1541571496; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class getChatEventLog final : public Function { public: int53 chat_id_; @@ -19681,20 +19725,20 @@ class getChatSparseMessagePositions final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class getChatSponsoredMessages final : public Function { +class getChatSponsoredMessage final : public Function { public: int53 chat_id_; - getChatSponsoredMessages(); + getChatSponsoredMessage(); - explicit getChatSponsoredMessages(int53 chat_id_); + explicit getChatSponsoredMessage(int53 chat_id_); - static const std::int32_t ID = 1353203864; + static const std::int32_t ID = 7520523; std::int32_t get_id() const final { return ID; } - using ReturnType = object_ptr; + using ReturnType = object_ptr; void store(TlStorerToString &s, const char *field_name) const final; }; @@ -22035,6 +22079,46 @@ class pingProxy final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; +class processChatJoinRequest final : public Function { + public: + int53 chat_id_; + int53 user_id_; + bool approve_; + + processChatJoinRequest(); + + processChatJoinRequest(int53 chat_id_, int53 user_id_, bool approve_); + + static const std::int32_t ID = 1004876963; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class processChatJoinRequests final : public Function { + public: + int53 chat_id_; + string invite_link_; + bool approve_; + + processChatJoinRequests(); + + processChatJoinRequests(int53 chat_id_, string const &invite_link_, bool approve_); + + static const std::int32_t ID = 1048722894; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class processPushNotification final : public Function { public: string payload_; @@ -22507,14 +22591,13 @@ class reportChatPhoto final : public Function { class reportSupergroupSpam final : public Function { public: int53 supergroup_id_; - int53 user_id_; array message_ids_; reportSupergroupSpam(); - reportSupergroupSpam(int53 supergroup_id_, int53 user_id_, array &&message_ids_); + reportSupergroupSpam(int53 supergroup_id_, array &&message_ids_); - static const std::int32_t ID = -1096112225; + static const std::int32_t ID = -94825000; std::int32_t get_id() const final { return ID; } @@ -22861,7 +22944,7 @@ class searchChatMessages final : public Function { public: int53 chat_id_; string query_; - object_ptr sender_; + object_ptr sender_id_; int53 from_message_id_; int32 offset_; int32 limit_; @@ -22870,9 +22953,9 @@ class searchChatMessages final : public Function { searchChatMessages(); - searchChatMessages(int53 chat_id_, string const &query_, object_ptr &&sender_, int53 from_message_id_, int32 offset_, int32 limit_, object_ptr &&filter_, int53 message_thread_id_); + searchChatMessages(int53 chat_id_, string const &query_, object_ptr &&sender_id_, int53 from_message_id_, int32 offset_, int32 limit_, object_ptr &&filter_, int53 message_thread_id_); - static const std::int32_t ID = -1700459472; + static const std::int32_t ID = -162154976; std::int32_t get_id() const final { return ID; } @@ -23726,16 +23809,35 @@ class setChatMemberStatus final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class setChatMessageTtlSetting final : public Function { +class setChatMessageSender final : public Function { + public: + int53 chat_id_; + object_ptr message_sender_id_; + + setChatMessageSender(); + + setChatMessageSender(int53 chat_id_, object_ptr &&message_sender_id_); + + static const std::int32_t ID = -1421513858; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class setChatMessageTtl final : public Function { public: int53 chat_id_; int32 ttl_; - setChatMessageTtlSetting(); + setChatMessageTtl(); - setChatMessageTtlSetting(int53 chat_id_, int32 ttl_); + setChatMessageTtl(int53 chat_id_, int32 ttl_); - static const std::int32_t ID = 316076791; + static const std::int32_t ID = -1578406279; std::int32_t get_id() const final { return ID; } @@ -24037,6 +24139,24 @@ class setGroupCallTitle final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; +class setInactiveSessionTtl final : public Function { + public: + int32 inactive_session_ttl_days_; + + setInactiveSessionTtl(); + + explicit setInactiveSessionTtl(int32 inactive_session_ttl_days_); + + static const std::int32_t ID = 1570548048; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class setInlineGameScore final : public Function { public: string inline_message_id_; @@ -24887,6 +25007,25 @@ class toggleChatDefaultDisableNotification final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; +class toggleChatHasProtectedContent final : public Function { + public: + int53 chat_id_; + bool has_protected_content_; + + toggleChatHasProtectedContent(); + + toggleChatHasProtectedContent(int53 chat_id_, bool has_protected_content_); + + static const std::int32_t ID = 975231309; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + class toggleChatIsMarkedAsUnread final : public Function { public: int53 chat_id_; @@ -25063,14 +25202,52 @@ class toggleGroupCallScreenSharingIsPaused final : public Function { class toggleMessageSenderIsBlocked final : public Function { public: - object_ptr sender_; + object_ptr sender_id_; bool is_blocked_; toggleMessageSenderIsBlocked(); - toggleMessageSenderIsBlocked(object_ptr &&sender_, bool is_blocked_); + toggleMessageSenderIsBlocked(object_ptr &&sender_id_, bool is_blocked_); - static const std::int32_t ID = -760132705; + static const std::int32_t ID = -2008084779; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class toggleSessionCanAcceptCalls final : public Function { + public: + int64 session_id_; + bool can_accept_calls_; + + toggleSessionCanAcceptCalls(); + + toggleSessionCanAcceptCalls(int64 session_id_, bool can_accept_calls_); + + static const std::int32_t ID = 1819027208; + std::int32_t get_id() const final { + return ID; + } + + using ReturnType = object_ptr; + + void store(TlStorerToString &s, const char *field_name) const final; +}; + +class toggleSessionCanAcceptSecretChats final : public Function { + public: + int64 session_id_; + bool can_accept_secret_chats_; + + toggleSessionCanAcceptSecretChats(); + + toggleSessionCanAcceptSecretChats(int64 session_id_, bool can_accept_secret_chats_); + + static const std::int32_t ID = 1000843390; std::int32_t get_id() const final { return ID; } @@ -25292,25 +25469,6 @@ class viewMessages final : public Function { void store(TlStorerToString &s, const char *field_name) const final; }; -class viewSponsoredMessage final : public Function { - public: - int53 chat_id_; - int32 sponsored_message_id_; - - viewSponsoredMessage(); - - viewSponsoredMessage(int53 chat_id_, int32 sponsored_message_id_); - - static const std::int32_t ID = 1178245499; - std::int32_t get_id() const final { - return ID; - } - - using ReturnType = object_ptr; - - void store(TlStorerToString &s, const char *field_name) const final; -}; - class viewTrendingStickerSets final : public Function { public: array sticker_set_ids_; diff --git a/tdlib/include/td/telegram/td_api.hpp b/tdlib/include/td/telegram/td_api.hpp index dfb84d1..205bb41 100644 --- a/tdlib/include/td/telegram/td_api.hpp +++ b/tdlib/include/td/telegram/td_api.hpp @@ -55,6 +55,9 @@ bool downcast_call(Object &obj, const T &func) { case authenticationCodeTypeFlashCall::ID: func(static_cast(obj)); return true; + case authenticationCodeTypeMissedCall::ID: + func(static_cast(obj)); + return true; case authorizationStateWaitTdlibParameters::ID: func(static_cast(obj)); return true; @@ -325,6 +328,9 @@ bool downcast_call(Object &obj, const T &func) { case chatActionBarSharePhoneNumber::ID: func(static_cast(obj)); return true; + case chatActionBarJoinRequest::ID: + func(static_cast(obj)); + return true; case chatAdministrator::ID: func(static_cast(obj)); return true; @@ -394,12 +400,15 @@ bool downcast_call(Object &obj, const T &func) { case chatEventSlowModeDelayChanged::ID: func(static_cast(obj)); return true; - case chatEventMessageTtlSettingChanged::ID: - func(static_cast(obj)); + case chatEventMessageTtlChanged::ID: + func(static_cast(obj)); return true; case chatEventSignMessagesToggled::ID: func(static_cast(obj)); return true; + case chatEventHasProtectedContentToggled::ID: + func(static_cast(obj)); + return true; case chatEventStickerSetChanged::ID: func(static_cast(obj)); return true; @@ -421,8 +430,8 @@ bool downcast_call(Object &obj, const T &func) { case chatEventVideoChatCreated::ID: func(static_cast(obj)); return true; - case chatEventVideoChatDiscarded::ID: - func(static_cast(obj)); + case chatEventVideoChatEnded::ID: + func(static_cast(obj)); return true; case chatEventVideoChatParticipantIsMutedToggled::ID: func(static_cast(obj)); @@ -652,9 +661,6 @@ bool downcast_call(Object &obj, const T &func) { case closedVectorPath::ID: func(static_cast(obj)); return true; - case colorReplacement::ID: - func(static_cast(obj)); - return true; case connectedWebsite::ID: func(static_cast(obj)); return true; @@ -898,6 +904,9 @@ bool downcast_call(Object &obj, const T &func) { case inlineKeyboardButtonTypeBuy::ID: func(static_cast(obj)); return true; + case inlineKeyboardButtonTypeUser::ID: + func(static_cast(obj)); + return true; case inlineQueryResultArticle::ID: func(static_cast(obj)); return true; @@ -2167,12 +2176,6 @@ bool downcast_call(Object &obj, const T &func) { case searchMessagesFilterChatPhoto::ID: func(static_cast(obj)); return true; - case searchMessagesFilterCall::ID: - func(static_cast(obj)); - return true; - case searchMessagesFilterMissedCall::ID: - func(static_cast(obj)); - return true; case searchMessagesFilterVideoNote::ID: func(static_cast(obj)); return true; @@ -2218,9 +2221,6 @@ bool downcast_call(Object &obj, const T &func) { case sponsoredMessage::ID: func(static_cast(obj)); return true; - case sponsoredMessages::ID: - func(static_cast(obj)); - return true; case statisticalGraphData::ID: func(static_cast(obj)); return true; @@ -2269,12 +2269,15 @@ bool downcast_call(Object &obj, const T &func) { case suggestedActionCheckPhoneNumber::ID: func(static_cast(obj)); return true; - case suggestedActionSeeTicksHint::ID: - func(static_cast(obj)); + case suggestedActionViewChecksHint::ID: + func(static_cast(obj)); return true; case suggestedActionConvertToBroadcastGroup::ID: func(static_cast(obj)); return true; + case suggestedActionSetPassword::ID: + func(static_cast(obj)); + return true; case supergroup::ID: func(static_cast(obj)); return true; @@ -2521,44 +2524,26 @@ bool downcast_call(Object &obj, const T &func) { case updateChatPosition::ID: func(static_cast(obj)); return true; - case updateChatIsMarkedAsUnread::ID: - func(static_cast(obj)); - return true; - case updateChatIsBlocked::ID: - func(static_cast(obj)); - return true; - case updateChatHasScheduledMessages::ID: - func(static_cast(obj)); - return true; - case updateChatVideoChat::ID: - func(static_cast(obj)); - return true; - case updateChatDefaultDisableNotification::ID: - func(static_cast(obj)); - return true; case updateChatReadInbox::ID: func(static_cast(obj)); return true; case updateChatReadOutbox::ID: func(static_cast(obj)); return true; - case updateChatUnreadMentionCount::ID: - func(static_cast(obj)); - return true; - case updateChatNotificationSettings::ID: - func(static_cast(obj)); - return true; - case updateScopeNotificationSettings::ID: - func(static_cast(obj)); - return true; - case updateChatMessageTtlSetting::ID: - func(static_cast(obj)); - return true; case updateChatActionBar::ID: func(static_cast(obj)); return true; - case updateChatTheme::ID: - func(static_cast(obj)); + case updateChatDraftMessage::ID: + func(static_cast(obj)); + return true; + case updateChatMessageSender::ID: + func(static_cast(obj)); + return true; + case updateChatMessageTtl::ID: + func(static_cast(obj)); + return true; + case updateChatNotificationSettings::ID: + func(static_cast(obj)); return true; case updateChatPendingJoinRequests::ID: func(static_cast(obj)); @@ -2566,8 +2551,29 @@ bool downcast_call(Object &obj, const T &func) { case updateChatReplyMarkup::ID: func(static_cast(obj)); return true; - case updateChatDraftMessage::ID: - func(static_cast(obj)); + case updateChatTheme::ID: + func(static_cast(obj)); + return true; + case updateChatUnreadMentionCount::ID: + func(static_cast(obj)); + return true; + case updateChatVideoChat::ID: + func(static_cast(obj)); + return true; + case updateChatDefaultDisableNotification::ID: + func(static_cast(obj)); + return true; + case updateChatHasProtectedContent::ID: + func(static_cast(obj)); + return true; + case updateChatHasScheduledMessages::ID: + func(static_cast(obj)); + return true; + case updateChatIsBlocked::ID: + func(static_cast(obj)); + return true; + case updateChatIsMarkedAsUnread::ID: + func(static_cast(obj)); return true; case updateChatFilters::ID: func(static_cast(obj)); @@ -2575,6 +2581,9 @@ bool downcast_call(Object &obj, const T &func) { case updateChatOnlineMemberCount::ID: func(static_cast(obj)); return true; + case updateScopeNotificationSettings::ID: + func(static_cast(obj)); + return true; case updateNotification::ID: func(static_cast(obj)); return true; @@ -2590,8 +2599,8 @@ bool downcast_call(Object &obj, const T &func) { case updateDeleteMessages::ID: func(static_cast(obj)); return true; - case updateUserChatAction::ID: - func(static_cast(obj)); + case updateChatAction::ID: + func(static_cast(obj)); return true; case updateUserStatus::ID: func(static_cast(obj)); @@ -2937,9 +2946,6 @@ bool downcast_call(Function &obj, const T &func) { case answerShippingQuery::ID: func(static_cast(obj)); return true; - case approveChatJoinRequest::ID: - func(static_cast(obj)); - return true; case banChatMember::ID: func(static_cast(obj)); return true; @@ -3081,9 +3087,6 @@ bool downcast_call(Function &obj, const T &func) { case createVideoChat::ID: func(static_cast(obj)); return true; - case declineChatJoinRequest::ID: - func(static_cast(obj)); - return true; case deleteAccount::ID: func(static_cast(obj)); return true; @@ -3105,8 +3108,8 @@ bool downcast_call(Function &obj, const T &func) { case deleteChatMessagesByDate::ID: func(static_cast(obj)); return true; - case deleteChatMessagesFromUser::ID: - func(static_cast(obj)); + case deleteChatMessagesBySender::ID: + func(static_cast(obj)); return true; case deleteChatReplyMarkup::ID: func(static_cast(obj)); @@ -3147,9 +3150,6 @@ bool downcast_call(Function &obj, const T &func) { case discardCall::ID: func(static_cast(obj)); return true; - case discardGroupCall::ID: - func(static_cast(obj)); - return true; case disconnectAllWebsites::ID: func(static_cast(obj)); return true; @@ -3207,6 +3207,9 @@ bool downcast_call(Function &obj, const T &func) { case enableProxy::ID: func(static_cast(obj)); return true; + case endGroupCall::ID: + func(static_cast(obj)); + return true; case endGroupCallRecording::ID: func(static_cast(obj)); return true; @@ -3282,6 +3285,9 @@ bool downcast_call(Function &obj, const T &func) { case getChatAdministrators::ID: func(static_cast(obj)); return true; + case getChatAvailableMessageSenders::ID: + func(static_cast(obj)); + return true; case getChatEventLog::ID: func(static_cast(obj)); return true; @@ -3336,8 +3342,8 @@ bool downcast_call(Function &obj, const T &func) { case getChatSparseMessagePositions::ID: func(static_cast(obj)); return true; - case getChatSponsoredMessages::ID: - func(static_cast(obj)); + case getChatSponsoredMessage::ID: + func(static_cast(obj)); return true; case getChatStatistics::ID: func(static_cast(obj)); @@ -3723,6 +3729,12 @@ bool downcast_call(Function &obj, const T &func) { case pingProxy::ID: func(static_cast(obj)); return true; + case processChatJoinRequest::ID: + func(static_cast(obj)); + return true; + case processChatJoinRequests::ID: + func(static_cast(obj)); + return true; case processPushNotification::ID: func(static_cast(obj)); return true; @@ -3993,8 +4005,11 @@ bool downcast_call(Function &obj, const T &func) { case setChatMemberStatus::ID: func(static_cast(obj)); return true; - case setChatMessageTtlSetting::ID: - func(static_cast(obj)); + case setChatMessageSender::ID: + func(static_cast(obj)); + return true; + case setChatMessageTtl::ID: + func(static_cast(obj)); return true; case setChatNotificationSettings::ID: func(static_cast(obj)); @@ -4041,6 +4056,9 @@ bool downcast_call(Function &obj, const T &func) { case setGroupCallTitle::ID: func(static_cast(obj)); return true; + case setInactiveSessionTtl::ID: + func(static_cast(obj)); + return true; case setInlineGameScore::ID: func(static_cast(obj)); return true; @@ -4179,6 +4197,9 @@ bool downcast_call(Function &obj, const T &func) { case toggleChatDefaultDisableNotification::ID: func(static_cast(obj)); return true; + case toggleChatHasProtectedContent::ID: + func(static_cast(obj)); + return true; case toggleChatIsMarkedAsUnread::ID: func(static_cast(obj)); return true; @@ -4209,6 +4230,12 @@ bool downcast_call(Function &obj, const T &func) { case toggleMessageSenderIsBlocked::ID: func(static_cast(obj)); return true; + case toggleSessionCanAcceptCalls::ID: + func(static_cast(obj)); + return true; + case toggleSessionCanAcceptSecretChats::ID: + func(static_cast(obj)); + return true; case toggleSupergroupIsAllHistoryAvailable::ID: func(static_cast(obj)); return true; @@ -4242,9 +4269,6 @@ bool downcast_call(Function &obj, const T &func) { case viewMessages::ID: func(static_cast(obj)); return true; - case viewSponsoredMessage::ID: - func(static_cast(obj)); - return true; case viewTrendingStickerSets::ID: func(static_cast(obj)); return true; @@ -4277,6 +4301,9 @@ bool downcast_call(AuthenticationCodeType &obj, const T &func) { case authenticationCodeTypeFlashCall::ID: func(static_cast(obj)); return true; + case authenticationCodeTypeMissedCall::ID: + func(static_cast(obj)); + return true; default: return false; } @@ -4667,6 +4694,9 @@ bool downcast_call(ChatActionBar &obj, const T &func) { case chatActionBarSharePhoneNumber::ID: func(static_cast(obj)); return true; + case chatActionBarJoinRequest::ID: + func(static_cast(obj)); + return true; default: return false; } @@ -4741,12 +4771,15 @@ bool downcast_call(ChatEventAction &obj, const T &func) { case chatEventSlowModeDelayChanged::ID: func(static_cast(obj)); return true; - case chatEventMessageTtlSettingChanged::ID: - func(static_cast(obj)); + case chatEventMessageTtlChanged::ID: + func(static_cast(obj)); return true; case chatEventSignMessagesToggled::ID: func(static_cast(obj)); return true; + case chatEventHasProtectedContentToggled::ID: + func(static_cast(obj)); + return true; case chatEventStickerSetChanged::ID: func(static_cast(obj)); return true; @@ -4768,8 +4801,8 @@ bool downcast_call(ChatEventAction &obj, const T &func) { case chatEventVideoChatCreated::ID: func(static_cast(obj)); return true; - case chatEventVideoChatDiscarded::ID: - func(static_cast(obj)); + case chatEventVideoChatEnded::ID: + func(static_cast(obj)); return true; case chatEventVideoChatParticipantIsMutedToggled::ID: func(static_cast(obj)); @@ -5242,6 +5275,9 @@ bool downcast_call(InlineKeyboardButtonType &obj, const T &func) { case inlineKeyboardButtonTypeBuy::ID: func(static_cast(obj)); return true; + case inlineKeyboardButtonTypeUser::ID: + func(static_cast(obj)); + return true; default: return false; } @@ -6888,12 +6924,6 @@ bool downcast_call(SearchMessagesFilter &obj, const T &func) { case searchMessagesFilterChatPhoto::ID: func(static_cast(obj)); return true; - case searchMessagesFilterCall::ID: - func(static_cast(obj)); - return true; - case searchMessagesFilterMissedCall::ID: - func(static_cast(obj)); - return true; case searchMessagesFilterVideoNote::ID: func(static_cast(obj)); return true; @@ -6981,12 +7011,15 @@ bool downcast_call(SuggestedAction &obj, const T &func) { case suggestedActionCheckPhoneNumber::ID: func(static_cast(obj)); return true; - case suggestedActionSeeTicksHint::ID: - func(static_cast(obj)); + case suggestedActionViewChecksHint::ID: + func(static_cast(obj)); return true; case suggestedActionConvertToBroadcastGroup::ID: func(static_cast(obj)); return true; + case suggestedActionSetPassword::ID: + func(static_cast(obj)); + return true; default: return false; } @@ -7274,44 +7307,26 @@ bool downcast_call(Update &obj, const T &func) { case updateChatPosition::ID: func(static_cast(obj)); return true; - case updateChatIsMarkedAsUnread::ID: - func(static_cast(obj)); - return true; - case updateChatIsBlocked::ID: - func(static_cast(obj)); - return true; - case updateChatHasScheduledMessages::ID: - func(static_cast(obj)); - return true; - case updateChatVideoChat::ID: - func(static_cast(obj)); - return true; - case updateChatDefaultDisableNotification::ID: - func(static_cast(obj)); - return true; case updateChatReadInbox::ID: func(static_cast(obj)); return true; case updateChatReadOutbox::ID: func(static_cast(obj)); return true; - case updateChatUnreadMentionCount::ID: - func(static_cast(obj)); - return true; - case updateChatNotificationSettings::ID: - func(static_cast(obj)); - return true; - case updateScopeNotificationSettings::ID: - func(static_cast(obj)); - return true; - case updateChatMessageTtlSetting::ID: - func(static_cast(obj)); - return true; case updateChatActionBar::ID: func(static_cast(obj)); return true; - case updateChatTheme::ID: - func(static_cast(obj)); + case updateChatDraftMessage::ID: + func(static_cast(obj)); + return true; + case updateChatMessageSender::ID: + func(static_cast(obj)); + return true; + case updateChatMessageTtl::ID: + func(static_cast(obj)); + return true; + case updateChatNotificationSettings::ID: + func(static_cast(obj)); return true; case updateChatPendingJoinRequests::ID: func(static_cast(obj)); @@ -7319,8 +7334,29 @@ bool downcast_call(Update &obj, const T &func) { case updateChatReplyMarkup::ID: func(static_cast(obj)); return true; - case updateChatDraftMessage::ID: - func(static_cast(obj)); + case updateChatTheme::ID: + func(static_cast(obj)); + return true; + case updateChatUnreadMentionCount::ID: + func(static_cast(obj)); + return true; + case updateChatVideoChat::ID: + func(static_cast(obj)); + return true; + case updateChatDefaultDisableNotification::ID: + func(static_cast(obj)); + return true; + case updateChatHasProtectedContent::ID: + func(static_cast(obj)); + return true; + case updateChatHasScheduledMessages::ID: + func(static_cast(obj)); + return true; + case updateChatIsBlocked::ID: + func(static_cast(obj)); + return true; + case updateChatIsMarkedAsUnread::ID: + func(static_cast(obj)); return true; case updateChatFilters::ID: func(static_cast(obj)); @@ -7328,6 +7364,9 @@ bool downcast_call(Update &obj, const T &func) { case updateChatOnlineMemberCount::ID: func(static_cast(obj)); return true; + case updateScopeNotificationSettings::ID: + func(static_cast(obj)); + return true; case updateNotification::ID: func(static_cast(obj)); return true; @@ -7343,8 +7382,8 @@ bool downcast_call(Update &obj, const T &func) { case updateDeleteMessages::ID: func(static_cast(obj)); return true; - case updateUserChatAction::ID: - func(static_cast(obj)); + case updateChatAction::ID: + func(static_cast(obj)); return true; case updateUserStatus::ID: func(static_cast(obj)); diff --git a/tdlib/include/td/telegram/td_json_client.h b/tdlib/include/td/telegram/td_json_client.h index e16c7ce..40a0c7b 100644 --- a/tdlib/include/td/telegram/td_json_client.h +++ b/tdlib/include/td/telegram/td_json_client.h @@ -18,87 +18,6 @@ * Fields of Bool type are stored as Boolean, fields of int32, int53, and double types are stored as Number, fields of * int64 and string types are stored as String, fields of bytes type are base64 encoded and then stored as String, * fields of array type are stored as Array. - * The main TDLib interface is asynchronous. To match requests with a corresponding response a field "@extra" can - * be added to the request object. The corresponding response will have an "@extra" field with exactly the same value. - * - * A TDLib client instance can be created through td_json_client_create. - * Requests then can be sent using td_json_client_send from any thread. - * New updates and request responses can be received through td_json_client_receive from any thread. This function - * must not be called simultaneously from two different threads. Also note that all updates and request responses - * must be applied in the order they were received to ensure consistency. - * Given this information, it's advisable to call this function from a dedicated thread. - * Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute. - * The TDLib client instance can be destroyed via td_json_client_destroy. - * - * General pattern of usage: - * \code - * void *client = td_json_client_create(); - * // somehow share the client with other threads, which will be able to send requests via td_json_client_send - * - * const double WAIT_TIMEOUT = 10.0; // seconds - * int is_closed = 0; // should be set to 1, when updateAuthorizationState with authorizationStateClosed is received - * while (!is_closed) { - * const char *result = td_json_client_receive(client, WAIT_TIMEOUT); - * if (result) { - * // parse the result as JSON object and process it as an incoming update or an answer to a previously sent request - * } - * } - * td_json_client_destroy(client); - * \endcode - */ - -#include "td/telegram/tdjson_export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Creates a new instance of TDLib. - * \return Pointer to the created instance of TDLib. - */ -TDJSON_EXPORT void *td_json_client_create(); - -/** - * Sends request to the TDLib client. May be called from any thread. - * \param[in] client The client. - * \param[in] request JSON-serialized null-terminated request to TDLib. - */ -TDJSON_EXPORT void td_json_client_send(void *client, const char *request); - -/** - * Receives incoming updates and request responses from the TDLib client. May be called from any thread, but - * must not be called simultaneously from two different threads. - * Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute - * in the same thread, so it can't be used after that. - * \param[in] client The client. - * \param[in] timeout The maximum number of seconds allowed for this function to wait for new data. - * \return JSON-serialized null-terminated incoming update or request response. May be NULL if the timeout expires. - */ -TDJSON_EXPORT const char *td_json_client_receive(void *client, double timeout); - -/** - * Synchronously executes TDLib request. May be called from any thread. - * Only a few requests can be executed synchronously. - * Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute - * in the same thread, so it can't be used after that. - * \param[in] client The client. Currently ignored for all requests, so NULL can be passed. - * \param[in] request JSON-serialized null-terminated request to TDLib. - * \return JSON-serialized null-terminated request response. - */ -TDJSON_EXPORT const char *td_json_client_execute(void *client, const char *request); - -/** - * Destroys the TDLib client instance. After this is called the client instance must not be used anymore. - * \param[in] client The client. - */ -TDJSON_EXPORT void td_json_client_destroy(void *client); - -/** - * \file - * Alternatively, you can use new TDLib JSON interface, which will replace the current JSON interface in TDLib 2.0.0. - * - * Objects and functions serialization to JSON is the same for both JSON interfaces. * * The main TDLib interface is asynchronous. To match requests with a corresponding response, the field "@extra" can * be added to the request object. The corresponding response will have an "@extra" field with exactly the same value. @@ -129,6 +48,12 @@ TDJSON_EXPORT void td_json_client_destroy(void *client); * \endcode */ +#include "td/telegram/tdjson_export.h" + +#ifdef __cplusplus +extern "C" { +#endif + /** * Returns an opaque identifier of a new TDLib instance. * The TDLib instance will not send updates until the first request is sent to it. @@ -181,6 +106,82 @@ typedef void (*td_log_message_callback_ptr)(int verbosity_level, const char *mes */ TDJSON_EXPORT void td_set_log_message_callback(int max_verbosity_level, td_log_message_callback_ptr callback); +/** + * \file + * Alternatively, you can use old TDLib JSON interface, which will be removed in TDLib 2.0.0. + * + * Objects and functions serialization to JSON is the same for both JSON interfaces. + * + * The main TDLib interface is asynchronous. To match requests with a corresponding response a field "@extra" can + * be added to the request object. The corresponding response will have an "@extra" field with exactly the same value. + * + * A TDLib client instance can be created through td_json_client_create. + * Requests then can be sent using td_json_client_send from any thread. + * New updates and request responses can be received through td_json_client_receive from any thread. This function + * must not be called simultaneously from two different threads. Also note that all updates and request responses + * must be applied in the order they were received to ensure consistency. + * Given this information, it's advisable to call this function from a dedicated thread. + * Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute. + * The TDLib client instance can be destroyed via td_json_client_destroy. + * + * General pattern of usage: + * \code + * void *client = td_json_client_create(); + * // somehow share the client with other threads, which will be able to send requests via td_json_client_send + * + * const double WAIT_TIMEOUT = 10.0; // seconds + * int is_closed = 0; // should be set to 1, when updateAuthorizationState with authorizationStateClosed is received + * while (!is_closed) { + * const char *result = td_json_client_receive(client, WAIT_TIMEOUT); + * if (result) { + * // parse the result as JSON object and process it as an incoming update or an answer to a previously sent request + * } + * } + * td_json_client_destroy(client); + * \endcode + */ + +/** + * Creates a new instance of TDLib. + * \return Pointer to the created instance of TDLib. + */ +TDJSON_EXPORT void *td_json_client_create(); + +/** + * Sends request to the TDLib client. May be called from any thread. + * \param[in] client The client. + * \param[in] request JSON-serialized null-terminated request to TDLib. + */ +TDJSON_EXPORT void td_json_client_send(void *client, const char *request); + +/** + * Receives incoming updates and request responses from the TDLib client. May be called from any thread, but + * must not be called simultaneously from two different threads. + * Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute + * in the same thread, so it can't be used after that. + * \param[in] client The client. + * \param[in] timeout The maximum number of seconds allowed for this function to wait for new data. + * \return JSON-serialized null-terminated incoming update or request response. May be NULL if the timeout expires. + */ +TDJSON_EXPORT const char *td_json_client_receive(void *client, double timeout); + +/** + * Synchronously executes TDLib request. May be called from any thread. + * Only a few requests can be executed synchronously. + * Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute + * in the same thread, so it can't be used after that. + * \param[in] client The client. Currently ignored for all requests, so NULL can be passed. + * \param[in] request JSON-serialized null-terminated request to TDLib. + * \return JSON-serialized null-terminated request response. + */ +TDJSON_EXPORT const char *td_json_client_execute(void *client, const char *request); + +/** + * Destroys the TDLib client instance. After this is called the client instance must not be used anymore. + * \param[in] client The client. + */ +TDJSON_EXPORT void td_json_client_destroy(void *client); + #ifdef __cplusplus } // extern "C" #endif diff --git a/tdlib/include/td/tl/TlObject.h b/tdlib/include/td/tl/TlObject.h index 61caa5e..4bff624 100644 --- a/tdlib/include/td/tl/TlObject.h +++ b/tdlib/include/td/tl/TlObject.h @@ -199,7 +199,7 @@ using tl_object_ptr = tl::unique_ptr; * \return Wrapped pointer to the created TL-object. */ template -tl_object_ptr make_tl_object(Args &&... args) { +tl_object_ptr make_tl_object(Args &&...args) { return tl_object_ptr(new Type(std::forward(args)...)); }