diff --git a/src/danog/MadelineProto/CombinedAPI.php b/src/danog/MadelineProto/CombinedAPI.php index 8eae88da..dd55e427 100644 --- a/src/danog/MadelineProto/CombinedAPI.php +++ b/src/danog/MadelineProto/CombinedAPI.php @@ -186,7 +186,7 @@ class CombinedAPI if ($method === 'onLoop') { $this->loop_callback = [$this->event_handler_instance, 'onLoop']; } elseif ($method === 'onAny') { - foreach (end($this->instances)->API->constructors->by_id as $id => $constructor) { + foreach (end($this->instances)->API->constructors->by_id as $constructor) { if ($constructor['type'] === 'Update' && !isset($this->event_handler_methods[$constructor['predicate']])) { $this->event_handler_methods[$constructor['predicate']] = [$this->event_handler_instance, 'onAny']; } diff --git a/src/danog/MadelineProto/CombinedEventHandler.php b/src/danog/MadelineProto/CombinedEventHandler.php index 84100866..d4f6c2f0 100644 --- a/src/danog/MadelineProto/CombinedEventHandler.php +++ b/src/danog/MadelineProto/CombinedEventHandler.php @@ -35,8 +35,16 @@ abstract class CombinedEventHandler { $keys = method_exists($this, '__magic_sleep') ? $this->__magic_sleep() : get_object_vars($this); unset($keys['CombinedAPI']); - foreach ($this->CombinedAPI->instance_paths as $path) { - unset($keys[$path]); + if (isset($this->CombinedAPI)) { + foreach ($this->CombinedAPI->instance_paths as $path) { + unset($keys[$path]); + } + } else { + foreach ($keys as $key => $value) { + if ($value instanceof API) { + unset($keys[$key]); + } + } } return array_keys($keys); diff --git a/src/danog/MadelineProto/Loop/Connection/CheckLoop.php b/src/danog/MadelineProto/Loop/Connection/CheckLoop.php index fc05acb7..1c9e3df5 100644 --- a/src/danog/MadelineProto/Loop/Connection/CheckLoop.php +++ b/src/danog/MadelineProto/Loop/Connection/CheckLoop.php @@ -105,7 +105,7 @@ class CheckLoop extends ResumableSignalLoop } } if ($reply) { - $API->object_call('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]); + $API->object_call_async('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]); } $connection->writer->resume(); } diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index cf2312a3..c8ba4fff 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -819,9 +819,6 @@ class MTProto implements TLCallback public function close_and_reopen($datacenter) { $this->wait($this->datacenter->sockets[$datacenter]->reconnect()); - /*if ($this->is_http($datacenter) && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === true) { - $this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]); - }*/ } // Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php index e3b19f8e..1145b7ba 100644 --- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php @@ -170,11 +170,6 @@ trait CallHandler return $deferred; } - public function object_call($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]) - { - return $this->wait($this->object_call_async($object, $args, $aargs)); - } - public function object_call_async($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): Promise { $message = ['_' => $object, 'body' => $args, 'content_related' => $this->content_related($object), 'unencrypted' => $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key === null, 'method' => false];