Set local online on some message history reads.

GitOrigin-RevId: 140ed8921bb53c6aabbe5acfe25147854b2f9b53
This commit is contained in:
levlam 2019-03-15 22:09:42 +03:00
parent 6209520db6
commit a165305968
2 changed files with 20 additions and 0 deletions

View File

@ -9333,6 +9333,14 @@ void MessagesManager::read_secret_chat_outbox(SecretChatId secret_chat_id, int32
if (d == nullptr) { if (d == nullptr) {
return; return;
} }
if (read_date > 0) {
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(secret_chat_id);
if (user_id.is_valid()) {
td_->contacts_manager_->on_update_user_local_was_online(user_id, read_date);
}
}
// TODO: protect with logevent // TODO: protect with logevent
suffix_load_till_date( suffix_load_till_date(
d, up_to_date, d, up_to_date,

View File

@ -1189,6 +1189,18 @@ void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Updat
set_state(State::Type::ApplyingUpdates); set_state(State::Type::ApplyingUpdates);
if (date > 0 && updates.size() == 1 && updates[0] != nullptr &&
updates[0]->get_id() == telegram_api::updateReadHistoryOutbox::ID) {
auto update = static_cast<const telegram_api::updateReadHistoryOutbox *>(updates[0].get());
DialogId dialog_id(update->peer_);
if (dialog_id.get_type() == DialogType::User) {
auto user_id = dialog_id.get_user_id();
if (user_id.is_valid()) {
td_->contacts_manager_->on_update_user_local_was_online(user_id, date);
}
}
}
for (auto &update : updates) { for (auto &update : updates) {
if (update != nullptr) { if (update != nullptr) {
LOG(INFO) << "Receive from " << source << " pending " << to_string(update); LOG(INFO) << "Receive from " << source << " pending " << to_string(update);