Simplify updateChatLastMessage creation.

This commit is contained in:
levlam 2021-10-22 16:41:31 +03:00
parent 1394a2bedf
commit 495082b628
2 changed files with 6 additions and 5 deletions

View File

@ -120,7 +120,7 @@ int64 AuthData::next_message_id(double now) {
bool AuthData::is_valid_outbound_msg_id(int64 id, double now) const {
double server_time = get_server_time(now);
auto id_time = static_cast<double>(id) / static_cast<double>(1ll << 32);
return server_time - 300 / 2 < id_time && id_time < server_time + 30;
return server_time - 150 < id_time && id_time < server_time + 30;
}
bool AuthData::is_valid_inbound_msg_id(int64 id, double now) const {

View File

@ -28549,10 +28549,11 @@ void MessagesManager::send_update_chat_last_message_impl(const Dialog *d, const
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_last_message from "
<< source;
LOG(INFO) << "Send updateChatLastMessage in " << d->dialog_id << " to " << d->last_message_id << " from " << source;
auto update = make_tl_object<td_api::updateChatLastMessage>(
d->dialog_id.get(),
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "send_update_chat_last_message_impl"),
get_chat_positions_object(d));
const auto *m = get_message(d, d->last_message_id);
auto message_object = get_message_object(d->dialog_id, m, "send_update_chat_last_message_impl");
auto positions_object = get_chat_positions_object(d);
auto update = td_api::make_object<td_api::updateChatLastMessage>(d->dialog_id.get(), std::move(message_object),
std::move(positions_object));
send_closure(G()->td(), &Td::send_update, std::move(update));
}