diff options
| -rw-r--r-- | benchmark/bench_misc.cpp | 2 | ||||
| -rw-r--r-- | td/generate/scheme/td_api.tl | 14 | ||||
| -rw-r--r-- | td/telegram/MessageContent.cpp | 13 |
3 files changed, 13 insertions, 16 deletions
diff --git a/benchmark/bench_misc.cpp b/benchmark/bench_misc.cpp index 23d1321ce..15dc58198 100644 --- a/benchmark/bench_misc.cpp +++ b/benchmark/bench_misc.cpp @@ -117,7 +117,7 @@ BENCH(TlToStringMessage, "TL to_string message") { td::vector<td::int32>{10000, 20000, 30000, 50000, 70000, 90000, 120000, 150000, 180000, 220000})); } x->content_ = td::td_api::make_object<td::td_api::messagePhoto>( - std::move(photo), td::td_api::make_object<td::td_api::formattedText>(), false, false, false); + std::move(photo), nullptr, td::td_api::make_object<td::td_api::formattedText>(), false, false, false); std::size_t res = 0; for (int i = 0; i < n; i++) { diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index e2e92423c..faad72845 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -2789,7 +2789,7 @@ inputTextQuote text:formattedText position:int32 = InputTextQuote; //@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat //@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. //-Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, -//-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLivePhoto, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageStakeDice, +//-messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageStakeDice, //-messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote messageReplyToMessage chat_id:int53 message_id:int53 quote:textQuote checklist_task_id:int32 poll_option_id:string origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; @@ -4734,15 +4734,6 @@ messageAudio audio:audio caption:formattedText = MessageContent; //@description A document message (general file) @document The document description @caption Document caption messageDocument document:document caption:formattedText = MessageContent; -//@description A live photo message -//@photo The photo -//@video The video representing the live photo -//@caption Live photo caption -//@show_caption_above_media True, if the caption must be shown above the live photo; otherwise, the caption must be shown below the live photo -//@has_spoiler True, if the live photo preview must be covered by a spoiler animation -//@is_secret True, if the live photo thumbnail must be blurred and the live photo must be shown only while tapped -messageLivePhoto photo:photo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; - //@description A message with paid media //@star_count Number of Telegram Stars needed to buy access to the media in the message //@media Information about the media @@ -4752,11 +4743,12 @@ messagePaidMedia star_count:int53 media:vector<PaidMedia> caption:formattedText //@description A photo message //@photo The photo +//@video The video representing the live photo; may be null if the photo is static //@caption Photo caption //@show_caption_above_media True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo //@has_spoiler True, if the photo preview must be covered by a spoiler animation //@is_secret True, if the photo must be blurred and must be shown only while tapped -messagePhoto photo:photo caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; +messagePhoto photo:photo video:video caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; //@description A sticker message @sticker The sticker description @is_premium True, if premium animation of the sticker must be played messageSticker sticker:sticker is_premium:Bool = MessageContent; diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index d9ff44888..05c793200 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -10547,9 +10547,14 @@ td_api::object_ptr<td_api::MessageContent> get_message_content_object( } case MessageContentType::LivePhoto: { const auto *m = static_cast<const MessageLivePhoto *>(content); - return make_tl_object<td_api::messageLivePhoto>( - get_photo_object(td->file_manager_.get(), m->photo), td->videos_manager_->get_video_object(m->video_file_id), - get_text_object(m->caption), invert_media, m->has_spoiler, is_content_secret); + auto photo = get_photo_object(td->file_manager_.get(), m->photo); + if (photo == nullptr) { + LOG(ERROR) << "Have empty " << m->photo; + return td_api::make_object<td_api::messageExpiredPhoto>(); + } + return td_api::make_object<td_api::messagePhoto>( + std::move(photo), td->videos_manager_->get_video_object(m->video_file_id), get_text_object(m->caption), + invert_media, m->has_spoiler, is_content_secret); } case MessageContentType::Location: { const auto *m = static_cast<const MessageLocation *>(content); @@ -10562,7 +10567,7 @@ td_api::object_ptr<td_api::MessageContent> get_message_content_object( LOG(ERROR) << "Have empty " << m->photo; return make_tl_object<td_api::messageExpiredPhoto>(); } - return make_tl_object<td_api::messagePhoto>(std::move(photo), get_text_object(m->caption), invert_media, + return make_tl_object<td_api::messagePhoto>(std::move(photo), nullptr, get_text_object(m->caption), invert_media, m->has_spoiler, is_content_secret); } case MessageContentType::Sticker: { |
