Add QuickReplyManager::get_input_reply_to_message_id.

This commit is contained in:
levlam 2024-04-15 22:55:26 +03:00
parent a7dca7a744
commit 5d984efdd3
2 changed files with 15 additions and 0 deletions

View File

@ -1520,6 +1520,19 @@ Status QuickReplyManager::check_new_shortcut_name(const string &name, int32 new_
return Status::OK();
}
MessageId QuickReplyManager::get_input_reply_to_message_id(const Shortcut *s, MessageId reply_to_message_id) {
if (s == nullptr || !reply_to_message_id.is_valid() || !reply_to_message_id.is_server()) {
return MessageId();
}
for (auto &message : s->messages_) {
CHECK(message != nullptr);
if (message->message_id == reply_to_message_id) {
return reply_to_message_id;
}
}
return MessageId();
}
vector<QuickReplyShortcutId> QuickReplyManager::get_shortcut_ids() const {
return transform(shortcuts_.shortcuts_, [](const unique_ptr<Shortcut> &shortcut) { return shortcut->shortcut_id_; });
}

View File

@ -232,6 +232,8 @@ class QuickReplyManager final : public Actor {
Status check_new_shortcut_name(const string &name, int32 new_message_count);
static MessageId get_input_reply_to_message_id(const Shortcut *s, MessageId reply_to_message_id);
bool is_shortcut_list_changed(const vector<unique_ptr<Shortcut>> &new_shortcuts) const;
vector<QuickReplyShortcutId> get_shortcut_ids() const;