Support telegram_api::messageActionSetMessagesTTL.

This commit is contained in:
levlam 2021-02-16 15:15:45 +03:00
parent 65d4229352
commit f92339de85
3 changed files with 14 additions and 1 deletions

View File

@ -1708,7 +1708,7 @@ messagePinMessage message_id:int53 = MessageContent;
//@description A screenshot of a message in the chat has been taken
messageScreenshotTaken = MessageContent;
//@description The TTL (Time To Live) setting messages in a secret chat has been changed @ttl New TTL
//@description The TTL (Time To Live) setting for messages in the chat has been changed @ttl New message TTL setting
messageChatSetTtl ttl:int32 = MessageContent;
//@description A non-standard action has happened in the chat @text Message text to be shown in the chat

View File

@ -4525,6 +4525,10 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
auto duration =
(phone_call->flags_ & telegram_api::messageActionPhoneCall::DURATION_MASK) != 0 ? phone_call->duration_ : 0;
auto is_video = (phone_call->flags_ & telegram_api::messageActionPhoneCall::VIDEO_MASK) != 0;
if (duration < 0) {
LOG(ERROR) << "Receive invalid " << oneline(to_string(phone_call));
break;
}
return make_unique<MessageCall>(phone_call->call_id_, duration, get_call_discard_reason(phone_call->reason_),
is_video);
}
@ -4622,6 +4626,14 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
return td::make_unique<MessageInviteToGroupCall>(InputGroupCallId(invite_to_group_call->call_),
std::move(user_ids));
}
case telegram_api::messageActionSetMessagesTTL::ID: {
auto set_messages_ttl = move_tl_object_as<telegram_api::messageActionSetMessagesTTL>(action);
if (set_messages_ttl->period_ < 0) {
LOG(ERROR) << "Receive wrong ttl = " << set_messages_ttl->period_;
break;
}
return td::make_unique<MessageChatSetTtl>(set_messages_ttl->period_);
}
default:
UNREACHABLE();
}

View File

@ -608,6 +608,7 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_
case telegram_api::messageActionSecureValuesSentMe::ID:
case telegram_api::messageActionContactSignUp::ID:
case telegram_api::messageActionGroupCall::ID:
case telegram_api::messageActionSetMessagesTTL::ID:
break;
case telegram_api::messageActionChatCreate::ID: {
auto chat_create = static_cast<const telegram_api::messageActionChatCreate *>(action);