From 7498aad742cdeeb279e5bb342ccf02bcb1e79cb9 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 22 Jul 2023 20:03:35 +0300 Subject: [PATCH] Improve handling of message reading up to unknown message. --- td/telegram/MessagesManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 74d7bbadf..c2fcc3d5a 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -12552,9 +12552,12 @@ void MessagesManager::read_history_inbox(Dialog *d, MessageId max_message_id, in LOG(ERROR) << "Have unknown " << unread_count << " unread messages up to " << max_message_id << " in " << dialog_id << " with last_new_message_id = " << d->last_new_message_id << ", last_message_id = " << d->last_message_id - << ", last_database_message_id = " << d->last_database_message_id << " from " << source; + << ", last_database_message_id = " << d->last_database_message_id << ", and " << d->server_unread_count + << " unread messages up to " << d->last_read_inbox_message_id << " from " << source; + unread_count = d->server_unread_count; + } else { + unread_count = 0; } - unread_count = 0; } LOG_IF(INFO,