Improve source for telegram_api::updates.

This commit is contained in:
levlam 2022-10-06 18:21:25 +03:00
parent 0a42eda1ff
commit 09cffa693a
2 changed files with 12 additions and 4 deletions

View File

@ -10638,7 +10638,8 @@ void MessagesManager::delete_messages_from_updates(const vector<MessageId> &mess
Dialog *d = get_dialog_by_message_id(message_id);
if (d != nullptr) {
auto message = delete_message(d, message_id, true, &need_update_dialog_pos[d->dialog_id], "updates");
auto message =
delete_message(d, message_id, true, &need_update_dialog_pos[d->dialog_id], "delete_messages_from_updates");
CHECK(message != nullptr);
LOG_CHECK(message->message_id == message_id) << message_id << " " << message->message_id << " " << d->dialog_id;
deleted_message_ids[d->dialog_id].push_back(message->message_id.get());
@ -10646,7 +10647,8 @@ void MessagesManager::delete_messages_from_updates(const vector<MessageId> &mess
if (last_clear_history_message_id_to_dialog_id_.count(message_id)) {
d = get_dialog(last_clear_history_message_id_to_dialog_id_[message_id]);
CHECK(d != nullptr);
auto message = delete_message(d, message_id, true, &need_update_dialog_pos[d->dialog_id], "updates");
auto message =
delete_message(d, message_id, true, &need_update_dialog_pos[d->dialog_id], "delete_messages_from_updates");
CHECK(message == nullptr);
}
}

View File

@ -992,8 +992,14 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
}
case telegram_api::updates::ID: {
auto updates = move_tl_object_as<telegram_api::updates>(updates_ptr);
td_->contacts_manager_->on_get_users(std::move(updates->users_), "updates");
td_->contacts_manager_->on_get_chats(std::move(updates->chats_), "updates");
string source_str;
const char *source = "updates";
if (updates->updates_.size() == 1 && updates->updates_[0] != nullptr) {
source_str = PSTRING() << "update " << updates->updates_[0]->get_id();
source = source_str.c_str();
}
td_->contacts_manager_->on_get_users(std::move(updates->users_), source);
td_->contacts_manager_->on_get_chats(std::move(updates->chats_), source);
on_pending_updates(std::move(updates->updates_), updates->seq_, updates->seq_, updates->date_, Time::now(),
std::move(promise), "telegram_api::updates");
break;