diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index dbd79642..e147edf6 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -109,7 +109,7 @@ authorizationStateClosing = AuthorizationState; authorizationStateClosed = AuthorizationState; -//@description Represents the current state of 2-step verification @has_password True if a 2-step verification password is set @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email is set @has_passport_data True if some Telegram Passport elements were saved @unconfirmed_recovery_email_address_pattern Pattern of the email address to which the confirmation email was sent +//@description Represents the current state of 2-step verification @has_password True, if a 2-step verification password is set @password_hint Hint for the password; can be empty @has_recovery_email_address True, if a recovery email is set @has_passport_data True, if some Telegram Passport elements were saved @unconfirmed_recovery_email_address_pattern Pattern of the email address to which the confirmation email was sent passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool unconfirmed_recovery_email_address_pattern:string = PasswordState; //@description Contains information about the current recovery email address @recovery_email_address Recovery email address @@ -2547,6 +2547,9 @@ getChat chat_id:int53 = Chat; //@description Returns information about a message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; +//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +getMessageLocally chat_id:int53 message_id:int53 = Message; + //@description Returns information about a message that is replied by given message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which get getRepliedMessage chat_id:int53 message_id:int53 = Message; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 84941a1e..624a03c0 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index a8b13f47..c38b28ff 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14537,9 +14537,7 @@ void MessagesManager::load_messages(DialogId dialog_id, MessageId from_message_i } tl_object_ptr MessagesManager::get_message_object(FullMessageId full_message_id) { - auto dialog_id = full_message_id.get_dialog_id(); - Dialog *d = get_dialog(dialog_id); - return get_message_object(dialog_id, get_message_force(d, full_message_id.get_message_id())); + return get_message_object(full_message_id.get_dialog_id(), get_message_force(full_message_id)); } tl_object_ptr MessagesManager::get_message_object(DialogId dialog_id, const Message *message) const { diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 3528064f..0e952e35 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4848,6 +4848,11 @@ void Td::on_request(uint64 id, const td_api::getMessage &request) { CREATE_REQUEST(GetMessageRequest, request.chat_id_, request.message_id_); } +void Td::on_request(uint64 id, const td_api::getMessageLocally &request) { + FullMessageId full_message_id(DialogId(request.chat_id_), MessageId(request.message_id_)); + send_closure(actor_id(this), &Td::send_result, id, messages_manager_->get_message_object(full_message_id)); +} + void Td::on_request(uint64 id, const td_api::getRepliedMessage &request) { CREATE_REQUEST(GetRepliedMessageRequest, request.chat_id_, request.message_id_); } diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 2fdab88f..b99e86b8 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -433,6 +433,8 @@ class Td final : public NetQueryCallback { void on_request(uint64 id, const td_api::getMessage &request); + void on_request(uint64 id, const td_api::getMessageLocally &request); + void on_request(uint64 id, const td_api::getRepliedMessage &request); void on_request(uint64 id, const td_api::getChatPinnedMessage &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index ff6adf06..f23c8fe6 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2256,6 +2256,11 @@ class CliClient final : public Actor { string message_id; std::tie(chat_id, message_id) = split(args); send_request(make_tl_object(as_chat_id(chat_id), as_message_id(message_id))); + } else if (op == "gml") { + string chat_id; + string message_id; + std::tie(chat_id, message_id) = split(args); + send_request(make_tl_object(as_chat_id(chat_id), as_message_id(message_id))); } else if (op == "grm") { string chat_id; string message_id;