Add get_expired_message_content_type.
This commit is contained in:
parent
f3c52beaba
commit
3d0f92e0cb
@ -522,6 +522,21 @@ bool is_expired_message_content(MessageContentType content_type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageContentType get_expired_message_content_type(MessageContentType content_type) {
|
||||||
|
switch (content_type) {
|
||||||
|
case MessageContentType::Photo:
|
||||||
|
return MessageContentType::ExpiredPhoto;
|
||||||
|
case MessageContentType::Video:
|
||||||
|
return MessageContentType::ExpiredVideo;
|
||||||
|
case MessageContentType::VideoNote:
|
||||||
|
return MessageContentType::ExpiredVideoNote;
|
||||||
|
case MessageContentType::VoiceNote:
|
||||||
|
return MessageContentType::ExpiredVoiceNote;
|
||||||
|
default:
|
||||||
|
return MessageContentType::None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool can_have_message_content_caption(MessageContentType content_type) {
|
bool can_have_message_content_caption(MessageContentType content_type) {
|
||||||
switch (content_type) {
|
switch (content_type) {
|
||||||
case MessageContentType::Animation:
|
case MessageContentType::Animation:
|
||||||
|
@ -102,6 +102,8 @@ bool is_supported_reply_message_content(MessageContentType content_type);
|
|||||||
|
|
||||||
bool is_expired_message_content(MessageContentType content_type);
|
bool is_expired_message_content(MessageContentType content_type);
|
||||||
|
|
||||||
|
MessageContentType get_expired_message_content_type(MessageContentType content_type);
|
||||||
|
|
||||||
bool can_have_message_content_caption(MessageContentType content_type);
|
bool can_have_message_content_caption(MessageContentType content_type);
|
||||||
|
|
||||||
uint64 get_message_content_chain_id(MessageContentType content_type);
|
uint64 get_message_content_chain_id(MessageContentType content_type);
|
||||||
|
@ -33945,12 +33945,8 @@ bool MessagesManager::update_message_content(DialogId dialog_id, Message *old_me
|
|||||||
bool need_finish_upload = old_file_id.is_valid() && need_merge_files;
|
bool need_finish_upload = old_file_id.is_valid() && need_merge_files;
|
||||||
if (old_content_type != new_content_type) {
|
if (old_content_type != new_content_type) {
|
||||||
if (old_message->ttl.is_valid() && old_message->ttl_expires_at > 0 &&
|
if (old_message->ttl.is_valid() && old_message->ttl_expires_at > 0 &&
|
||||||
((new_content_type == MessageContentType::ExpiredPhoto && old_content_type == MessageContentType::Photo) ||
|
is_expired_message_content(new_content_type) &&
|
||||||
(new_content_type == MessageContentType::ExpiredVideo && old_content_type == MessageContentType::Video) ||
|
get_expired_message_content_type(old_content_type) == new_content_type) {
|
||||||
(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";
|
LOG(INFO) << "Do not apply expired message content early";
|
||||||
} else {
|
} else {
|
||||||
need_update = true;
|
need_update = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user