From f168b0134aa9ecdec9eec74d0c7e1a8acada48d9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 25 Sep 2017 22:33:37 +0200 Subject: [PATCH] Fixes for old sessions --- src/danog/MadelineProto/MTProto.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 3c358da2..d36c1594 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -359,8 +359,10 @@ class MTProto } $this->setup_threads(); $this->datacenter->__construct($this->settings['connection'], $this->settings['connection_settings']); + if ($this->get_self()) { + $this->authorized = self::LOGGED_IN; + } if ($this->authorized === self::LOGGED_IN) { - $this->get_self(); $this->get_cdn_config($this->datacenter->curdc); $this->setup_logger(); } @@ -794,10 +796,9 @@ class MTProto public function get_self() { - if ($this->authorization === null) { + try { $this->authorization = ['user' => $this->method_call('users.getUsers', ['id' => [['_' => 'inputUserSelf']]], ['datacenter' => $this->datacenter->curdc])[0]]; - } - + } catch (RPCErrorException $e) { return false; } return $this->authorization['user']; }