Add td_api::messageExpiredVideoNote and td_api::messageExpiredVoiceNote.
This commit is contained in:
parent
be8b21cdf4
commit
139b61e4b6
@ -2697,9 +2697,6 @@ messageDocument document:document caption:formattedText = MessageContent;
|
||||
//@is_secret True, if the photo must be blurred and must be shown only while tapped
|
||||
messagePhoto photo:photo caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
|
||||
|
||||
//@description A self-destructed photo message
|
||||
messageExpiredPhoto = 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;
|
||||
|
||||
@ -2710,15 +2707,24 @@ messageSticker sticker:sticker is_premium:Bool = MessageContent;
|
||||
//@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped
|
||||
messageVideo video:video caption:formattedText has_spoiler:Bool is_secret:Bool = MessageContent;
|
||||
|
||||
//@description A self-destructed video message
|
||||
messageExpiredVideo = MessageContent;
|
||||
|
||||
//@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped
|
||||
messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent;
|
||||
|
||||
//@description A voice note message @voice_note The voice note description @caption Voice note caption @is_listened True, if at least one of the recipients has listened to the voice note
|
||||
messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = MessageContent;
|
||||
|
||||
//@description A self-destructed photo message
|
||||
messageExpiredPhoto = MessageContent;
|
||||
|
||||
//@description A self-destructed video message
|
||||
messageExpiredVideo = MessageContent;
|
||||
|
||||
//@description A self-destructed video note message
|
||||
messageExpiredVideoNote = MessageContent;
|
||||
|
||||
//@description A self-destructed voice note message
|
||||
messageExpiredVoiceNote = MessageContent;
|
||||
|
||||
//@description A message with a location
|
||||
//@location The location description
|
||||
//@live_period Time relative to the message send date, for which the location can be updated, in seconds
|
||||
|
@ -357,8 +357,10 @@ bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_con
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::Video:
|
||||
return type_ == Type::RecordingVideo || type_ == Type::UploadingVideo;
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::VideoNote:
|
||||
return type_ == Type::RecordingVideoNote || type_ == Type::UploadingVideoNote;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::VoiceNote:
|
||||
return type_ == Type::RecordingVoiceNote || type_ == Type::UploadingVoiceNote;
|
||||
case MessageContentType::Contact:
|
||||
|
@ -1070,6 +1070,24 @@ class MessageGiveawayWinners final : public MessageContent {
|
||||
}
|
||||
};
|
||||
|
||||
class MessageExpiredVideoNote final : public MessageContent {
|
||||
public:
|
||||
MessageExpiredVideoNote() = default;
|
||||
|
||||
MessageContentType get_type() const final {
|
||||
return MessageContentType::ExpiredVideoNote;
|
||||
}
|
||||
};
|
||||
|
||||
class MessageExpiredVoiceNote final : public MessageContent {
|
||||
public:
|
||||
MessageExpiredVoiceNote() = default;
|
||||
|
||||
MessageContentType get_type() const final {
|
||||
return MessageContentType::ExpiredVoiceNote;
|
||||
}
|
||||
};
|
||||
|
||||
template <class StorerT>
|
||||
static void store(const MessageContent *content, StorerT &storer) {
|
||||
CHECK(content != nullptr);
|
||||
@ -1615,6 +1633,10 @@ static void store(const MessageContent *content, StorerT &storer) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2334,6 +2356,12 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
||||
content = std::move(m);
|
||||
break;
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
content = make_unique<MessageExpiredVideoNote>();
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
content = make_unique<MessageExpiredVoiceNote>();
|
||||
break;
|
||||
|
||||
default:
|
||||
is_bad = true;
|
||||
@ -2993,6 +3021,8 @@ bool can_have_input_media(const Td *td, const MessageContent *content, bool is_s
|
||||
case MessageContentType::GiftCode:
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return false;
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
@ -3131,6 +3161,8 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3269,6 +3301,8 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3471,6 +3505,8 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) {
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3693,6 +3729,8 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
|
||||
case MessageContentType::GiftCode:
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return Status::OK();
|
||||
@ -3711,7 +3749,7 @@ bool can_forward_message_content(const MessageContent *content) {
|
||||
}
|
||||
|
||||
return !is_service_message_content(content_type) && content_type != MessageContentType::Unsupported &&
|
||||
content_type != MessageContentType::ExpiredPhoto && content_type != MessageContentType::ExpiredVideo;
|
||||
!is_expired_message_content(content_type);
|
||||
}
|
||||
|
||||
bool update_opened_message_content(MessageContent *content) {
|
||||
@ -3837,6 +3875,8 @@ static int32 get_message_content_media_index_mask(const MessageContent *content,
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return 0;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -4114,6 +4154,10 @@ vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageConte
|
||||
const auto *content = static_cast<const MessageGiveawayWinners *>(message_content);
|
||||
return content->winner_user_ids;
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -4516,6 +4560,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -4663,6 +4709,8 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type;
|
||||
break;
|
||||
default:
|
||||
@ -5185,6 +5233,10 @@ void compare_message_contents(Td *td, const MessageContent *old_content, const M
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -5924,6 +5976,17 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
|
||||
<< oneline(to_string(media));
|
||||
break;
|
||||
}
|
||||
if (media->voice_) {
|
||||
return make_unique<MessageExpiredVoiceNote>();
|
||||
}
|
||||
if (media->round_) {
|
||||
return make_unique<MessageExpiredVideoNote>();
|
||||
}
|
||||
if (media->video_) {
|
||||
return make_unique<MessageExpiredVideo>();
|
||||
}
|
||||
LOG(ERROR) << "Receive messageMediaDocument without document and media type from " << source << ": "
|
||||
<< oneline(to_string(media));
|
||||
|
||||
return make_unique<MessageExpiredVideo>();
|
||||
}
|
||||
@ -6336,6 +6399,8 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
||||
case MessageContentType::GiftCode:
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return nullptr;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -7139,6 +7204,10 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
td->contacts_manager_->get_user_ids_object(m->winner_user_ids, "messagePremiumGiveawayWinners"),
|
||||
m->unclaimed_count);
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
return make_tl_object<td_api::messageExpiredVideoNote>();
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return make_tl_object<td_api::messageExpiredVoiceNote>();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
@ -7571,6 +7640,8 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return string();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -7670,16 +7741,22 @@ void update_expired_message_content(unique_ptr<MessageContent> &content) {
|
||||
case MessageContentType::Unsupported:
|
||||
// can happen if message content file identifier is broken
|
||||
break;
|
||||
case MessageContentType::VideoNote:
|
||||
content = make_unique<MessageExpiredVideoNote>();
|
||||
break;
|
||||
case MessageContentType::VoiceNote:
|
||||
content = make_unique<MessageExpiredVoiceNote>();
|
||||
break;
|
||||
case MessageContentType::ExpiredPhoto:
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
// can happen if message content has been reget from somewhere
|
||||
break;
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
case MessageContentType::Document:
|
||||
case MessageContentType::Sticker:
|
||||
case MessageContentType::VideoNote:
|
||||
case MessageContentType::VoiceNote:
|
||||
// can happen if server will send a document with a wrong content
|
||||
content = make_unique<MessageExpiredVideo>();
|
||||
break;
|
||||
@ -7903,6 +7980,10 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
break;
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
@ -138,6 +138,10 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont
|
||||
return string_builder << "GiveawayResults";
|
||||
case MessageContentType::GiveawayWinners:
|
||||
return string_builder << "GiveawayWinners";
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
return string_builder << "ExpiredVideoNote";
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return string_builder << "ExpiredVoiceNote";
|
||||
default:
|
||||
return string_builder << "Invalid type " << static_cast<int32>(content_type);
|
||||
}
|
||||
@ -209,6 +213,8 @@ bool is_allowed_media_group_content(MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -289,6 +295,8 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -305,6 +313,8 @@ bool is_service_message_content(MessageContentType content_type) {
|
||||
case MessageContentType::Document:
|
||||
case MessageContentType::ExpiredPhoto:
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::Game:
|
||||
case MessageContentType::Giveaway:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
@ -370,7 +380,6 @@ bool is_service_message_content(MessageContentType content_type) {
|
||||
}
|
||||
|
||||
bool is_supported_reply_message_content(MessageContentType content_type) {
|
||||
// update documentation when the list changes
|
||||
switch (content_type) {
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
@ -392,9 +401,12 @@ bool is_supported_reply_message_content(MessageContentType content_type) {
|
||||
case MessageContentType::Video:
|
||||
case MessageContentType::VideoNote:
|
||||
case MessageContentType::VoiceNote:
|
||||
// update documentation when the list changes
|
||||
return true;
|
||||
case MessageContentType::ExpiredPhoto:
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::LiveLocation:
|
||||
return false;
|
||||
default:
|
||||
@ -403,6 +415,18 @@ bool is_supported_reply_message_content(MessageContentType content_type) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_expired_message_content(MessageContentType content_type) {
|
||||
switch (content_type) {
|
||||
case MessageContentType::ExpiredPhoto:
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool can_have_message_content_caption(MessageContentType content_type) {
|
||||
switch (content_type) {
|
||||
case MessageContentType::Animation:
|
||||
@ -469,6 +493,8 @@ bool can_have_message_content_caption(MessageContentType content_type) {
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::GiveawayWinners:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -76,7 +76,9 @@ enum class MessageContentType : int32 {
|
||||
Giveaway,
|
||||
GiveawayLaunch,
|
||||
GiveawayResults,
|
||||
GiveawayWinners
|
||||
GiveawayWinners,
|
||||
ExpiredVideoNote,
|
||||
ExpiredVoiceNote
|
||||
};
|
||||
// increase MessageUnsupported::CURRENT_VERSION each time a new message content type is added
|
||||
|
||||
@ -92,6 +94,8 @@ bool is_service_message_content(MessageContentType content_type);
|
||||
|
||||
bool is_supported_reply_message_content(MessageContentType content_type);
|
||||
|
||||
bool is_expired_message_content(MessageContentType content_type);
|
||||
|
||||
bool can_have_message_content_caption(MessageContentType content_type);
|
||||
|
||||
uint64 get_message_content_chain_id(MessageContentType content_type);
|
||||
|
@ -13050,8 +13050,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
||||
}
|
||||
|
||||
bool noforwards = message_info.noforwards;
|
||||
bool is_expired =
|
||||
content_type == MessageContentType::ExpiredPhoto || content_type == MessageContentType::ExpiredVideo;
|
||||
bool is_expired = is_expired_message_content(content_type);
|
||||
if (is_expired) {
|
||||
CHECK(ttl == 0); // self-destruct time is ignored/set to 0 if the message has already been expired
|
||||
message_info.reply_header.replied_message_info_ = {};
|
||||
@ -24541,6 +24540,8 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo
|
||||
case MessageContentType::GiftCode:
|
||||
case MessageContentType::GiveawayLaunch:
|
||||
case MessageContentType::GiveawayResults:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -27714,6 +27715,8 @@ bool MessagesManager::is_message_notification_disabled(const Dialog *d, const Me
|
||||
case MessageContentType::Unsupported:
|
||||
case MessageContentType::ExpiredPhoto:
|
||||
case MessageContentType::ExpiredVideo:
|
||||
case MessageContentType::ExpiredVideoNote:
|
||||
case MessageContentType::ExpiredVoiceNote:
|
||||
case MessageContentType::PassportDataSent:
|
||||
case MessageContentType::PassportDataReceived:
|
||||
case MessageContentType::WebViewDataSent:
|
||||
@ -32535,8 +32538,7 @@ MessagesManager::Message *MessagesManager::add_scheduled_message_to_dialog(Dialo
|
||||
|
||||
auto message_content_type = message->content->get_type();
|
||||
if (is_service_message_content(message_content_type) || message_content_type == MessageContentType::LiveLocation ||
|
||||
message_content_type == MessageContentType::ExpiredPhoto ||
|
||||
message_content_type == MessageContentType::ExpiredVideo) {
|
||||
is_expired_message_content(message_content_type)) {
|
||||
LOG(ERROR) << "Tried to add " << message_id << " of type " << message_content_type << " to " << dialog_id
|
||||
<< " from " << source;
|
||||
debug_add_message_to_dialog_fail_reason_ = "skip adding message of unexpected type";
|
||||
@ -33352,8 +33354,7 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
|
||||
<< new_content_type;
|
||||
if (old_message->contains_mention != new_message->contains_mention) {
|
||||
if (old_message->edit_date == 0 && is_new_available && new_content_type != MessageContentType::PinMessage &&
|
||||
new_content_type != MessageContentType::ExpiredPhoto && new_content_type != MessageContentType::ExpiredVideo &&
|
||||
!replace_legacy) {
|
||||
!is_expired_message_content(new_content_type) && !replace_legacy) {
|
||||
LOG(ERROR) << message_id << " in " << dialog_id << " has changed contains_mention from "
|
||||
<< old_message->contains_mention << " to " << new_message->contains_mention
|
||||
<< ", is_outgoing = " << old_message->is_outgoing << ", message content type is " << old_content_type
|
||||
@ -33561,7 +33562,11 @@ bool MessagesManager::update_message_content(DialogId dialog_id, Message *old_me
|
||||
if (old_content_type != new_content_type) {
|
||||
if (old_message->ttl > 0 && old_message->ttl_expires_at > 0 &&
|
||||
((new_content_type == MessageContentType::ExpiredPhoto && old_content_type == MessageContentType::Photo) ||
|
||||
(new_content_type == MessageContentType::ExpiredVideo && old_content_type == MessageContentType::Video))) {
|
||||
(new_content_type == MessageContentType::ExpiredVideo && old_content_type == MessageContentType::Video) ||
|
||||
(new_content_type == MessageContentType::ExpiredVideoNote &&
|
||||
old_content_type == MessageContentType::VideoNote) ||
|
||||
(new_content_type == MessageContentType::ExpiredVoiceNote &&
|
||||
old_content_type == MessageContentType::VoiceNote))) {
|
||||
LOG(INFO) << "Do not apply expired message content early";
|
||||
} else {
|
||||
need_update = true;
|
||||
|
Loading…
Reference in New Issue
Block a user