From c7b00632604994d0c63d2ba6a534ef3760d8f19f Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 12 Apr 2021 06:04:43 +0300 Subject: [PATCH] Add source to parse_dialog. --- td/telegram/MessagesManager.cpp | 19 ++++++++++--------- td/telegram/MessagesManager.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 535f123fa..e167caf60 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -33881,7 +33881,7 @@ MessagesManager::Dialog *MessagesManager::add_dialog(DialogId dialog_id, const c auto r_value = G()->td_db()->get_dialog_db_sync()->get_dialog(dialog_id); if (r_value.is_ok()) { LOG(INFO) << "Synchronously loaded " << dialog_id << " from database"; - return add_new_dialog(parse_dialog(dialog_id, r_value.ok()), true, source); + return add_new_dialog(parse_dialog(dialog_id, r_value.ok(), source), true, source); } } @@ -35005,8 +35005,9 @@ MessagesManager::Dialog *MessagesManager::get_dialog_force(DialogId dialog_id, c } } -unique_ptr MessagesManager::parse_dialog(DialogId dialog_id, const BufferSlice &value) { - LOG(INFO) << "Loaded " << dialog_id << " of size " << value.size() << " from database"; +unique_ptr MessagesManager::parse_dialog(DialogId dialog_id, const BufferSlice &value, + const char *source) { + LOG(INFO) << "Loaded " << dialog_id << " of size " << value.size() << " from database from " << source; auto d = make_unique(); d->dialog_id = dialog_id; invalidate_message_indexes(d.get()); // must initialize indexes, because some of them could be not parsed @@ -35018,7 +35019,7 @@ unique_ptr MessagesManager::parse_dialog(DialogId dialo // can't happen unless database is broken, but has been seen in the wild // if dialog_id is invalid, we can't repair the dialog LOG_CHECK(dialog_id.is_valid()) << "Can't repair " << dialog_id << ' ' << d->dialog_id << ' ' << status << ' ' - << format::as_hex_dump<4>(value.as_slice()); + << source << ' ' << format::as_hex_dump<4>(value.as_slice()); LOG(ERROR) << "Repair broken " << dialog_id << ' ' << format::as_hex_dump<4>(value.as_slice()); @@ -35031,10 +35032,10 @@ unique_ptr MessagesManager::parse_dialog(DialogId dialo have_dialog_info_force(dialog_id); if (have_input_peer(dialog_id, AccessRights::Read)) { if (dialog_id.get_type() != DialogType::SecretChat) { - send_get_dialog_query(dialog_id, Auto(), 0, "parse_dialog"); + send_get_dialog_query(dialog_id, Auto(), 0, source); } } else { - LOG(ERROR) << "Have no info about " << dialog_id << " to repair it"; + LOG(ERROR) << "Have no info about " << dialog_id << " from " << source << " to repair it"; } } CHECK(dialog_id == d->dialog_id); @@ -35050,8 +35051,8 @@ unique_ptr MessagesManager::parse_dialog(DialogId dialo if (d->draft_message != nullptr) { add_formatted_text_dependencies(dependencies, &d->draft_message->input_message_text.text); } - if (!resolve_dependencies_force(td_, dependencies, "parse_dialog")) { - send_get_dialog_query(dialog_id, Auto(), 0, "parse_dialog"); + if (!resolve_dependencies_force(td_, dependencies, source)) { + send_get_dialog_query(dialog_id, Auto(), 0, source); } return d; @@ -35080,7 +35081,7 @@ MessagesManager::Dialog *MessagesManager::on_load_dialog_from_database(DialogId } LOG(INFO) << "Add new " << dialog_id << " from database from " << source; - return add_new_dialog(parse_dialog(dialog_id, value), true, source); + return add_new_dialog(parse_dialog(dialog_id, value, source), true, source); } const DialogFilter *MessagesManager::get_server_dialog_filter(DialogFilterId dialog_filter_id) const { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index a436564a6..9830896d5 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -2906,7 +2906,7 @@ class MessagesManager : public Actor { unique_ptr parse_message(DialogId dialog_id, const BufferSlice &value, bool is_scheduled); - unique_ptr parse_dialog(DialogId dialog_id, const BufferSlice &value); + unique_ptr parse_dialog(DialogId dialog_id, const BufferSlice &value, const char *source); void load_calls_db_state(); void save_calls_db_state();