Add force to another overload of get_input_media.
GitOrigin-RevId: fc64a9f6ee08e5432c6475f8b1493bcd2524ae4f
This commit is contained in:
parent
ebcc1d0dc3
commit
c91efe472b
@ -206,7 +206,7 @@ void FileReferenceManager::run_node(NodeId node_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileReferenceManager::send_query(Destination dest, FileSourceId file_source_id) {
|
void FileReferenceManager::send_query(Destination dest, FileSourceId file_source_id) {
|
||||||
VLOG(file_references) << "Send file references repair query for file " << dest.node_id << " with generation "
|
VLOG(file_references) << "Send file reference repair query for file " << dest.node_id << " with generation "
|
||||||
<< dest.generation << " from " << file_source_id;
|
<< dest.generation << " from " << file_source_id;
|
||||||
auto &node = nodes_[dest.node_id];
|
auto &node = nodes_[dest.node_id];
|
||||||
node.query->active_queries++;
|
node.query->active_queries++;
|
||||||
@ -288,7 +288,7 @@ void FileReferenceManager::send_query(Destination dest, FileSourceId file_source
|
|||||||
|
|
||||||
FileReferenceManager::Destination FileReferenceManager::on_query_result(Destination dest, FileSourceId file_source_id,
|
FileReferenceManager::Destination FileReferenceManager::on_query_result(Destination dest, FileSourceId file_source_id,
|
||||||
Status status, int32 sub) {
|
Status status, int32 sub) {
|
||||||
VLOG(file_references) << "Receive result of file references repair query for file " << dest.node_id
|
VLOG(file_references) << "Receive result of file reference repair query for file " << dest.node_id
|
||||||
<< " with generation " << dest.generation << " from " << file_source_id << ": " << status << " "
|
<< " with generation " << dest.generation << " from " << file_source_id << ": " << status << " "
|
||||||
<< sub;
|
<< sub;
|
||||||
auto &node = nodes_[dest.node_id];
|
auto &node = nodes_[dest.node_id];
|
||||||
|
@ -2102,10 +2102,9 @@ static tl_object_ptr<telegram_api::inputMediaInvoice> get_input_media_invoice(co
|
|||||||
message_invoice->start_parameter);
|
message_invoice->start_parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td,
|
static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
|
||||||
tl_object_ptr<telegram_api::InputFile> input_file,
|
const MessageContent *content, Td *td, tl_object_ptr<telegram_api::InputFile> input_file,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
tl_object_ptr<telegram_api::InputFile> input_thumbnail, int32 ttl) {
|
||||||
int32 ttl) {
|
|
||||||
switch (content->get_type()) {
|
switch (content->get_type()) {
|
||||||
case MessageContentType::Animation: {
|
case MessageContentType::Animation: {
|
||||||
auto m = static_cast<const MessageAnimation *>(content);
|
auto m = static_cast<const MessageAnimation *>(content);
|
||||||
@ -2208,10 +2207,11 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageCont
|
|||||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td,
|
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_file,
|
tl_object_ptr<telegram_api::InputFile> input_file,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
||||||
FileId file_id, FileId thumbnail_file_id, int32 ttl) {
|
FileId file_id, FileId thumbnail_file_id, int32 ttl,
|
||||||
|
bool force) {
|
||||||
bool had_input_file = input_file != nullptr;
|
bool had_input_file = input_file != nullptr;
|
||||||
bool had_input_thumbnail = input_thumbnail != nullptr;
|
bool had_input_thumbnail = input_thumbnail != nullptr;
|
||||||
auto input_media = get_input_media(content, td, std::move(input_file), std::move(input_thumbnail), ttl);
|
auto input_media = get_input_media_impl(content, td, std::move(input_file), std::move(input_thumbnail), ttl);
|
||||||
auto was_uploaded = FileManager::extract_was_uploaded(input_media);
|
auto was_uploaded = FileManager::extract_was_uploaded(input_media);
|
||||||
if (had_input_file) {
|
if (had_input_file) {
|
||||||
if (!was_uploaded) {
|
if (!was_uploaded) {
|
||||||
@ -2229,7 +2229,7 @@ tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *co
|
|||||||
}
|
}
|
||||||
if (!was_uploaded) {
|
if (!was_uploaded) {
|
||||||
auto file_reference = FileManager::extract_file_reference(input_media);
|
auto file_reference = FileManager::extract_file_reference(input_media);
|
||||||
if (file_reference == FileReferenceView::invalid_file_reference()) {
|
if (file_reference == FileReferenceView::invalid_file_reference() && !force) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2237,7 +2237,7 @@ tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *co
|
|||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td, int32 ttl, bool force) {
|
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td, int32 ttl, bool force) {
|
||||||
auto input_media = get_input_media(content, td, nullptr, nullptr, ttl);
|
auto input_media = get_input_media_impl(content, td, nullptr, nullptr, ttl);
|
||||||
auto file_reference = FileManager::extract_file_reference(input_media);
|
auto file_reference = FileManager::extract_file_reference(input_media);
|
||||||
if (file_reference == FileReferenceView::invalid_file_reference() && !force) {
|
if (file_reference == FileReferenceView::invalid_file_reference() && !force) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -147,7 +147,8 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
|
|||||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td,
|
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_file,
|
tl_object_ptr<telegram_api::InputFile> input_file,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
||||||
FileId file_id, FileId thumbnail_file_id, int32 ttl);
|
FileId file_id, FileId thumbnail_file_id, int32 ttl,
|
||||||
|
bool force);
|
||||||
|
|
||||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td, int32 ttl, bool force);
|
tl_object_ptr<telegram_api::InputMedia> get_input_media(const MessageContent *content, Td *td, int32 ttl, bool force);
|
||||||
|
|
||||||
|
@ -6497,6 +6497,12 @@ void MessagesManager::do_send_media(DialogId dialog_id, Message *m, FileId file_
|
|||||||
tl_object_ptr<telegram_api::InputFile> input_thumbnail) {
|
tl_object_ptr<telegram_api::InputFile> input_thumbnail) {
|
||||||
CHECK(m != nullptr);
|
CHECK(m != nullptr);
|
||||||
|
|
||||||
|
bool have_input_file = input_file != nullptr;
|
||||||
|
bool have_input_thumbnail = input_thumbnail != nullptr;
|
||||||
|
LOG(INFO) << "Do send media file " << file_id << " with thumbnail " << thumbnail_file_id
|
||||||
|
<< ", have_input_file = " << have_input_file << ", have_input_thumbnail = " << have_input_thumbnail
|
||||||
|
<< ", ttl = " << m->ttl;
|
||||||
|
|
||||||
MessageContent *content = nullptr;
|
MessageContent *content = nullptr;
|
||||||
if (m->message_id.is_server()) {
|
if (m->message_id.is_server()) {
|
||||||
content = m->edited_content.get();
|
content = m->edited_content.get();
|
||||||
@ -6508,10 +6514,8 @@ void MessagesManager::do_send_media(DialogId dialog_id, Message *m, FileId file_
|
|||||||
content = m->content.get();
|
content = m->content.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool have_input_file = input_file != nullptr;
|
|
||||||
bool have_input_thumbnail = input_thumbnail != nullptr;
|
|
||||||
auto input_media = get_input_media(content, td_, std::move(input_file), std::move(input_thumbnail), file_id,
|
auto input_media = get_input_media(content, td_, std::move(input_file), std::move(input_thumbnail), file_id,
|
||||||
thumbnail_file_id, m->ttl);
|
thumbnail_file_id, m->ttl, true);
|
||||||
LOG_CHECK(input_media != nullptr) << to_string(get_message_object(dialog_id, m)) << ' ' << have_input_file << ' '
|
LOG_CHECK(input_media != nullptr) << to_string(get_message_object(dialog_id, m)) << ' ' << have_input_file << ' '
|
||||||
<< have_input_thumbnail << ' ' << file_id << ' ' << thumbnail_file_id << ' '
|
<< have_input_thumbnail << ' ' << file_id << ' ' << thumbnail_file_id << ' '
|
||||||
<< m->ttl;
|
<< m->ttl;
|
||||||
@ -6525,6 +6529,11 @@ void MessagesManager::do_send_secret_media(DialogId dialog_id, Message *m, FileI
|
|||||||
CHECK(dialog_id.get_type() == DialogType::SecretChat);
|
CHECK(dialog_id.get_type() == DialogType::SecretChat);
|
||||||
CHECK(m != nullptr);
|
CHECK(m != nullptr);
|
||||||
CHECK(m->message_id.is_yet_unsent());
|
CHECK(m->message_id.is_yet_unsent());
|
||||||
|
|
||||||
|
bool have_input_file = input_encrypted_file != nullptr;
|
||||||
|
LOG(INFO) << "Do send secret media file " << file_id << " with thumbnail " << thumbnail_file_id
|
||||||
|
<< ", have_input_file = " << have_input_file;
|
||||||
|
|
||||||
auto layer = td_->contacts_manager_->get_secret_chat_layer(dialog_id.get_secret_chat_id());
|
auto layer = td_->contacts_manager_->get_secret_chat_layer(dialog_id.get_secret_chat_id());
|
||||||
on_secret_message_media_uploaded(
|
on_secret_message_media_uploaded(
|
||||||
dialog_id, m,
|
dialog_id, m,
|
||||||
|
@ -463,6 +463,7 @@ const FullLocalFileLocation &FileView::local_location() const {
|
|||||||
bool FileView::has_remote_location() const {
|
bool FileView::has_remote_location() const {
|
||||||
return static_cast<bool>(node_->remote_.full);
|
return static_cast<bool>(node_->remote_.full);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileView::has_alive_remote_location() const {
|
bool FileView::has_alive_remote_location() const {
|
||||||
return node_->remote_.is_full_alive;
|
return node_->remote_.is_full_alive;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user