Update bio of group call participants when it is changed.
This commit is contained in:
parent
caa1db85ab
commit
f4ce6c9de9
@ -22,6 +22,7 @@
|
||||
#include "td/telegram/files/FileType.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/GroupCallManager.h"
|
||||
#include "td/telegram/InlineQueriesManager.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/logevent/LogEvent.h"
|
||||
@ -6143,6 +6144,7 @@ void ContactsManager::on_update_profile_success(int32 flags, const string &first
|
||||
user_full->about = about;
|
||||
user_full->is_changed = true;
|
||||
update_user_full(user_full, my_user_id);
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(my_user_id), user_full->about, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9249,6 +9251,8 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val
|
||||
register_user_photo(u, user_id, user_full->photo);
|
||||
}
|
||||
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(user_id), user_full->about, false);
|
||||
|
||||
update_user_full(user_full, user_id, true);
|
||||
|
||||
if (is_user_deleted(user_id)) {
|
||||
@ -9438,6 +9442,9 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val
|
||||
reload_chat_full(chat_id, Auto());
|
||||
}
|
||||
}
|
||||
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(chat_id), chat_full->description, false);
|
||||
|
||||
on_update_chat_full_photo(chat_full, chat_id, std::move(chat_full->photo));
|
||||
|
||||
update_chat_full(chat_full, chat_id, true);
|
||||
@ -9548,6 +9555,8 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
|
||||
}
|
||||
}
|
||||
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(channel_id), channel_full->description, false);
|
||||
|
||||
td_->messages_manager_->on_dialog_bots_updated(DialogId(channel_id), channel_full->bot_user_ids, true);
|
||||
|
||||
update_channel_full(channel_full, channel_id, true);
|
||||
@ -10079,14 +10088,18 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
|
||||
bool supports_video_calls = user->video_calls_available_ && !user->phone_calls_private_;
|
||||
bool has_private_calls = user->phone_calls_private_;
|
||||
if (user_full->can_be_called != can_be_called || user_full->supports_video_calls != supports_video_calls ||
|
||||
user_full->has_private_calls != has_private_calls || user_full->about != user->about_) {
|
||||
user_full->has_private_calls != has_private_calls) {
|
||||
user_full->can_be_called = can_be_called;
|
||||
user_full->supports_video_calls = supports_video_calls;
|
||||
user_full->has_private_calls = has_private_calls;
|
||||
user_full->about = std::move(user->about_);
|
||||
|
||||
user_full->is_changed = true;
|
||||
}
|
||||
if (user_full->about != user->about_) {
|
||||
user_full->about = std::move(user->about_);
|
||||
user_full->is_changed = true;
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(user_id), user_full->about, true);
|
||||
}
|
||||
|
||||
auto photo = get_photo(td_->file_manager_.get(), std::move(user->profile_photo_), DialogId(user_id));
|
||||
if (photo != user_full->photo) {
|
||||
@ -10335,6 +10348,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
if (chat_full->description != chat->about_) {
|
||||
chat_full->description = std::move(chat->about_);
|
||||
chat_full->is_changed = true;
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(chat_id), chat_full->description, true);
|
||||
}
|
||||
if (chat_full->can_set_username != chat->can_set_username_) {
|
||||
chat_full->can_set_username = chat->can_set_username_;
|
||||
@ -10428,7 +10442,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
|
||||
channel_full->repair_request_version = 0;
|
||||
channel_full->expires_at = Time::now() + CHANNEL_FULL_EXPIRE_TIME;
|
||||
if (channel_full->description != channel->about_ || channel_full->participant_count != participant_count ||
|
||||
if (channel_full->participant_count != participant_count ||
|
||||
channel_full->administrator_count != administrator_count ||
|
||||
channel_full->restricted_count != restricted_count || channel_full->banned_count != banned_count ||
|
||||
channel_full->can_get_participants != can_get_participants ||
|
||||
@ -10438,7 +10452,6 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
channel_full->can_view_statistics != can_view_statistics || channel_full->stats_dc_id != stats_dc_id ||
|
||||
channel_full->sticker_set_id != sticker_set_id ||
|
||||
channel_full->is_all_history_available != is_all_history_available) {
|
||||
channel_full->description = std::move(channel->about_);
|
||||
channel_full->participant_count = participant_count;
|
||||
channel_full->administrator_count = administrator_count;
|
||||
channel_full->restricted_count = restricted_count;
|
||||
@ -10454,6 +10467,12 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
|
||||
channel_full->is_changed = true;
|
||||
}
|
||||
if (channel_full->description != channel->about_) {
|
||||
channel_full->description = std::move(channel->about_);
|
||||
channel_full->is_changed = true;
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(channel_id), channel_full->description, true);
|
||||
}
|
||||
|
||||
if (have_participant_count && c->participant_count != participant_count) {
|
||||
c->participant_count = participant_count;
|
||||
c->is_changed = true;
|
||||
@ -11219,6 +11238,7 @@ void ContactsManager::drop_user_full(UserId user_id) {
|
||||
user_full->is_changed = true;
|
||||
|
||||
update_user_full(user_full, user_id);
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(user_id), user_full->about, true);
|
||||
}
|
||||
|
||||
void ContactsManager::update_user_online_member_count(User *u) {
|
||||
@ -12749,6 +12769,7 @@ void ContactsManager::on_update_chat_description(ChatId chat_id, string &&descri
|
||||
chat_full->description = std::move(description);
|
||||
chat_full->is_changed = true;
|
||||
update_chat_full(chat_full, chat_id);
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(chat_id), chat_full->description, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12949,6 +12970,7 @@ void ContactsManager::on_update_channel_description(ChannelId channel_id, string
|
||||
channel_full->description = std::move(description);
|
||||
channel_full->is_changed = true;
|
||||
update_channel_full(channel_full, channel_id);
|
||||
td_->group_call_manager_->on_update_dialog_about(DialogId(channel_id), channel_full->description, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1484,6 +1484,7 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
|
||||
if (old_participant.order != 0) {
|
||||
send_update_group_call_participant(input_group_call_id, participant);
|
||||
}
|
||||
on_remove_group_call_participant(input_group_call_id, participant.dialog_id);
|
||||
remove_recent_group_call_speaker(input_group_call_id, participant.dialog_id);
|
||||
participants->participants.erase(participants->participants.begin() + i);
|
||||
return -1;
|
||||
@ -1525,10 +1526,46 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
|
||||
if (participants->participants.back().order != 0) {
|
||||
send_update_group_call_participant(input_group_call_id, participants->participants.back());
|
||||
}
|
||||
on_add_group_call_participant(input_group_call_id, participants->participants.back().dialog_id);
|
||||
on_participant_speaking_in_group_call(input_group_call_id, participants->participants.back());
|
||||
return diff;
|
||||
}
|
||||
|
||||
void GroupCallManager::on_add_group_call_participant(InputGroupCallId input_group_call_id,
|
||||
DialogId participant_dialog_id) {
|
||||
participant_id_to_group_call_id_[participant_dialog_id].push_back(input_group_call_id);
|
||||
}
|
||||
|
||||
void GroupCallManager::on_remove_group_call_participant(InputGroupCallId input_group_call_id,
|
||||
DialogId participant_dialog_id) {
|
||||
auto it = participant_id_to_group_call_id_.find(participant_dialog_id);
|
||||
CHECK(it != participant_id_to_group_call_id_.end());
|
||||
bool is_removed = td::remove(it->second, input_group_call_id);
|
||||
CHECK(is_removed);
|
||||
if (it->second.empty()) {
|
||||
participant_id_to_group_call_id_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupCallManager::on_update_dialog_about(DialogId dialog_id, const string &about, bool from_server) {
|
||||
auto it = participant_id_to_group_call_id_.find(dialog_id);
|
||||
if (it == participant_id_to_group_call_id_.end()) {
|
||||
return;
|
||||
}
|
||||
CHECK(!it->second.empty());
|
||||
|
||||
for (auto input_group_call_id : it->second) {
|
||||
auto participant = get_group_call_participant(input_group_call_id, dialog_id);
|
||||
CHECK(participant != nullptr);
|
||||
if ((from_server || participant->is_fake) && participant->about != about) {
|
||||
participant->about = about;
|
||||
if (participant->order != 0) {
|
||||
send_update_group_call_participant(input_group_call_id, *participant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32 GroupCallManager::cancel_join_group_call_request(InputGroupCallId input_group_call_id) {
|
||||
auto it = pending_join_requests_.find(input_group_call_id);
|
||||
if (it == pending_join_requests_.end()) {
|
||||
@ -2461,6 +2498,11 @@ void GroupCallManager::try_clear_group_call_participants(InputGroupCallId input_
|
||||
participant.order = 0;
|
||||
send_update_group_call_participant(input_group_call_id, participant);
|
||||
}
|
||||
on_remove_group_call_participant(input_group_call_id, participant.dialog_id);
|
||||
}
|
||||
|
||||
if (group_call_participants_.empty()) {
|
||||
CHECK(participant_id_to_group_call_id_.empty());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,8 @@ class GroupCallManager : public Actor {
|
||||
|
||||
void discard_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
|
||||
|
||||
void on_update_dialog_about(DialogId dialog_id, const string &about, bool from_server);
|
||||
|
||||
void on_update_group_call(tl_object_ptr<telegram_api::GroupCall> group_call_ptr, DialogId dialog_id);
|
||||
|
||||
void on_user_speaking_in_group_call(GroupCallId group_call_id, DialogId dialog_id, int32 date,
|
||||
@ -172,6 +174,10 @@ class GroupCallManager : public Actor {
|
||||
|
||||
int process_group_call_participant(InputGroupCallId group_call_id, GroupCallParticipant &&participant);
|
||||
|
||||
void on_add_group_call_participant(InputGroupCallId input_group_call_id, DialogId participant_dialog_id);
|
||||
|
||||
void on_remove_group_call_participant(InputGroupCallId input_group_call_id, DialogId participant_dialog_id);
|
||||
|
||||
void try_load_group_call_administrators(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
||||
|
||||
void finish_load_group_call_administrators(InputGroupCallId input_group_call_id, Result<DialogParticipants> &&result);
|
||||
@ -262,6 +268,7 @@ class GroupCallManager : public Actor {
|
||||
|
||||
std::unordered_map<InputGroupCallId, unique_ptr<GroupCallParticipants>, InputGroupCallIdHash>
|
||||
group_call_participants_;
|
||||
std::unordered_map<DialogId, vector<InputGroupCallId>, DialogIdHash> participant_id_to_group_call_id_;
|
||||
|
||||
std::unordered_map<GroupCallId, unique_ptr<GroupCallRecentSpeakers>, GroupCallIdHash> group_call_recent_speakers_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user