Add searchMessages.only_in_channels.
This commit is contained in:
parent
6194fb4aa1
commit
b359b32080
@ -7802,13 +7802,14 @@ searchChatMessages chat_id:int53 query:string sender_id:MessageSender from_messa
|
||||
//@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)).
|
||||
//-For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
|
||||
//@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported
|
||||
//@only_in_channels Pass true to search only for messages in channels
|
||||
//@query Query to search for
|
||||
//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
|
||||
//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
|
||||
//@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function
|
||||
//@min_date If not 0, the minimum date of the messages to return
|
||||
//@max_date If not 0, the maximum date of the messages to return
|
||||
searchMessages chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages;
|
||||
searchMessages chat_list:ChatList only_in_channels:Bool query:string offset:string limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = FoundMessages;
|
||||
|
||||
//@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib
|
||||
//@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats
|
||||
|
@ -2067,7 +2067,7 @@ class SearchMessagesGlobalQuery final : public Td::ResultHandler {
|
||||
explicit SearchMessagesGlobalQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FolderId folder_id, bool ignore_folder_id, const string &query, int32 offset_date,
|
||||
void send(FolderId folder_id, bool ignore_folder_id, bool broadcasts_only, const string &query, int32 offset_date,
|
||||
DialogId offset_dialog_id, MessageId offset_message_id, int32 limit, MessageSearchFilter filter,
|
||||
int32 min_date, int32 max_date, int64 random_id) {
|
||||
query_ = query;
|
||||
@ -2087,6 +2087,9 @@ class SearchMessagesGlobalQuery final : public Td::ResultHandler {
|
||||
if (!ignore_folder_id) {
|
||||
flags |= telegram_api::messages_searchGlobal::FOLDER_ID_MASK;
|
||||
}
|
||||
if (broadcasts_only) {
|
||||
flags |= telegram_api::messages_searchGlobal::BROADCASTS_ONLY_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_searchGlobal(
|
||||
flags, false /*ignored*/, folder_id.get(), query, get_input_messages_filter(filter), min_date_, max_date_,
|
||||
offset_date_, std::move(input_peer), offset_message_id.get_server_message_id().get(), limit)));
|
||||
@ -21070,7 +21073,8 @@ void MessagesManager::on_message_db_calls_result(Result<MessageDbCallsResult> re
|
||||
}
|
||||
|
||||
MessagesManager::FoundMessages MessagesManager::search_messages(FolderId folder_id, bool ignore_folder_id,
|
||||
const string &query, const string &offset, int32 limit,
|
||||
bool broadcasts_only, const string &query,
|
||||
const string &offset, int32 limit,
|
||||
MessageSearchFilter filter, int32 min_date,
|
||||
int32 max_date, int64 &random_id,
|
||||
Promise<Unit> &&promise) {
|
||||
@ -21147,8 +21151,8 @@ MessagesManager::FoundMessages MessagesManager::search_messages(FolderId folder_
|
||||
<< offset << " and limit " << limit;
|
||||
|
||||
td_->create_handler<SearchMessagesGlobalQuery>(std::move(promise))
|
||||
->send(folder_id, ignore_folder_id, query, offset_date, offset_dialog_id, offset_message_id, limit, filter,
|
||||
min_date, max_date, random_id);
|
||||
->send(folder_id, ignore_folder_id, broadcasts_only, query, offset_date, offset_dialog_id, offset_message_id,
|
||||
limit, filter, min_date, max_date, random_id);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -734,9 +734,9 @@ class MessagesManager final : public Actor {
|
||||
FoundMessages offline_search_messages(DialogId dialog_id, const string &query, string offset, int32 limit,
|
||||
MessageSearchFilter filter, int64 &random_id, Promise<Unit> &&promise);
|
||||
|
||||
FoundMessages search_messages(FolderId folder_id, bool ignore_folder_id, const string &query, const string &offset,
|
||||
int32 limit, MessageSearchFilter filter, int32 min_date, int32 max_date,
|
||||
int64 &random_id, Promise<Unit> &&promise);
|
||||
FoundMessages search_messages(FolderId folder_id, bool ignore_folder_id, bool broadcasts_only, const string &query,
|
||||
const string &offset, int32 limit, MessageSearchFilter filter, int32 min_date,
|
||||
int32 max_date, int64 &random_id, Promise<Unit> &&promise);
|
||||
|
||||
FoundMessages search_call_messages(const string &offset, int32 limit, bool only_missed, int64 &random_id, bool use_db,
|
||||
Promise<Unit> &&promise);
|
||||
|
@ -1497,6 +1497,7 @@ class SearchSecretMessagesRequest final : public RequestActor<> {
|
||||
class SearchMessagesRequest final : public RequestActor<> {
|
||||
FolderId folder_id_;
|
||||
bool ignore_folder_id_;
|
||||
bool broadcasts_only_;
|
||||
string query_;
|
||||
string offset_;
|
||||
int32 limit_;
|
||||
@ -1508,8 +1509,9 @@ class SearchMessagesRequest final : public RequestActor<> {
|
||||
MessagesManager::FoundMessages messages_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
messages_ = td_->messages_manager_->search_messages(folder_id_, ignore_folder_id_, query_, offset_, limit_, filter_,
|
||||
min_date_, max_date_, random_id_, std::move(promise));
|
||||
messages_ =
|
||||
td_->messages_manager_->search_messages(folder_id_, ignore_folder_id_, broadcasts_only_, query_, offset_,
|
||||
limit_, filter_, min_date_, max_date_, random_id_, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
@ -1525,12 +1527,13 @@ class SearchMessagesRequest final : public RequestActor<> {
|
||||
}
|
||||
|
||||
public:
|
||||
SearchMessagesRequest(ActorShared<Td> td, uint64 request_id, FolderId folder_id, bool ignore_folder_id, string query,
|
||||
string offset, int32 limit, tl_object_ptr<td_api::SearchMessagesFilter> &&filter,
|
||||
int32 min_date, int32 max_date)
|
||||
SearchMessagesRequest(ActorShared<Td> td, uint64 request_id, FolderId folder_id, bool ignore_folder_id,
|
||||
bool broadcasts_only, string query, string offset, int32 limit,
|
||||
tl_object_ptr<td_api::SearchMessagesFilter> &&filter, int32 min_date, int32 max_date)
|
||||
: RequestActor(std::move(td), request_id)
|
||||
, folder_id_(folder_id)
|
||||
, ignore_folder_id_(ignore_folder_id)
|
||||
, broadcasts_only_(broadcasts_only)
|
||||
, query_(std::move(query))
|
||||
, offset_(std::move(offset))
|
||||
, limit_(limit)
|
||||
@ -5407,8 +5410,8 @@ void Td::on_request(uint64 id, td_api::searchMessages &request) {
|
||||
return send_error_raw(id, 400, "Wrong chat list specified");
|
||||
}
|
||||
CREATE_REQUEST(SearchMessagesRequest, dialog_list_id.get_folder_id(), request.chat_list_ == nullptr,
|
||||
std::move(request.query_), std::move(request.offset_), request.limit_, std::move(request.filter_),
|
||||
request.min_date_, request.max_date_);
|
||||
request.only_in_channels_, std::move(request.query_), std::move(request.offset_), request.limit_,
|
||||
std::move(request.filter_), request.min_date_, request.max_date_);
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::searchSavedMessages &request) {
|
||||
|
@ -2943,7 +2943,7 @@ class CliClient final : public Actor {
|
||||
search_chat_id_ = as_chat_id(args);
|
||||
send_request(td_api::make_object<td_api::searchChatMessages>(
|
||||
search_chat_id_, "", nullptr, 0, 0, 100, as_search_messages_filter("pvi"), 0, get_saved_messages_topic_id()));
|
||||
} else if (op == "Search" || op == "SearchA" || op == "SearchM") {
|
||||
} else if (op == "Search" || op == "SearchA" || op == "SearchM" || op == "SearchC") {
|
||||
string query;
|
||||
string limit;
|
||||
string filter;
|
||||
@ -2956,8 +2956,9 @@ class CliClient final : public Actor {
|
||||
if (op == "SearchM") {
|
||||
chat_list = td_api::make_object<td_api::chatListMain>();
|
||||
}
|
||||
send_request(td_api::make_object<td_api::searchMessages>(std::move(chat_list), query, offset, as_limit(limit),
|
||||
as_search_messages_filter(filter), 1, 2147483647));
|
||||
send_request(td_api::make_object<td_api::searchMessages>(std::move(chat_list), op == "SearchC", query, offset,
|
||||
as_limit(limit), as_search_messages_filter(filter), 1,
|
||||
2147483647));
|
||||
} else if (op == "SCM") {
|
||||
ChatId chat_id;
|
||||
SearchQuery query;
|
||||
|
Loading…
Reference in New Issue
Block a user