From f11c4e8af4e653754060e6fce110d9ef3558e9de Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 1 Feb 2024 13:09:01 +0300 Subject: [PATCH] Add searchSavedMessages.saved_messages_topic. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/Td.cpp | 4 ++-- td/telegram/cli.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index c05da457a..b8f500ba7 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -7358,13 +7358,14 @@ searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter //@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. //-Returns the results in reverse chronological order, i.e. in order of decreasing message_id //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +//@saved_messages_topic If not null, only messages in the specified Saved Messages topic will be considered; pass null to consider all messages //@tag Tag to search for; pass null to return all suitable messages //@query Query to search for //@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages //@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. //-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -searchSavedMessages tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; +searchSavedMessages saved_messages_topic:SavedMessagesTopic tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; //@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 15999f046..6d5735334 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -5337,8 +5337,8 @@ void Td::on_request(uint64 id, td_api::searchSavedMessages &request) { CHECK_IS_USER(); CLEAN_INPUT_STRING(request.query_); CREATE_REQUEST(SearchChatMessagesRequest, dialog_manager_->get_my_dialog_id().get(), std::move(request.query_), - nullptr, request.from_message_id_, request.offset_, request.limit_, nullptr, 0, SavedMessagesTopicId(), - ReactionType(request.tag_)); + nullptr, request.from_message_id_, request.offset_, request.limit_, nullptr, 0, + SavedMessagesTopicId(this, request.saved_messages_topic_), ReactionType(request.tag_)); } void Td::on_request(uint64 id, const td_api::searchCallMessages &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index f989a7174..314b0e198 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2986,8 +2986,8 @@ class CliClient final : public Actor { int32 offset; SearchQuery query; get_args(args, tag, from_message_id, offset, query); - send_request(td_api::make_object(as_reaction_type(tag), query.query, from_message_id, - offset, query.limit)); + send_request(td_api::make_object(get_saved_messages_topic(), as_reaction_type(tag), + query.query, from_message_id, offset, query.limit)); } else if (op == "gcmbd") { ChatId chat_id; int32 date;