Add td_api::voiceChat class.

This commit is contained in:
levlam 2021-03-08 17:00:39 +03:00
parent 159c4f3f00
commit f24ca02f37
3 changed files with 24 additions and 17 deletions

View File

@ -891,6 +891,13 @@ chatSourcePublicServiceAnnouncement type:string text:string = ChatSource;
chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPosition; chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPosition;
//@description Describes a voice chat
//@group_call_id Group call identifier of an active voice chat; 0 if none. Full informationa about the voice chat can be received through the method getGroupCall
//@has_participants True, if the voice chat has participants
//@default_join_as_chat_id Chat identifier of a chat, under which name to join voice chat by default; 0 if none or unknown
voiceChat group_call_id:int32 has_participants:Bool default_join_as_chat_id:int53 = VoiceChat;
//@description A chat. (Can be a private chat, basic group, supergroup, or secret chat) //@description A chat. (Can be a private chat, basic group, supergroup, or secret chat)
//@id Chat unique identifier //@id Chat unique identifier
//@type Type of the chat //@type Type of the chat
@ -913,13 +920,11 @@ chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPo
//@notification_settings Notification settings for this chat //@notification_settings Notification settings for this chat
//@message_ttl_setting Current message Time To Live setting (self-destruct timer) for the chat; 0 if not defined. TTL is counted from the time message or its content is viewed in secret chats and from the send date in other chats //@message_ttl_setting Current message Time To Live setting (self-destruct timer) for the chat; 0 if not defined. TTL is counted from the time message or its content is viewed in secret chats and from the send date in other chats
//@action_bar Describes actions which should be possible to do through a chat action bar; may be null //@action_bar Describes actions which should be possible to do through a chat action bar; may be null
//@voice_chat_group_call_id Group call identifier of an active voice chat; 0 if none or unknown. The voice chat can be received through the method getGroupCall //@voice_chat Contains information about voice chat of the chat
//@is_voice_chat_empty True, if an active voice chat is empty
//@default_join_voice_chat_as_chat_id Chat identifier of a chat, under which name to join voice chat by default; 0 if none or unknown
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
//@draft_message A draft of a message in the chat; may be null //@draft_message A draft of a message in the chat; may be null
//@client_data Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used //@client_data Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 action_bar:ChatActionBar voice_chat_group_call_id:int32 is_voice_chat_empty:Bool default_join_voice_chat_as_chat_id:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 action_bar:ChatActionBar voice_chat:voiceChat reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers //@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
chats total_count:int32 chat_ids:vector<int53> = Chats; chats total_count:int32 chat_ids:vector<int53> = Chats;
@ -3388,8 +3393,8 @@ updateChatIsBlocked chat_id:int53 is_blocked:Bool = Update;
//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages //@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages
updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update; updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update;
//@description A chat voice chat state has changed @chat_id Chat identifier @voice_chat_group_call_id New value of voice_chat_group_call_id @is_voice_chat_empty New value of is_voice_chat_empty @default_join_voice_chat_as_chat_id Chat identifier of a chat, under which name to join voice chat by default; 0 if none or unknown //@description A chat voice chat state has changed @chat_id Chat identifier @voice_chat New value of voice_chat
updateChatVoiceChat chat_id:int53 voice_chat_group_call_id:int32 is_voice_chat_empty:Bool default_join_voice_chat_as_chat_id:int53 = Update; updateChatVoiceChat chat_id:int53 voice_chat:voiceChat = Update;
//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value //@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value
updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update; updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update;

View File

@ -19855,6 +19855,13 @@ td_api::object_ptr<td_api::ChatActionBar> MessagesManager::get_chat_action_bar_o
return nullptr; return nullptr;
} }
td_api::object_ptr<td_api::voiceChat> MessagesManager::get_voice_chat_object(const Dialog *d) const {
auto active_group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, d->dialog_id);
return make_tl_object<td_api::voiceChat>(active_group_call_id.get(),
active_group_call_id.is_valid() ? !d->is_group_call_empty : false,
d->default_join_group_call_as_dialog_id.get());
}
td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *d) const { td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *d) const {
CHECK(d != nullptr); CHECK(d != nullptr);
@ -19914,8 +19921,6 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
// TODO hide/show draft message when can_send_message(dialog_id) changes // TODO hide/show draft message when can_send_message(dialog_id) changes
auto draft_message = can_send_message(d->dialog_id).is_ok() ? get_draft_message_object(d->draft_message) : nullptr; auto draft_message = can_send_message(d->dialog_id).is_ok() ? get_draft_message_object(d->draft_message) : nullptr;
auto active_group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, d->dialog_id);
return make_tl_object<td_api::chat>( return make_tl_object<td_api::chat>(
d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_dialog_title(d->dialog_id), d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_dialog_title(d->dialog_id),
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)), get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
@ -19926,10 +19931,8 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(), d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
d->last_read_outbox_message_id.get(), d->unread_mention_count, d->last_read_outbox_message_id.get(), d->unread_mention_count,
get_chat_notification_settings_object(&d->notification_settings), get_chat_notification_settings_object(&d->notification_settings),
d->message_ttl_setting.get_message_ttl_setting_object(), get_chat_action_bar_object(d), d->message_ttl_setting.get_message_ttl_setting_object(), get_chat_action_bar_object(d), get_voice_chat_object(d),
active_group_call_id.get(), active_group_call_id.is_valid() ? d->is_group_call_empty : true, d->reply_markup_message_id.get(), std::move(draft_message), d->client_data);
d->default_join_group_call_as_dialog_id.get(), d->reply_markup_message_id.get(), std::move(draft_message),
d->client_data);
} }
tl_object_ptr<td_api::chat> MessagesManager::get_chat_object(DialogId dialog_id) const { tl_object_ptr<td_api::chat> MessagesManager::get_chat_object(DialogId dialog_id) const {
@ -28557,11 +28560,8 @@ void MessagesManager::send_update_chat_voice_chat(const Dialog *d) {
CHECK(d != nullptr); CHECK(d != nullptr);
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_voice_chat"; LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_voice_chat";
on_dialog_updated(d->dialog_id, "send_update_chat_voice_chat"); on_dialog_updated(d->dialog_id, "send_update_chat_voice_chat");
auto group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, d->dialog_id); send_closure(G()->td(), &Td::send_update,
send_closure( td_api::make_object<td_api::updateChatVoiceChat>(d->dialog_id.get(), get_voice_chat_object(d)));
G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatVoiceChat>(d->dialog_id.get(), group_call_id.get(), d->is_group_call_empty,
d->default_join_group_call_as_dialog_id.get()));
} }
void MessagesManager::send_update_chat_message_ttl_setting(const Dialog *d) { void MessagesManager::send_update_chat_message_ttl_setting(const Dialog *d) {

View File

@ -2418,6 +2418,8 @@ class MessagesManager : public Actor {
td_api::object_ptr<td_api::ChatActionBar> get_chat_action_bar_object(const Dialog *d, td_api::object_ptr<td_api::ChatActionBar> get_chat_action_bar_object(const Dialog *d,
bool hide_unarchive = false) const; bool hide_unarchive = false) const;
td_api::object_ptr<td_api::voiceChat> get_voice_chat_object(const Dialog *d) const;
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const; td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const;
Dialog *get_dialog(DialogId dialog_id); Dialog *get_dialog(DialogId dialog_id);