Support missing file parts.

This commit is contained in:
levlam 2024-04-18 15:13:16 +03:00
parent 1672e580a9
commit e7d7c502c4
2 changed files with 16 additions and 2 deletions

View File

@ -361,8 +361,8 @@ class QuickReplyManager::SendQuickReplyMediaQuery final : public Td::ResultHandl
CHECK(file_id_.is_valid());
auto bad_parts = FileManager::get_missing_file_parts(status);
if (!bad_parts.empty()) {
// td_->quick_reply_manager_->on_send_message_file_parts_missing(random_id_, std::move(bad_parts));
// return;
td_->quick_reply_manager_->on_send_message_file_parts_missing(shortcut_id_, random_id_, std::move(bad_parts));
return;
} else {
td_->file_manager_->delete_partial_remote_location_if_needed(file_id_, status);
}
@ -1692,6 +1692,18 @@ void QuickReplyManager::do_send_message(const QuickReplyMessage *m, vector<int>
}
}
void QuickReplyManager::on_send_message_file_parts_missing(QuickReplyShortcutId shortcut_id, int64 random_id,
vector<int> &&bad_parts) {
auto *s = get_shortcut(shortcut_id);
if (s != nullptr) {
for (auto &message : s->messages_) {
if (message->random_id == random_id && message->message_id.is_yet_unsent()) {
do_send_message(message.get(), std::move(bad_parts));
}
}
}
}
void QuickReplyManager::on_send_message_file_reference_error(QuickReplyShortcutId shortcut_id, int64 random_id) {
auto *s = get_shortcut(shortcut_id);
if (s != nullptr) {

View File

@ -331,6 +331,8 @@ class QuickReplyManager final : public Actor {
void do_send_message(const QuickReplyMessage *m, vector<int> bad_parts = {});
void on_send_message_file_parts_missing(QuickReplyShortcutId shortcut_id, int64 random_id, vector<int> &&bad_parts);
void on_send_message_file_reference_error(QuickReplyShortcutId shortcut_id, int64 random_id);
void on_upload_media(FileId file_id, telegram_api::object_ptr<telegram_api::InputFile> input_file);