From 95ff033aaeeef4ebd7315115fdce8dc81f20d4ad Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 7 Nov 2018 21:26:21 +0300 Subject: [PATCH] Silence 401th error for ordinary users. GitOrigin-RevId: 3a371adef8cfc50609a9320c43a0c8cf5d9dd403 --- td/telegram/ContactsManager.cpp | 3 ++- td/telegram/MessagesManager.cpp | 3 ++- td/telegram/UpdatesManager.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 27ada357..0f90c6b1 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -7083,7 +7083,8 @@ tl_object_ptr ContactsManager::get_chat_member_object( bool ContactsManager::on_get_channel_error(ChannelId channel_id, const Status &status, const string &source) { LOG(INFO) << "Receive " << status << " in " << channel_id << " from " << source; - if (status.message() == CSlice("SESSION_REVOKED") || status.message() == CSlice("USER_DEACTIVATED")) { + if (status.code() == 401 || status.message() == CSlice("SESSION_REVOKED") || + status.message() == CSlice("USER_DEACTIVATED")) { // authorization is lost return true; } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5ae7c043..912937ff 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17272,7 +17272,8 @@ bool MessagesManager::on_update_message_id(int64 random_id, MessageId new_messag } bool MessagesManager::on_get_dialog_error(DialogId dialog_id, const Status &status, const string &source) { - if (status.message() == CSlice("SESSION_REVOKED") || status.message() == CSlice("USER_DEACTIVATED")) { + if (status.code() == 401 || status.message() == CSlice("SESSION_REVOKED") || + status.message() == CSlice("USER_DEACTIVATED")) { // authorization is lost return true; } diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 476230a3..2199d70e 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -142,7 +142,8 @@ class GetDifferenceQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (status.message() != CSlice("SESSION_REVOKED") && status.message() != CSlice("USER_DEACTIVATED")) { + if (status.code() != 401 && status.message() != CSlice("SESSION_REVOKED") && + status.message() != CSlice("USER_DEACTIVATED")) { LOG(ERROR) << "updates.getDifference error: " << status; } td->updates_manager_->on_get_difference(nullptr);