From 58a3efacc6213f2eb90220f0a90b1cb807fca620 Mon Sep 17 00:00:00 2001 From: Alexander Pankratov Date: Sat, 3 Oct 2020 01:44:29 +0300 Subject: [PATCH 1/2] Set ipc slow mode from settings array --- src/danog/MadelineProto/Settings.php | 1 + src/danog/MadelineProto/Settings/Ipc.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/danog/MadelineProto/Settings.php b/src/danog/MadelineProto/Settings.php index 3a78bf09..ad255471 100644 --- a/src/danog/MadelineProto/Settings.php +++ b/src/danog/MadelineProto/Settings.php @@ -139,6 +139,7 @@ class Settings extends SettingsAbstract $this->secretChats->mergeArray($settings); $this->serialization->mergeArray($settings); $this->schema->mergeArray($settings); + $this->ipc->mergeArray($settings); switch ($settings['db']['type'] ?? 'memory') { case 'memory': diff --git a/src/danog/MadelineProto/Settings/Ipc.php b/src/danog/MadelineProto/Settings/Ipc.php index 55853955..8500133f 100644 --- a/src/danog/MadelineProto/Settings/Ipc.php +++ b/src/danog/MadelineProto/Settings/Ipc.php @@ -15,6 +15,7 @@ class Ipc extends SettingsAbstract public function mergeArray(array $settings): void { + $this->setSlow($settings['ipc']['slow'] ?? $this->getSlow()); } /** From 34f34964a23cb2353ddd9528bf4a3eb08e668865 Mon Sep 17 00:00:00 2001 From: Alexander Pankratov Date: Sat, 3 Oct 2020 02:16:28 +0300 Subject: [PATCH 2/2] Fix bugs in banned session handler https://t.me/pwrtelegramgroupru/35066 --- src/danog/MadelineProto/MTProtoSession/ResponseHandler.php | 7 ++++--- src/danog/MadelineProto/MTProtoSession/Session.php | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php b/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php index fa96d6c7..0a40676c 100644 --- a/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php +++ b/src/danog/MadelineProto/MTProtoSession/ResponseHandler.php @@ -344,6 +344,7 @@ trait ResponseHandler case 401: switch ($response['error_message']) { case 'USER_DEACTIVATED': + case 'USER_DEACTIVATED_BAN': case 'SESSION_REVOKED': case 'SESSION_EXPIRED': $this->gotResponseForOutgoingMessageId($request_id); @@ -353,11 +354,11 @@ trait ResponseHandler $socket->setPermAuthKey(null); $socket->resetSession(); } - if ($response['error_message'] === 'USER_DEACTIVATED') { + if (in_array($response['error_message'],['USER_DEACTIVATED', 'USER_DEACTIVATED_BAN'], true)) { $this->logger->logger('!!!!!!! WARNING !!!!!!!', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger("Telegram's flood prevention system suspended this account.", \danog\MadelineProto\Logger::ERROR); $this->logger->logger('To continue, manual verification is required.', \danog\MadelineProto\Logger::FATAL_ERROR); - $phone = isset($this->authorization['user']['phone']) ? '+'.$this->authorization['user']['phone'] : 'you are currently using'; + $phone = isset($this->API->authorization['user']['phone']) ? '+'.$this->API->authorization['user']['phone'] : 'you are currently using'; $this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number '.$phone.', and shortly describe what will you do with this phone number.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('Then login again.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('If you intentionally deleted this account, ignore this message.', \danog\MadelineProto\Logger::FATAL_ERROR); @@ -392,7 +393,7 @@ trait ResponseHandler $this->logger->logger('!!!!!!! WARNING !!!!!!!', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger("Telegram's flood prevention system suspended this account.", \danog\MadelineProto\Logger::ERROR); $this->logger->logger('To continue, manual verification is required.', \danog\MadelineProto\Logger::FATAL_ERROR); - $phone = isset($this->authorization['user']['phone']) ? '+'.$this->authorization['user']['phone'] : 'you are currently using'; + $phone = isset($this->API->authorization['user']['phone']) ? '+'.$this->API->authorization['user']['phone'] : 'you are currently using'; $this->logger->logger('Send an email to recover@telegram.org, asking to unban the phone number '.$phone.', and quickly describe what will you do with this phone number.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('Then login again.', \danog\MadelineProto\Logger::FATAL_ERROR); $this->logger->logger('If you intentionally deleted this account, ignore this message.', \danog\MadelineProto\Logger::FATAL_ERROR); diff --git a/src/danog/MadelineProto/MTProtoSession/Session.php b/src/danog/MadelineProto/MTProtoSession/Session.php index 431e04a9..ec844bc0 100644 --- a/src/danog/MadelineProto/MTProtoSession/Session.php +++ b/src/danog/MadelineProto/MTProtoSession/Session.php @@ -19,6 +19,8 @@ namespace danog\MadelineProto\MTProtoSession; +use danog\MadelineProto\MTProto; + /** * Manages MTProto session-specific data. *