Add and use QuickReplyManager::get_quick_reply_messages_hash.
This commit is contained in:
parent
aeea69e674
commit
9720651164
@ -830,7 +830,8 @@ void QuickReplyManager::reload_quick_reply_messages(QuickReplyShortcutId shortcu
|
||||
Result<telegram_api::object_ptr<telegram_api::messages_Messages>> r_messages) {
|
||||
send_closure(actor_id, &QuickReplyManager::on_reload_quick_reply_messages, shortcut_id, std::move(r_messages));
|
||||
});
|
||||
td_->create_handler<GetQuickReplyMessagesQuery>(std::move(query_promise))->send(shortcut_id, vector<MessageId>(), 0);
|
||||
td_->create_handler<GetQuickReplyMessagesQuery>(std::move(query_promise))
|
||||
->send(shortcut_id, vector<MessageId>(), get_quick_reply_messages_hash(get_shortcut(shortcut_id)));
|
||||
}
|
||||
|
||||
void QuickReplyManager::on_reload_quick_reply_messages(
|
||||
@ -909,6 +910,18 @@ void QuickReplyManager::on_reload_quick_reply_messages(
|
||||
}
|
||||
}
|
||||
|
||||
int64 QuickReplyManager::get_quick_reply_messages_hash(const Shortcut *s) {
|
||||
CHECK(s != nullptr);
|
||||
vector<uint64> numbers;
|
||||
for (auto &message : s->messages_) {
|
||||
if (message->message_id.is_server()) {
|
||||
numbers.push_back(message->message_id.get_server_message_id().get());
|
||||
numbers.push_back(message->edit_date);
|
||||
}
|
||||
}
|
||||
return get_vector_hash(numbers);
|
||||
}
|
||||
|
||||
QuickReplyManager::Shortcut *QuickReplyManager::get_shortcut(QuickReplyShortcutId shortcut_id) {
|
||||
if (!shortcuts_.are_inited_) {
|
||||
return nullptr;
|
||||
|
@ -169,6 +169,8 @@ class QuickReplyManager final : public Actor {
|
||||
void on_reload_quick_reply_messages(QuickReplyShortcutId shortcut_id,
|
||||
Result<telegram_api::object_ptr<telegram_api::messages_Messages>> r_messages);
|
||||
|
||||
static int64 get_quick_reply_messages_hash(const Shortcut *s);
|
||||
|
||||
Shortcut *get_shortcut(QuickReplyShortcutId shortcut_id);
|
||||
|
||||
Shortcut *get_shortcut(const string &name);
|
||||
|
Loading…
Reference in New Issue
Block a user