diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index f3e6f2cd4..beb08dc75 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -8397,7 +8397,7 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val Dependencies dependencies; dependencies.user_ids.insert(user_id); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "user_full"); if (user_full->need_phone_number_privacy_exception && is_user_contact(user_id)) { user_full->need_phone_number_privacy_exception = false; @@ -8581,7 +8581,7 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val dependencies.user_ids.insert(participant.user_id); dependencies.user_ids.insert(participant.inviter_user_id); } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "chat_full"); for (auto &participant : chat_full->participants) { get_bot_info_force(participant.user_id); @@ -8668,7 +8668,7 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s add_dialog_and_dependencies(dependencies, DialogId(channel_full->linked_channel_id)); dependencies.chat_ids.insert(channel_full->migrated_from_chat_id); dependencies.user_ids.insert(channel_full->bot_user_ids.begin(), channel_full->bot_user_ids.end()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "channel_full"); for (auto &user_id : channel_full->bot_user_ids) { get_bot_info_force(user_id); diff --git a/td/telegram/Dependencies.cpp b/td/telegram/Dependencies.cpp index 0aa891308..b9ae7fd9f 100644 --- a/td/telegram/Dependencies.cpp +++ b/td/telegram/Dependencies.cpp @@ -43,30 +43,30 @@ void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id) { } } -void resolve_dependencies_force(Td *td, const Dependencies &dependencies) { +void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source) { for (auto user_id : dependencies.user_ids) { if (user_id.is_valid() && !td->contacts_manager_->have_user_force(user_id)) { - LOG(ERROR) << "Can't find " << user_id; + LOG(ERROR) << "Can't find " << user_id << " from " << source; } } for (auto chat_id : dependencies.chat_ids) { if (chat_id.is_valid() && !td->contacts_manager_->have_chat_force(chat_id)) { - LOG(ERROR) << "Can't find " << chat_id; + LOG(ERROR) << "Can't find " << chat_id << " from " << source; } } for (auto channel_id : dependencies.channel_ids) { if (channel_id.is_valid() && !td->contacts_manager_->have_channel_force(channel_id)) { - LOG(ERROR) << "Can't find " << channel_id; + LOG(ERROR) << "Can't find " << channel_id << " from " << source; } } for (auto secret_chat_id : dependencies.secret_chat_ids) { if (secret_chat_id.is_valid() && !td->contacts_manager_->have_secret_chat_force(secret_chat_id)) { - LOG(ERROR) << "Can't find " << secret_chat_id; + LOG(ERROR) << "Can't find " << secret_chat_id << " from " << source; } } for (auto dialog_id : dependencies.dialog_ids) { if (dialog_id.is_valid() && !td->messages_manager_->have_dialog_force(dialog_id)) { - LOG(ERROR) << "Can't find " << dialog_id; + LOG(ERROR) << "Can't find " << dialog_id << " from " << source; td->messages_manager_->force_create_dialog(dialog_id, "resolve_dependencies_force"); } } diff --git a/td/telegram/Dependencies.h b/td/telegram/Dependencies.h index 5394572a3..d9a51c611 100644 --- a/td/telegram/Dependencies.h +++ b/td/telegram/Dependencies.h @@ -32,6 +32,6 @@ void add_dialog_and_dependencies(Dependencies &dependencies, DialogId dialog_id) void add_dialog_dependencies(Dependencies &dependencies, DialogId dialog_id); -void resolve_dependencies_force(Td *td, const Dependencies &dependencies); +void resolve_dependencies_force(Td *td, const Dependencies &dependencies, const char *source); } // namespace td diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index dbd2f12b1..d35980361 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14477,7 +14477,7 @@ void MessagesManager::load_dialogs(vector dialog_ids, Promise && add_dialog_dependencies(dependencies, dialog_id); } } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "load_dialogs"); for (auto dialog_id : dialog_ids) { if (dialog_id.is_valid()) { @@ -21179,7 +21179,7 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId is_first = false; pos++; } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "get_history"); if (from_the_end && !last_added_message_id.is_valid() && last_received_message_id < d->first_database_message_id && !d->have_full_history) { @@ -21494,7 +21494,7 @@ void MessagesManager::on_get_scheduled_messages_from_database(DialogId dialog_id added_message_ids.push_back(m->message_id); } } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "get_scheduled_messages"); // for (auto message_id : added_message_ids) { // send_update_new_message(d, get_message(d, message_id)); @@ -30300,7 +30300,7 @@ MessagesManager::Message *MessagesManager::on_get_message_from_database(DialogId Dependencies dependencies; add_message_dependencies(dependencies, d->dialog_id, m.get()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "get_message"); m->have_previous = false; m->have_next = false; @@ -33338,7 +33338,7 @@ unique_ptr MessagesManager::parse_dialog(DialogId dialo if (d->draft_message != nullptr) { add_formatted_text_dependencies(dependencies, &d->draft_message->input_message_text.text); } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "parse_dialog"); return d; } @@ -34530,7 +34530,7 @@ void MessagesManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); add_message_dependencies(dependencies, dialog_id, m.get()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "SendMessageLogEvent"); m->content = dup_message_content(td_, dialog_id, m->content.get(), MessageContentDupType::Send, MessageCopyOptions()); @@ -34560,7 +34560,7 @@ void MessagesManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); add_message_dependencies(dependencies, dialog_id, m.get()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "SendBotStartMessageLogEvent"); auto bot_user_id = log_event.bot_user_id; if (!td_->contacts_manager_->have_user_force(bot_user_id)) { @@ -34597,7 +34597,7 @@ void MessagesManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); add_message_dependencies(dependencies, dialog_id, m.get()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "SendInlineQueryResultMessageLogEvent"); m->content = dup_message_content(td_, dialog_id, m->content.get(), MessageContentDupType::SendViaBot, MessageCopyOptions()); @@ -34626,7 +34626,7 @@ void MessagesManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); add_message_dependencies(dependencies, dialog_id, m.get()); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "SendScreenshotTakenNotificationMessageLogEvent"); auto result_message = continue_send_message(dialog_id, std::move(m), event.id_); if (result_message != nullptr) { @@ -34653,7 +34653,7 @@ void MessagesManager::on_binlog_events(vector &&events) { for (auto &m : messages) { add_message_dependencies(dependencies, to_dialog_id, m.get()); } - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "ForwardMessagesLogEvent"); Dialog *to_dialog = get_dialog_force(to_dialog_id); if (to_dialog == nullptr) { @@ -35135,7 +35135,7 @@ void MessagesManager::on_binlog_events(vector &&events) { auto dialog_id = log_event.dialog_id_; Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "GetDialogFromServerLogEvent"); get_dialog_force(dialog_id); // load it if exists diff --git a/td/telegram/PollManager.cpp b/td/telegram/PollManager.cpp index 82f6e650d..5c4c9cfb0 100644 --- a/td/telegram/PollManager.cpp +++ b/td/telegram/PollManager.cpp @@ -1653,7 +1653,7 @@ void PollManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); // do not load the dialog itself - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "SetPollAnswerLogEvent"); do_set_poll_answer(log_event.poll_id_, log_event.full_message_id_, std::move(log_event.options_), event.id_, Auto()); @@ -1672,7 +1672,7 @@ void PollManager::on_binlog_events(vector &&events) { Dependencies dependencies; add_dialog_dependencies(dependencies, dialog_id); // do not load the dialog itself - resolve_dependencies_force(td_, dependencies); + resolve_dependencies_force(td_, dependencies, "StopPollLogEvent"); do_stop_poll(log_event.poll_id_, log_event.full_message_id_, nullptr, event.id_, Auto()); break;