Added updateChatAddedToList and updateChatRemovedFromList.

This commit is contained in:
levlam 2024-02-23 13:38:51 +03:00
parent 77abbdba60
commit 08084f35e3
3 changed files with 24 additions and 7 deletions

View File

@ -1691,6 +1691,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
//@permissions Actions that non-administrator chat members are allowed to take in the chat
//@last_message Last message in the chat; may be null if none or unknown
//@positions Positions of the chat in chat lists
//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list
//@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender
//@block_list Block list to which the chat is added; may be null if none
//@has_protected_content True, if chat content can't be saved locally, forwarded, or copied
@ -1719,7 +1720,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
//@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 if none
//@client_data 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 accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector<chatPosition> message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics: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 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector<chatPosition> chat_lists:vector<ChatList> message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics: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 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
//@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers
chats total_count:int32 chat_ids:vector<int53> = Chats;
@ -6488,6 +6489,12 @@ updateChatLastMessage chat_id:int53 last_message:message positions:vector<chatPo
//@position New chat position. If new order is 0, then the chat needs to be removed from the list
updateChatPosition chat_id:int53 position:chatPosition = Update;
//@description A chat was added to a chat list @chat_id Chat identifier @chat_list The chat list to which the chat was added
updateChatAddedToList chat_id:int53 chat_list:ChatList = Update;
//@description A chat was removed from a chat list @chat_id Chat identifier @chat_list The chat list from which the chat was removed
updateChatRemovedFromList chat_id:int53 chat_list:ChatList = Update;
//@description Incoming messages were read or the number of unread messages has been changed @chat_id Chat identifier @last_read_inbox_message_id Identifier of the last read incoming message @unread_count The number of unread messages left in the chat
updateChatReadInbox chat_id:int53 last_read_inbox_message_id:int53 unread_count:int32 = Update;

View File

@ -19179,6 +19179,8 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
auto available_reactions = get_dialog_active_reactions(d).get_chat_available_reactions_object();
auto is_translatable = d->is_translatable && is_premium;
auto block_list_id = BlockListId(d->is_blocked, d->is_blocked_for_stories);
auto chat_lists = transform(get_dialog_list_ids(d),
[](DialogListId dialog_list_id) { return dialog_list_id.get_chat_list_object(); });
return make_tl_object<td_api::chat>(
d->dialog_id.get(), td_->dialog_manager_->get_chat_type_object(d->dialog_id),
td_->dialog_manager_->get_dialog_title(d->dialog_id),
@ -19189,10 +19191,10 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
td_->dialog_manager_->get_dialog_profile_background_custom_emoji_id(d->dialog_id).get(),
td_->dialog_manager_->get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
get_chat_positions_object(d), get_default_message_sender_object(d), block_list_id.get_block_list_object(),
td_->dialog_manager_->get_dialog_has_protected_content(d->dialog_id), is_translatable, d->is_marked_as_unread,
get_dialog_view_as_topics(d), get_dialog_has_scheduled_messages(d), can_delete.for_self_,
can_delete.for_all_users_, td_->dialog_manager_->can_report_dialog(d->dialog_id),
get_chat_positions_object(d), std::move(chat_lists), get_default_message_sender_object(d),
block_list_id.get_block_list_object(), td_->dialog_manager_->get_dialog_has_protected_content(d->dialog_id),
is_translatable, d->is_marked_as_unread, get_dialog_view_as_topics(d), get_dialog_has_scheduled_messages(d),
can_delete.for_self_, can_delete.for_all_users_, td_->dialog_manager_->can_report_dialog(d->dialog_id),
d->notification_settings.silent_send_message, 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->unread_reaction_count, get_chat_notification_settings_object(&d->notification_settings),
@ -35432,12 +35434,20 @@ void MessagesManager::add_dialog_to_list(Dialog *d, DialogListId dialog_list_id)
LOG(INFO) << "Add " << d->dialog_id << " to " << dialog_list_id;
CHECK(!is_dialog_in_list(d, dialog_list_id));
d->dialog_list_ids.push_back(dialog_list_id);
CHECK(d->is_update_new_chat_sent);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatAddedToList>(
get_chat_id_object(d->dialog_id, "add_dialog_to_list"), dialog_list_id.get_chat_list_object()));
}
void MessagesManager::remove_dialog_from_list(Dialog *d, DialogListId dialog_list_id) {
LOG(INFO) << "Remove " << d->dialog_id << " from " << dialog_list_id;
bool is_removed = td::remove(d->dialog_list_ids, dialog_list_id);
CHECK(is_removed);
CHECK(d->is_update_new_chat_sent);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatRemovedFromList>(
get_chat_id_object(d->dialog_id, "remove_dialog_from_list"), dialog_list_id.get_chat_list_object()));
}
DialogFilterDialogInfo MessagesManager::get_dialog_info_for_dialog_filter(const Dialog *d) const {

View File

@ -2615,9 +2615,9 @@ class MessagesManager final : public Actor {
static bool is_dialog_in_list(const Dialog *d, DialogListId dialog_list_id);
static void add_dialog_to_list(Dialog *d, DialogListId dialog_list_id);
void add_dialog_to_list(Dialog *d, DialogListId dialog_list_id);
static void remove_dialog_from_list(Dialog *d, DialogListId dialog_list_id);
void remove_dialog_from_list(Dialog *d, DialogListId dialog_list_id);
DialogFilterDialogInfo get_dialog_info_for_dialog_filter(const Dialog *d) const;