Add messageVoiceChatScheduled.
This commit is contained in:
parent
3f1e91e7f4
commit
bb1b82731e
@ -1683,6 +1683,9 @@ messageInvoice title:string description:string photo:photo currency:string total
|
|||||||
//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds
|
//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds
|
||||||
messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent;
|
messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent;
|
||||||
|
|
||||||
|
//@description A new voice chat was scheduled @group_call_id Identifier of the voice chat. The voice chat can be received through the method getGroupCall @start_date Point in time (Unix timestamp) when the group call will be started
|
||||||
|
messageVoiceChatScheduled group_call_id:int32 start_date:int32 = MessageContent;
|
||||||
|
|
||||||
//@description A newly created voice chat @group_call_id Identifier of the voice chat. The voice chat can be received through the method getGroupCall
|
//@description A newly created voice chat @group_call_id Identifier of the voice chat. The voice chat can be received through the method getGroupCall
|
||||||
messageVoiceChatStarted group_call_id:int32 = MessageContent;
|
messageVoiceChatStarted group_call_id:int32 = MessageContent;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ class MessageChatSetTtl : public MessageContent {
|
|||||||
|
|
||||||
class MessageUnsupported : public MessageContent {
|
class MessageUnsupported : public MessageContent {
|
||||||
public:
|
public:
|
||||||
static constexpr int32 CURRENT_VERSION = 6;
|
static constexpr int32 CURRENT_VERSION = 7;
|
||||||
int32 version = CURRENT_VERSION;
|
int32 version = CURRENT_VERSION;
|
||||||
|
|
||||||
MessageUnsupported() = default;
|
MessageUnsupported() = default;
|
||||||
@ -695,10 +695,11 @@ class MessageGroupCall : public MessageContent {
|
|||||||
public:
|
public:
|
||||||
InputGroupCallId input_group_call_id;
|
InputGroupCallId input_group_call_id;
|
||||||
int32 duration = -1;
|
int32 duration = -1;
|
||||||
|
int32 schedule_date = -1;
|
||||||
|
|
||||||
MessageGroupCall() = default;
|
MessageGroupCall() = default;
|
||||||
MessageGroupCall(InputGroupCallId input_group_call_id, int32 duration)
|
MessageGroupCall(InputGroupCallId input_group_call_id, int32 duration, int32 schedule_date)
|
||||||
: input_group_call_id(input_group_call_id), duration(duration) {
|
: input_group_call_id(input_group_call_id), duration(duration), schedule_date(schedule_date) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageContentType get_type() const override {
|
MessageContentType get_type() const override {
|
||||||
@ -994,13 +995,18 @@ static void store(const MessageContent *content, StorerT &storer) {
|
|||||||
case MessageContentType::GroupCall: {
|
case MessageContentType::GroupCall: {
|
||||||
auto m = static_cast<const MessageGroupCall *>(content);
|
auto m = static_cast<const MessageGroupCall *>(content);
|
||||||
bool has_duration = m->duration >= 0;
|
bool has_duration = m->duration >= 0;
|
||||||
|
bool has_schedule_date = m->schedule_date > 0;
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(has_duration);
|
STORE_FLAG(has_duration);
|
||||||
|
STORE_FLAG(has_schedule_date);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
store(m->input_group_call_id, storer);
|
store(m->input_group_call_id, storer);
|
||||||
if (has_duration) {
|
if (has_duration) {
|
||||||
store(m->duration, storer);
|
store(m->duration, storer);
|
||||||
}
|
}
|
||||||
|
if (has_schedule_date) {
|
||||||
|
store(m->schedule_date, storer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageContentType::InviteToGroupCall: {
|
case MessageContentType::InviteToGroupCall: {
|
||||||
@ -1393,13 +1399,18 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
|||||||
case MessageContentType::GroupCall: {
|
case MessageContentType::GroupCall: {
|
||||||
auto m = make_unique<MessageGroupCall>();
|
auto m = make_unique<MessageGroupCall>();
|
||||||
bool has_duration;
|
bool has_duration;
|
||||||
|
bool has_schedule_date;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(has_duration);
|
PARSE_FLAG(has_duration);
|
||||||
|
PARSE_FLAG(has_schedule_date);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
parse(m->input_group_call_id, parser);
|
parse(m->input_group_call_id, parser);
|
||||||
if (has_duration) {
|
if (has_duration) {
|
||||||
parse(m->duration, parser);
|
parse(m->duration, parser);
|
||||||
}
|
}
|
||||||
|
if (has_schedule_date) {
|
||||||
|
parse(m->schedule_date, parser);
|
||||||
|
}
|
||||||
content = std::move(m);
|
content = std::move(m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3165,7 +3176,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
case MessageContentType::GroupCall: {
|
case MessageContentType::GroupCall: {
|
||||||
auto old_ = static_cast<const MessageGroupCall *>(old_content);
|
auto old_ = static_cast<const MessageGroupCall *>(old_content);
|
||||||
auto new_ = static_cast<const MessageGroupCall *>(new_content);
|
auto new_ = static_cast<const MessageGroupCall *>(new_content);
|
||||||
if (old_->input_group_call_id != new_->input_group_call_id || old_->duration != new_->duration) {
|
if (old_->input_group_call_id != new_->input_group_call_id || old_->duration != new_->duration ||
|
||||||
|
old_->schedule_date != new_->schedule_date) {
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if (!old_->input_group_call_id.is_identical(new_->input_group_call_id)) {
|
if (!old_->input_group_call_id.is_identical(new_->input_group_call_id)) {
|
||||||
@ -4419,7 +4431,7 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return make_unique<MessageGroupCall>(InputGroupCallId(group_call->call_), duration);
|
return make_unique<MessageGroupCall>(InputGroupCallId(group_call->call_), duration, -1);
|
||||||
}
|
}
|
||||||
case telegram_api::messageActionInviteToGroupCall::ID: {
|
case telegram_api::messageActionInviteToGroupCall::ID: {
|
||||||
auto invite_to_group_call = move_tl_object_as<telegram_api::messageActionInviteToGroupCall>(action);
|
auto invite_to_group_call = move_tl_object_as<telegram_api::messageActionInviteToGroupCall>(action);
|
||||||
@ -4444,11 +4456,16 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
LOG(ERROR) << "Receive wrong TTL = " << set_messages_ttl->period_;
|
LOG(ERROR) << "Receive wrong TTL = " << set_messages_ttl->period_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return td::make_unique<MessageChatSetTtl>(set_messages_ttl->period_);
|
return make_unique<MessageChatSetTtl>(set_messages_ttl->period_);
|
||||||
}
|
}
|
||||||
case telegram_api::messageActionGroupCallScheduled::ID: {
|
case telegram_api::messageActionGroupCallScheduled::ID: {
|
||||||
auto scheduled_group_call = move_tl_object_as<telegram_api::messageActionGroupCallScheduled>(action);
|
auto scheduled_group_call = move_tl_object_as<telegram_api::messageActionGroupCallScheduled>(action);
|
||||||
break;
|
if (scheduled_group_call->schedule_date_ <= 0) {
|
||||||
|
LOG(ERROR) << "Receive wrong schedule_date = " << scheduled_group_call->schedule_date_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return make_unique<MessageGroupCall>(InputGroupCallId(scheduled_group_call->call_), -1,
|
||||||
|
scheduled_group_call->schedule_date_);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -4664,8 +4681,12 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
if (m->duration >= 0) {
|
if (m->duration >= 0) {
|
||||||
return make_tl_object<td_api::messageVoiceChatEnded>(m->duration);
|
return make_tl_object<td_api::messageVoiceChatEnded>(m->duration);
|
||||||
} else {
|
} else {
|
||||||
return make_tl_object<td_api::messageVoiceChatStarted>(
|
auto group_call_id = td->group_call_manager_->get_group_call_id(m->input_group_call_id, DialogId()).get();
|
||||||
td->group_call_manager_->get_group_call_id(m->input_group_call_id, DialogId()).get());
|
if (m->schedule_date > 0) {
|
||||||
|
return make_tl_object<td_api::messageVoiceChatScheduled>(group_call_id, m->schedule_date);
|
||||||
|
} else {
|
||||||
|
return make_tl_object<td_api::messageVoiceChatStarted>(group_call_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MessageContentType::InviteToGroupCall: {
|
case MessageContentType::InviteToGroupCall: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user