Always dup paid media file identifiers if there are multiple files.
This commit is contained in:
parent
30f1e339d6
commit
224ec33016
@ -6631,7 +6631,7 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
||||
}
|
||||
if (type != MessageContentDupType::Forward) {
|
||||
for (auto &media : result->media) {
|
||||
media = media.dup_to_send(td);
|
||||
media = media.dup_to_send(td, result->media.size() > 1u);
|
||||
CHECK(!media.is_empty());
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void MessageExtendedMedia::update_file_id_remote(FileId file_id) {
|
||||
}
|
||||
}
|
||||
|
||||
MessageExtendedMedia MessageExtendedMedia::dup_to_send(Td *td) const {
|
||||
MessageExtendedMedia MessageExtendedMedia::dup_to_send(Td *td, bool always_dup_files) const {
|
||||
switch (type_) {
|
||||
case Type::Empty:
|
||||
case Type::Unsupported:
|
||||
@ -339,13 +339,14 @@ MessageExtendedMedia MessageExtendedMedia::dup_to_send(Td *td) const {
|
||||
if (photo_.photos.size() > 2 || photo_.photos.back().type != 'i') {
|
||||
// already sent photo
|
||||
result.photo_ = photo_;
|
||||
if (!td->auth_manager_->is_bot()) {
|
||||
if (always_dup_files || !td->auth_manager_->is_bot()) {
|
||||
result.photo_.photos.back().file_id = td->file_manager_->dup_file_id(result.photo_.photos.back().file_id,
|
||||
"MessageExtendedMedia::dup_to_send 1");
|
||||
}
|
||||
} else {
|
||||
result.photo_ = dup_photo(photo_);
|
||||
if (!photo_has_input_media(td->file_manager_.get(), result.photo_, false, td->auth_manager_->is_bot())) {
|
||||
if (always_dup_files ||
|
||||
!photo_has_input_media(td->file_manager_.get(), result.photo_, false, td->auth_manager_->is_bot())) {
|
||||
result.photo_.photos.back().file_id = td->file_manager_->dup_file_id(result.photo_.photos.back().file_id,
|
||||
"MessageExtendedMedia::dup_to_send 2");
|
||||
if (result.photo_.photos.size() > 1) {
|
||||
@ -359,11 +360,11 @@ MessageExtendedMedia MessageExtendedMedia::dup_to_send(Td *td) const {
|
||||
case Type::Video: {
|
||||
MessageExtendedMedia result;
|
||||
result.type_ = Type::Video;
|
||||
if (td->documents_manager_->has_input_media(video_file_id_, FileId(), false)) {
|
||||
result.video_file_id_ = video_file_id_;
|
||||
} else {
|
||||
if (always_dup_files || !td->documents_manager_->has_input_media(video_file_id_, FileId(), false)) {
|
||||
result.video_file_id_ = td->videos_manager_->dup_video(
|
||||
td->file_manager_->dup_file_id(video_file_id_, "MessageExtendedMedia::dup_to_send 4"), video_file_id_);
|
||||
} else {
|
||||
result.video_file_id_ = video_file_id_;
|
||||
}
|
||||
CHECK(result.video_file_id_.is_valid());
|
||||
return result;
|
||||
|
@ -102,7 +102,7 @@ class MessageExtendedMedia {
|
||||
|
||||
void update_file_id_remote(FileId file_id);
|
||||
|
||||
MessageExtendedMedia dup_to_send(Td *td) const;
|
||||
MessageExtendedMedia dup_to_send(Td *td, bool always_dup_files) const;
|
||||
|
||||
telegram_api::object_ptr<telegram_api::InputMedia> get_input_media(
|
||||
Td *td, tl_object_ptr<telegram_api::InputFile> input_file,
|
||||
|
Loading…
x
Reference in New Issue
Block a user