Add ContactsManager::update_chat_online_member_count(ChatId).

This commit is contained in:
levlam 2024-02-19 01:46:57 +03:00
parent 32040c22cb
commit 59b1d7a4f6
2 changed files with 12 additions and 10 deletions

View File

@ -13607,18 +13607,12 @@ void ContactsManager::update_user_online_member_count(UserId user_id) {
} }
switch (dialog_id.get_type()) { switch (dialog_id.get_type()) {
case DialogType::Chat: { case DialogType::Chat:
auto chat_id = dialog_id.get_chat_id(); update_chat_online_member_count(dialog_id.get_chat_id(), false);
auto chat_full = get_chat_full(chat_id);
CHECK(chat_full != nullptr);
update_chat_online_member_count(chat_full, chat_id, false);
break; break;
} case DialogType::Channel:
case DialogType::Channel: { update_channel_online_member_count(dialog_id.get_channel_id(), false);
auto channel_id = dialog_id.get_channel_id();
update_channel_online_member_count(channel_id, false);
break; break;
}
case DialogType::User: case DialogType::User:
case DialogType::SecretChat: case DialogType::SecretChat:
case DialogType::None: case DialogType::None:
@ -13637,6 +13631,13 @@ void ContactsManager::update_user_online_member_count(UserId user_id) {
} }
} }
void ContactsManager::update_chat_online_member_count(ChatId chat_id, bool is_from_server) {
auto chat_full = get_chat_full(chat_id);
if (chat_full != nullptr) {
update_chat_online_member_count(chat_full, chat_id, false);
}
}
void ContactsManager::update_chat_online_member_count(const ChatFull *chat_full, ChatId chat_id, bool is_from_server) { void ContactsManager::update_chat_online_member_count(const ChatFull *chat_full, ChatId chat_id, bool is_from_server) {
update_dialog_online_member_count(chat_full->participants, DialogId(chat_id), is_from_server); update_dialog_online_member_count(chat_full->participants, DialogId(chat_id), is_from_server);
} }

View File

@ -1552,6 +1552,7 @@ class ContactsManager final : public Actor {
void do_invalidate_channel_full(ChannelFull *channel_full, ChannelId channel_id, bool need_drop_slow_mode_delay); void do_invalidate_channel_full(ChannelFull *channel_full, ChannelId channel_id, bool need_drop_slow_mode_delay);
void update_user_online_member_count(UserId user_id); void update_user_online_member_count(UserId user_id);
void update_chat_online_member_count(ChatId chat_id, bool is_from_server);
void update_chat_online_member_count(const ChatFull *chat_full, ChatId chat_id, bool is_from_server); void update_chat_online_member_count(const ChatFull *chat_full, ChatId chat_id, bool is_from_server);
void update_channel_online_member_count(ChannelId channel_id, bool is_from_server); void update_channel_online_member_count(ChannelId channel_id, bool is_from_server);
void update_dialog_online_member_count(const vector<DialogParticipant> &participants, DialogId dialog_id, void update_dialog_online_member_count(const vector<DialogParticipant> &participants, DialogId dialog_id,