Add td_api::getMessageLocally.

GitOrigin-RevId: 8b6dec4aadc0d9b1005444fe82a7db12cf1841a7
This commit is contained in:
levlam 2019-01-09 05:57:43 +03:00
parent ef7914a26d
commit 5b941456d2
6 changed files with 17 additions and 4 deletions

View File

@ -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;

Binary file not shown.

View File

@ -14537,9 +14537,7 @@ void MessagesManager::load_messages(DialogId dialog_id, MessageId from_message_i
}
tl_object_ptr<td_api::message> 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<td_api::message> MessagesManager::get_message_object(DialogId dialog_id, const Message *message) const {

View File

@ -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_);
}

View File

@ -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);

View File

@ -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<td_api::getMessage>(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<td_api::getMessageLocally>(as_chat_id(chat_id), as_message_id(message_id)));
} else if (op == "grm") {
string chat_id;
string message_id;