From 72515a445927c91816a8a0bcaffe09fb9b68480b Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 4 Apr 2018 23:03:35 +0300 Subject: [PATCH] Fix replacing of unacceptable update with updateChannelTooLong. GitOrigin-RevId: a82f6e6e9e828183aa10690ebe32b983f7433ed4 --- td/telegram/UpdatesManager.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 43153d96a..eb4f24fcb 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1126,13 +1126,18 @@ void UpdatesManager::on_pending_updates(vectormessage_; pts = update_edit_channel_message->pts_; } - if (message_ptr != nullptr) { + + // for channels we can try to replace unacceptable update with updateChannelTooLong + // don't do that for service messages, because they can be about bot's kicking + if (message_ptr != nullptr && (*message_ptr)->get_id() != telegram_api::messageService::ID) { auto dialog_id = td_->messages_manager_->get_message_dialog_id(*message_ptr); if (dialog_id.get_type() == DialogType::Channel) { - // for channels we can replace unacceptable update with updateChannelTooLong - update = telegram_api::make_object( - telegram_api::updateChannelTooLong::PTS_MASK, dialog_id.get_channel_id().get(), pts); - continue; + auto channel_id = dialog_id.get_channel_id(); + if (td_->contacts_manager_->have_channel_force(channel_id)) { + update = telegram_api::make_object( + telegram_api::updateChannelTooLong::PTS_MASK, channel_id.get(), pts); + continue; + } } else { LOG(ERROR) << "Update is not from a channel: " << to_string(update); }