Add source to have_dialog_info_force.
This commit is contained in:
parent
9b5b4b4698
commit
1dcd78f1ed
@ -16664,7 +16664,7 @@ void ContactsManager::on_update_channel_participant(ChannelId channel_id, UserId
|
|||||||
void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about, int32 date,
|
void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about, int32 date,
|
||||||
DialogInviteLink invite_link) {
|
DialogInviteLink invite_link) {
|
||||||
if (!td_->auth_manager_->is_bot() || date <= 0 || !have_user_force(user_id, "on_update_chat_invite_requester") ||
|
if (!td_->auth_manager_->is_bot() || date <= 0 || !have_user_force(user_id, "on_update_chat_invite_requester") ||
|
||||||
!td_->messages_manager_->have_dialog_info_force(dialog_id)) {
|
!td_->messages_manager_->have_dialog_info_force(dialog_id, "on_update_chat_invite_requester")) {
|
||||||
LOG(ERROR) << "Receive invalid updateBotChatInviteRequester by " << user_id << " in " << dialog_id << " at "
|
LOG(ERROR) << "Receive invalid updateBotChatInviteRequester by " << user_id << " in " << dialog_id << " at "
|
||||||
<< date;
|
<< date;
|
||||||
return;
|
return;
|
||||||
|
@ -944,7 +944,7 @@ void DialogFilterManager::load_dialog_filter(const DialogFilter *dialog_filter,
|
|||||||
// TODO load dialogs asynchronously
|
// TODO load dialogs asynchronously
|
||||||
if (!td_->messages_manager_->have_dialog_force(dialog_id, "load_dialog_filter")) {
|
if (!td_->messages_manager_->have_dialog_force(dialog_id, "load_dialog_filter")) {
|
||||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
if (dialog_id.get_type() == DialogType::SecretChat) {
|
||||||
if (td_->messages_manager_->have_dialog_info_force(dialog_id)) {
|
if (td_->messages_manager_->have_dialog_info_force(dialog_id, "load_dialog_filter")) {
|
||||||
td_->messages_manager_->force_create_dialog(dialog_id, "load_dialog_filter");
|
td_->messages_manager_->force_create_dialog(dialog_id, "load_dialog_filter");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,7 +29,7 @@ ForumTopicInfo::ForumTopicInfo(Td *td, const tl_object_ptr<telegram_api::ForumTo
|
|||||||
creation_date_ = forum_topic->date_;
|
creation_date_ = forum_topic->date_;
|
||||||
creator_dialog_id_ = DialogId(forum_topic->from_id_);
|
creator_dialog_id_ = DialogId(forum_topic->from_id_);
|
||||||
if (creator_dialog_id_.is_valid() && creator_dialog_id_.get_type() != DialogType::User &&
|
if (creator_dialog_id_.is_valid() && creator_dialog_id_.get_type() != DialogType::User &&
|
||||||
td->messages_manager_->have_dialog_info_force(creator_dialog_id_)) {
|
td->messages_manager_->have_dialog_info_force(creator_dialog_id_, "ForumTopicInfo")) {
|
||||||
td->messages_manager_->force_create_dialog(creator_dialog_id_, "ForumTopicInfo", true);
|
td->messages_manager_->force_create_dialog(creator_dialog_id_, "ForumTopicInfo", true);
|
||||||
}
|
}
|
||||||
is_outgoing_ = forum_topic->my_;
|
is_outgoing_ = forum_topic->my_;
|
||||||
|
@ -4546,7 +4546,7 @@ void GroupCallManager::on_user_speaking_in_group_call(GroupCallId group_call_id,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!td_->messages_manager_->have_dialog_info_force(dialog_id) ||
|
if (!td_->messages_manager_->have_dialog_info_force(dialog_id, "on_user_speaking_in_group_call") ||
|
||||||
(!is_recursive && need_group_call_participants(input_group_call_id, group_call) &&
|
(!is_recursive && need_group_call_participants(input_group_call_id, group_call) &&
|
||||||
get_group_call_participant(input_group_call_id, dialog_id) == nullptr)) {
|
get_group_call_participant(input_group_call_id, dialog_id) == nullptr)) {
|
||||||
if (is_recursive) {
|
if (is_recursive) {
|
||||||
|
@ -6399,11 +6399,11 @@ bool MessagesManager::have_dialog_info(DialogId dialog_id) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagesManager::have_dialog_info_force(DialogId dialog_id) const {
|
bool MessagesManager::have_dialog_info_force(DialogId dialog_id, const char *source) const {
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
case DialogType::User: {
|
case DialogType::User: {
|
||||||
UserId user_id = dialog_id.get_user_id();
|
UserId user_id = dialog_id.get_user_id();
|
||||||
return td_->contacts_manager_->have_user_force(user_id, "have_dialog_info_force");
|
return td_->contacts_manager_->have_user_force(user_id, source);
|
||||||
}
|
}
|
||||||
case DialogType::Chat: {
|
case DialogType::Chat: {
|
||||||
ChatId chat_id = dialog_id.get_chat_id();
|
ChatId chat_id = dialog_id.get_chat_id();
|
||||||
@ -7630,7 +7630,7 @@ void MessagesManager::on_dialog_action(DialogId dialog_id, MessageId top_thread_
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!have_dialog_info_force(typing_dialog_id)) {
|
if (!have_dialog_info_force(typing_dialog_id, "on_dialog_action")) {
|
||||||
LOG(DEBUG) << "Ignore " << action << " of unknown " << typing_dialog_id;
|
LOG(DEBUG) << "Ignore " << action << " of unknown " << typing_dialog_id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -14065,7 +14065,7 @@ void MessagesManager::on_get_secret_message(SecretChatId secret_chat_id, UserId
|
|||||||
message_info.ttl = message->ttl_;
|
message_info.ttl = message->ttl_;
|
||||||
|
|
||||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_get_secret_message");
|
Dialog *d = get_dialog_force(message_info.dialog_id, "on_get_secret_message");
|
||||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
if (d == nullptr && have_dialog_info_force(message_info.dialog_id, "on_get_secret_message")) {
|
||||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||||
d = get_dialog(message_info.dialog_id);
|
d = get_dialog(message_info.dialog_id);
|
||||||
}
|
}
|
||||||
@ -14161,7 +14161,7 @@ void MessagesManager::on_secret_chat_screenshot_taken(SecretChatId secret_chat_i
|
|||||||
message_info.content = create_screenshot_taken_message_content();
|
message_info.content = create_screenshot_taken_message_content();
|
||||||
|
|
||||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_screenshot_taken");
|
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_screenshot_taken");
|
||||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
if (d == nullptr && have_dialog_info_force(message_info.dialog_id, "on_secret_chat_screenshot_taken")) {
|
||||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||||
d = get_dialog(message_info.dialog_id);
|
d = get_dialog(message_info.dialog_id);
|
||||||
}
|
}
|
||||||
@ -14199,7 +14199,7 @@ void MessagesManager::on_secret_chat_ttl_changed(SecretChatId secret_chat_id, Us
|
|||||||
message_info.content = create_chat_set_ttl_message_content(ttl, UserId());
|
message_info.content = create_chat_set_ttl_message_content(ttl, UserId());
|
||||||
|
|
||||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_ttl_changed");
|
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_ttl_changed");
|
||||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
if (d == nullptr && have_dialog_info_force(message_info.dialog_id, "on_secret_chat_ttl_changed")) {
|
||||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||||
d = get_dialog(message_info.dialog_id);
|
d = get_dialog(message_info.dialog_id);
|
||||||
}
|
}
|
||||||
@ -14599,7 +14599,8 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
|
|
||||||
bool has_forward_info = message_info.forward_header != nullptr;
|
bool has_forward_info = message_info.forward_header != nullptr;
|
||||||
|
|
||||||
if (sender_dialog_id.is_valid() && sender_dialog_id != dialog_id && have_dialog_info_force(sender_dialog_id)) {
|
if (sender_dialog_id.is_valid() && sender_dialog_id != dialog_id &&
|
||||||
|
have_dialog_info_force(sender_dialog_id, "create_message")) {
|
||||||
CHECK(sender_dialog_id.get_type() != DialogType::User);
|
CHECK(sender_dialog_id.get_type() != DialogType::User);
|
||||||
force_create_dialog(sender_dialog_id, "create_message", true);
|
force_create_dialog(sender_dialog_id, "create_message", true);
|
||||||
}
|
}
|
||||||
@ -16766,7 +16767,7 @@ vector<DialogId> MessagesManager::get_dialogs(DialogListId dialog_list_id, Dialo
|
|||||||
auto dialog_id = input_dialog_id.get_dialog_id();
|
auto dialog_id = input_dialog_id.get_dialog_id();
|
||||||
if (!have_dialog_force(dialog_id, "get_dialogs")) {
|
if (!have_dialog_force(dialog_id, "get_dialogs")) {
|
||||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
if (dialog_id.get_type() == DialogType::SecretChat) {
|
||||||
if (have_dialog_info_force(dialog_id)) {
|
if (have_dialog_info_force(dialog_id, "get_dialogs")) {
|
||||||
force_create_dialog(dialog_id, "get_dialogs");
|
force_create_dialog(dialog_id, "get_dialogs");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -17822,7 +17823,7 @@ FullMessageId MessagesManager::get_replied_message(DialogId dialog_id, MessageId
|
|||||||
auto replied_message_id = get_replied_message_id(dialog_id, m);
|
auto replied_message_id = get_replied_message_id(dialog_id, m);
|
||||||
if (replied_message_id.get_dialog_id() != dialog_id) {
|
if (replied_message_id.get_dialog_id() != dialog_id) {
|
||||||
dialog_id = replied_message_id.get_dialog_id();
|
dialog_id = replied_message_id.get_dialog_id();
|
||||||
if (!have_dialog_info_force(dialog_id)) {
|
if (!have_dialog_info_force(dialog_id, "get_replied_message")) {
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -19747,7 +19748,7 @@ bool MessagesManager::is_dialog_mention_notifications_disabled(const Dialog *d)
|
|||||||
|
|
||||||
void MessagesManager::create_dialog(DialogId dialog_id, bool force, Promise<Unit> &&promise) {
|
void MessagesManager::create_dialog(DialogId dialog_id, bool force, Promise<Unit> &&promise) {
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
if (!have_dialog_info_force(dialog_id)) {
|
if (!have_dialog_info_force(dialog_id, "create dialog")) {
|
||||||
return promise.set_error(Status::Error(400, "Chat info not found"));
|
return promise.set_error(Status::Error(400, "Chat info not found"));
|
||||||
}
|
}
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
@ -37685,7 +37686,7 @@ unique_ptr<MessagesManager::Dialog> MessagesManager::parse_dialog(DialogId dialo
|
|||||||
invalidate_message_indexes(d);
|
invalidate_message_indexes(d);
|
||||||
|
|
||||||
// and try to reget it from the server if possible
|
// and try to reget it from the server if possible
|
||||||
have_dialog_info_force(dialog_id);
|
have_dialog_info_force(dialog_id, "parse_dialog");
|
||||||
if (have_input_peer(dialog_id, AccessRights::Read)) {
|
if (have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
if (dialog_id.get_type() != DialogType::SecretChat) {
|
if (dialog_id.get_type() != DialogType::SecretChat) {
|
||||||
send_get_dialog_query(dialog_id, Auto(), 0, source);
|
send_get_dialog_query(dialog_id, Auto(), 0, source);
|
||||||
@ -39584,7 +39585,8 @@ void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto sender_dialog_id = log_event.sender_dialog_id_;
|
auto sender_dialog_id = log_event.sender_dialog_id_;
|
||||||
if (!have_dialog_info_force(sender_dialog_id) || !have_input_peer(sender_dialog_id, AccessRights::Know)) {
|
if (!have_dialog_info_force(sender_dialog_id, "DeleteAllChannelMessagesFromSenderOnServer") ||
|
||||||
|
!have_input_peer(sender_dialog_id, AccessRights::Know)) {
|
||||||
LOG(ERROR) << "Can't find " << sender_dialog_id;
|
LOG(ERROR) << "Can't find " << sender_dialog_id;
|
||||||
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
||||||
break;
|
break;
|
||||||
@ -39824,7 +39826,8 @@ void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
|||||||
log_event_parse(log_event, event.get_data()).ensure();
|
log_event_parse(log_event, event.get_data()).ensure();
|
||||||
|
|
||||||
auto dialog_id = log_event.dialog_id_;
|
auto dialog_id = log_event.dialog_id_;
|
||||||
if (dialog_id.get_type() == DialogType::SecretChat || !have_dialog_info_force(dialog_id) ||
|
if (dialog_id.get_type() == DialogType::SecretChat ||
|
||||||
|
!have_dialog_info_force(dialog_id, "ToggleDialogIsBlockedOnServerLogEvent") ||
|
||||||
!have_input_peer(dialog_id, AccessRights::Know)) {
|
!have_input_peer(dialog_id, AccessRights::Know)) {
|
||||||
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
binlog_erase(G()->td_db()->get_binlog(), event.id_);
|
||||||
break;
|
break;
|
||||||
|
@ -597,7 +597,7 @@ class MessagesManager final : public Actor {
|
|||||||
bool have_dialog_force(DialogId dialog_id, const char *source);
|
bool have_dialog_force(DialogId dialog_id, const char *source);
|
||||||
|
|
||||||
bool have_dialog_info(DialogId dialog_id) const;
|
bool have_dialog_info(DialogId dialog_id) const;
|
||||||
bool have_dialog_info_force(DialogId dialog_id) const;
|
bool have_dialog_info_force(DialogId dialog_id, const char *source) const;
|
||||||
|
|
||||||
void reload_dialog_info_full(DialogId dialog_id, const char *source);
|
void reload_dialog_info_full(DialogId dialog_id, const char *source);
|
||||||
|
|
||||||
|
@ -376,7 +376,8 @@ void SponsoredMessageManager::on_get_dialog_sponsored_messages(
|
|||||||
DialogPhoto site_photo;
|
DialogPhoto site_photo;
|
||||||
if (sponsored_message->from_id_ != nullptr) {
|
if (sponsored_message->from_id_ != nullptr) {
|
||||||
sponsor_dialog_id = DialogId(sponsored_message->from_id_);
|
sponsor_dialog_id = DialogId(sponsored_message->from_id_);
|
||||||
if (!sponsor_dialog_id.is_valid() || !td_->messages_manager_->have_dialog_info_force(sponsor_dialog_id)) {
|
if (!sponsor_dialog_id.is_valid() ||
|
||||||
|
!td_->messages_manager_->have_dialog_info_force(sponsor_dialog_id, "on_get_dialog_sponsored_messages")) {
|
||||||
LOG(ERROR) << "Receive unknown sponsor " << sponsor_dialog_id;
|
LOG(ERROR) << "Receive unknown sponsor " << sponsor_dialog_id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3579,7 +3579,7 @@ void StoryManager::on_update_story_id(int64 random_id, StoryId new_story_id, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StoryManager::on_update_read_stories(DialogId owner_dialog_id, StoryId max_read_story_id) {
|
bool StoryManager::on_update_read_stories(DialogId owner_dialog_id, StoryId max_read_story_id) {
|
||||||
if (!td_->messages_manager_->have_dialog_info_force(owner_dialog_id)) {
|
if (!td_->messages_manager_->have_dialog_info_force(owner_dialog_id, "on_update_read_stories")) {
|
||||||
LOG(INFO) << "Can't read stories in unknown " << owner_dialog_id;
|
LOG(INFO) << "Can't read stories in unknown " << owner_dialog_id;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3636,7 +3636,7 @@ void StoryManager::on_update_story_chosen_reaction_type(DialogId owner_dialog_id
|
|||||||
LOG(ERROR) << "Receive chosen reaction in " << story_id << " in " << owner_dialog_id;
|
LOG(ERROR) << "Receive chosen reaction in " << story_id << " in " << owner_dialog_id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!td_->messages_manager_->have_dialog_info_force(owner_dialog_id)) {
|
if (!td_->messages_manager_->have_dialog_info_force(owner_dialog_id, "on_update_story_chosen_reaction_type")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StoryFullId story_full_id{owner_dialog_id, story_id};
|
StoryFullId story_full_id{owner_dialog_id, story_id};
|
||||||
|
Loading…
Reference in New Issue
Block a user