From 110aa5788880612f3c50478bc3d6ac994621dbad Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Jan 2017 22:27:25 +0100 Subject: [PATCH] Fixed bugs --- src/danog/MadelineProto/MTProto.php | 2 +- src/danog/MadelineProto/MTProtoTools/CallHandler.php | 2 +- src/danog/MadelineProto/TL/TL.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 89a8b2d0..7dfd8f70 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -65,7 +65,7 @@ class MTProto extends PrimeModule $this->setup_logger(); $this->datacenter->__construct($this->settings['connection'], $this->settings['connection_settings']); $this->reset_session(); - if ($this->datacenter->authorized) { + if ($this->datacenter->authorized && $this->settings['updates']['handle_updates']) { \danog\MadelineProto\Logger::log('Getting updates after deserialization...'); $this->get_updates_difference(); } diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php index ebafd37f..1bd75fe1 100644 --- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php @@ -111,7 +111,7 @@ trait CallHandler sleep(1); // To avoid flooding continue; } finally { - if ($heavy) { + if ($heavy && isset($int_message_id)) { $this->datacenter->outgoing_messages[$int_message_id]['args'] = []; } } diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index c2c88b65..dd8fc5da 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -114,19 +114,19 @@ trait TL switch ($type['type']) { case 'int': if (!is_numeric($object)) { - throw new Exception("given value isn't numeric"); + throw new Exception("given value (".$object.") isn't numeric"); } return \danog\PHP\Struct::pack('posmod((-$l - 1), 4)); } else { @@ -246,7 +246,7 @@ trait TL foreach ($tl['params'] as $current_argument) { if (!isset($arguments[$current_argument['name']])) { if ($current_argument['flag'] && (in_array($current_argument['type'], ['true', 'false']) || ($flags & $current_argument['pow']) == 0)) { - //\danog\MadelineProto\Logger::log('Skipping '.$current_argument['name'].' of type '.$current_argument['type'].'/'.$current_argument['subtype']); + //\danog\MadelineProto\Logger::log('Skipping '.$current_argument['name'].' of type '.$current_argument['type']); continue; } if ($current_argument['name'] == 'random_id') { @@ -268,7 +268,7 @@ trait TL } throw new Exception('Missing required parameter ('.$current_argument['name'].')'); } - //\danog\MadelineProto\Logger::log('Serializing '.$current_argument['name'].' of type '.$current_argument['type'].'/'.$current_argument['subtype']); + \danog\MadelineProto\Logger::log('Serializing '.$current_argument['name'].' of type '.$current_argument['type']); $serialized .= $this->serialize_object($current_argument, $arguments[$current_argument['name']]); }