Use next_rate in searchMessages.
This commit is contained in:
parent
3080f64273
commit
fc2ab0a7ab
@ -42,6 +42,8 @@ MessagesInfo get_messages_info(Td *td, DialogId dialog_id,
|
|||||||
chats = std::move(messages->chats_);
|
chats = std::move(messages->chats_);
|
||||||
result.total_count = messages->count_;
|
result.total_count = messages->count_;
|
||||||
result.messages = std::move(messages->messages_);
|
result.messages = std::move(messages->messages_);
|
||||||
|
result.next_rate = messages->next_rate_;
|
||||||
|
// inexact:flags.1?true offset_id_offset:flags.2?int
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::messages_channelMessages::ID: {
|
case telegram_api::messages_channelMessages::ID: {
|
||||||
@ -53,6 +55,7 @@ MessagesInfo get_messages_info(Td *td, DialogId dialog_id,
|
|||||||
result.total_count = messages->count_;
|
result.total_count = messages->count_;
|
||||||
result.messages = std::move(messages->messages_);
|
result.messages = std::move(messages->messages_);
|
||||||
result.is_channel_messages = true;
|
result.is_channel_messages = true;
|
||||||
|
// inexact:flags.1?true pts:int offset_id_offset:flags.2?int
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::messages_messagesNotModified::ID:
|
case telegram_api::messages_messagesNotModified::ID:
|
||||||
|
@ -18,6 +18,7 @@ class Td;
|
|||||||
struct MessagesInfo {
|
struct MessagesInfo {
|
||||||
vector<telegram_api::object_ptr<telegram_api::Message>> messages;
|
vector<telegram_api::object_ptr<telegram_api::Message>> messages;
|
||||||
int32 total_count = 0;
|
int32 total_count = 0;
|
||||||
|
int32 next_rate = -1;
|
||||||
bool is_channel_messages = false;
|
bool is_channel_messages = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2758,7 +2758,7 @@ class SearchMessagesGlobalQuery final : public Td::ResultHandler {
|
|||||||
auto info = result.move_as_ok();
|
auto info = result.move_as_ok();
|
||||||
send_closure(actor_id, &MessagesManager::on_get_messages_search_result, query, offset_date,
|
send_closure(actor_id, &MessagesManager::on_get_messages_search_result, query, offset_date,
|
||||||
offset_dialog_id, offset_message_id, limit, filter, min_date, max_date, random_id,
|
offset_dialog_id, offset_message_id, limit, filter, min_date, max_date, random_id,
|
||||||
info.total_count, std::move(info.messages), std::move(promise));
|
info.total_count, std::move(info.messages), info.next_rate, std::move(promise));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -10493,7 +10493,7 @@ void MessagesManager::on_get_messages_search_result(const string &query, int32 o
|
|||||||
MessageSearchFilter filter, int32 min_date, int32 max_date,
|
MessageSearchFilter filter, int32 min_date, int32 max_date,
|
||||||
int64 random_id, int32 total_count,
|
int64 random_id, int32 total_count,
|
||||||
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||||
Promise<Unit> &&promise) {
|
int32 next_rate, Promise<Unit> &&promise) {
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
LOG(INFO) << "Receive " << messages.size() << " found messages";
|
LOG(INFO) << "Receive " << messages.size() << " found messages";
|
||||||
@ -10531,6 +10531,9 @@ void MessagesManager::on_get_messages_search_result(const string &query, int32 o
|
|||||||
}
|
}
|
||||||
it->second.total_count = total_count;
|
it->second.total_count = total_count;
|
||||||
if (!result.empty()) {
|
if (!result.empty()) {
|
||||||
|
if (next_rate > 0) {
|
||||||
|
last_message_date = next_rate;
|
||||||
|
}
|
||||||
it->second.next_offset = PSTRING() << last_message_date << ',' << last_dialog_id.get() << ','
|
it->second.next_offset = PSTRING() << last_message_date << ',' << last_dialog_id.get() << ','
|
||||||
<< last_message_id.get_server_message_id().get();
|
<< last_message_id.get_server_message_id().get();
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,8 @@ class MessagesManager final : public Actor {
|
|||||||
void on_get_messages_search_result(const string &query, int32 offset_date, DialogId offset_dialog_id,
|
void on_get_messages_search_result(const string &query, int32 offset_date, DialogId offset_dialog_id,
|
||||||
MessageId offset_message_id, int32 limit, MessageSearchFilter filter,
|
MessageId offset_message_id, int32 limit, MessageSearchFilter filter,
|
||||||
int32 min_date, int32 max_date, int64 random_id, int32 total_count,
|
int32 min_date, int32 max_date, int64 random_id, int32 total_count,
|
||||||
vector<tl_object_ptr<telegram_api::Message>> &&messages, Promise<Unit> &&promise);
|
vector<tl_object_ptr<telegram_api::Message>> &&messages, int32 next_rate,
|
||||||
|
Promise<Unit> &&promise);
|
||||||
void on_failed_messages_search(int64 random_id);
|
void on_failed_messages_search(int64 random_id);
|
||||||
|
|
||||||
void on_get_outgoing_document_messages(vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
void on_get_outgoing_document_messages(vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||||
|
Loading…
Reference in New Issue
Block a user