From d787cef5de7fbfef16d122e6f62cb2a28fb9dd20 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 5 Apr 2017 00:10:13 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/danog/MadelineProto/MTProtoTools/SeqNoHandler.php | 1 - src/danog/MadelineProto/TL/TL.php | 10 ++++++---- tests/testing.php | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoTools/SeqNoHandler.php b/src/danog/MadelineProto/MTProtoTools/SeqNoHandler.php index 79c389958..8a8a5eb1d 100644 --- a/src/danog/MadelineProto/MTProtoTools/SeqNoHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/SeqNoHandler.php @@ -44,7 +44,6 @@ trait SeqNoHandler public function content_related($method) { - return isset($method['_']) ? !in_array( $method['_'], [ diff --git a/src/danog/MadelineProto/TL/TL.php b/src/danog/MadelineProto/TL/TL.php index bb45fc7d5..dd7d60a34 100644 --- a/src/danog/MadelineProto/TL/TL.php +++ b/src/danog/MadelineProto/TL/TL.php @@ -534,14 +534,17 @@ trait TL } } if ($constructorData['predicate'] === 'gzip_packed') { - if (!isset($type['subtype'])) $type['subtype'] = ''; + if (!isset($type['subtype'])) { + $type['subtype'] = ''; + } + return $this->deserialize(gzdecode($this->deserialize($bytes_io, ['type' => 'bytes'])), ['type' => '', 'datacenter' => $type['datacenter'], 'subtype' => $type['subtype']]); } if ($constructorData['type'] === 'Vector t') { - $constructorData['datacenter'] = $type['datacenter']; $constructorData['subtype'] = $type['subtype']; $constructorData['type'] = 'vector'; + return $this->deserialize($bytes_io, $constructorData); } $x = ['_' => $constructorData['predicate']]; @@ -569,9 +572,8 @@ trait TL if (in_array($arg['name'], ['msg_ids', 'msg_id', 'bad_msg_id', 'req_msg_id', 'answer_msg_id', 'first_msg_id', 'key_fingerprint', 'server_salt', 'new_server_salt', 'server_public_key_fingerprints', 'ping_id', 'exchange_id'])) { $arg['strlong'] = true; } - + if ($x['_'] === 'rpc_result' && $arg['name'] === 'result' && isset($this->datacenter->sockets[$type['datacenter']]->new_outgoing[$x['req_msg_id']]['type']) && stripos($this->datacenter->sockets[$type['datacenter']]->new_outgoing[$x['req_msg_id']]['type'], '<') !== false) { - $arg['subtype'] = preg_replace(['|Vector[<]|', '|[>]|'], '', $this->datacenter->sockets[$type['datacenter']]->new_outgoing[$x['req_msg_id']]['type']); } $arg['datacenter'] = $type['datacenter']; diff --git a/tests/testing.php b/tests/testing.php index 475d87ff4..e29f45a8c 100755 --- a/tests/testing.php +++ b/tests/testing.php @@ -70,7 +70,6 @@ echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL; echo 'Size of MadelineProto instance is '.strlen(serialize($MadelineProto)).' bytes'.PHP_EOL; - $call = $MadelineProto->API->request_call(getenv('TEST_SECRET_CHAT')); echo 'Waiting for '.getenv('TEST_SECRET_CHAT').' to accept the call...'.PHP_EOL;