Add ContactsManager::for_each_secret_chat_with_user.
GitOrigin-RevId: bf81c627a6d4cf00ff5b6c8882079cce23d636f3
This commit is contained in:
parent
b91c4ecf88
commit
369345f47c
@ -7810,6 +7810,15 @@ ContactsManager::ChannelFull *ContactsManager::get_channel_full_force(ChannelId
|
|||||||
return get_channel_full(channel_id);
|
return get_channel_full(channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::for_each_secret_chat_with_user(UserId user_id, std::function<void(SecretChatId)> f) {
|
||||||
|
auto it = secret_chats_with_user_.find(user_id);
|
||||||
|
if (it != secret_chats_with_user_.end()) {
|
||||||
|
for (auto secret_chat_id : it->second) {
|
||||||
|
f(secret_chat_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, bool from_database) {
|
void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, bool from_database) {
|
||||||
CHECK(u != nullptr);
|
CHECK(u != nullptr);
|
||||||
if (u->is_name_changed || u->is_username_changed || u->is_is_contact_changed) {
|
if (u->is_name_changed || u->is_username_changed || u->is_is_contact_changed) {
|
||||||
@ -7836,21 +7845,17 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
|
|||||||
}
|
}
|
||||||
if (u->is_name_changed) {
|
if (u->is_name_changed) {
|
||||||
td_->messages_manager_->on_dialog_title_updated(DialogId(user_id));
|
td_->messages_manager_->on_dialog_title_updated(DialogId(user_id));
|
||||||
auto it = secret_chats_with_user_.find(user_id);
|
for_each_secret_chat_with_user(user_id,
|
||||||
if (it != secret_chats_with_user_.end()) {
|
[messages_manager = td_->messages_manager_.get()](SecretChatId secret_chat_id) {
|
||||||
for (auto secret_chat_id : it->second) {
|
messages_manager->on_dialog_title_updated(DialogId(secret_chat_id));
|
||||||
td_->messages_manager_->on_dialog_title_updated(DialogId(secret_chat_id));
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (u->is_photo_changed) {
|
if (u->is_photo_changed) {
|
||||||
td_->messages_manager_->on_dialog_photo_updated(DialogId(user_id));
|
td_->messages_manager_->on_dialog_photo_updated(DialogId(user_id));
|
||||||
auto it = secret_chats_with_user_.find(user_id);
|
for_each_secret_chat_with_user(user_id,
|
||||||
if (it != secret_chats_with_user_.end()) {
|
[messages_manager = td_->messages_manager_.get()](SecretChatId secret_chat_id) {
|
||||||
for (auto secret_chat_id : it->second) {
|
messages_manager->on_dialog_photo_updated(DialogId(secret_chat_id));
|
||||||
td_->messages_manager_->on_dialog_photo_updated(DialogId(secret_chat_id));
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_user_photo_id(u, user_id, u->photo.id, dialog_photo_get_file_ids(u->photo));
|
add_user_photo_id(u, user_id, u->photo.id, dialog_photo_get_file_ids(u->photo));
|
||||||
|
|
||||||
|
@ -117,6 +117,8 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
bool is_update_about_username_change_received(UserId user_id) const;
|
bool is_update_about_username_change_received(UserId user_id) const;
|
||||||
|
|
||||||
|
void for_each_secret_chat_with_user(UserId user_id, std::function<void(SecretChatId)> f);
|
||||||
|
|
||||||
string get_user_username(UserId user_id) const;
|
string get_user_username(UserId user_id) const;
|
||||||
string get_channel_username(ChannelId channel_id) const;
|
string get_channel_username(ChannelId channel_id) const;
|
||||||
string get_secret_chat_username(SecretChatId secret_chat_id) const;
|
string get_secret_chat_username(SecretChatId secret_chat_id) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user