This commit is contained in:
Daniil Gentili 2017-05-19 16:36:13 +01:00
parent 3684603bd0
commit 03cd6be5eb
4 changed files with 7 additions and 32 deletions

View File

@ -183,6 +183,5 @@ if (!extension_loaded('pthreads')) {
return $value;
}
protected $state;
}
}

View File

@ -25,7 +25,7 @@ class Connection extends \Volatile
public $ip = null;
public $port = null;
public $timeout = null;
// public $parsed = [];
public $parsed = [];
public $time_delta = 0;
public $temp_auth_key;
public $auth_key;
@ -150,20 +150,7 @@ class Connection extends \Volatile
public function __sleep()
{
$t = get_object_vars($this);
if (isset($t['sock'])) {
unset($t['sock']);
}
if (isset($t['data'])) {
unset($t['data']);
}
$keys = array_keys((array) $t);
if (count($keys) !== count(array_unique($keys))) {
throw new Bug74586Exception();
}
return $keys;
return ['protocol', 'ip', 'port', 'timeout', 'parsed', 'time_delta', 'temp_auth_key', 'auth_key', 'session_id', 'session_out_seq_no', 'session_in_seq_no', 'ipv6', 'incoming_messages', 'outgoing_messages', 'new_incoming', 'new_outgoing'];
}
public function __wakeup()

View File

@ -98,6 +98,7 @@ class MTProto extends \Volatile
private $msg_ids = [];
private $dialog_params = ['limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty']];
public $storage = [];
public function ___construct($settings = [])
{
@ -160,20 +161,7 @@ class MTProto extends \Volatile
public function __sleep()
{
$t = get_object_vars($this);
if (isset($t['readers'])) {
unset($t['readers']);
}
if (isset($t['data'])) {
unset($t['data']);
}
$keys = array_keys((array) $t);
if (count($keys) !== count(array_unique($keys))) {
throw new Bug74586Exception();
}
return $keys;
return ['encrypted_layer', 'settings', 'config', 'ipv6', 'should_serialize', 'authorization', 'authorized', 'login_temp_status', 'bigint', 'run_workers', 'threads', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'bad_msg_error_codes', 'msgs_info_flags', 'stop', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'getting_state', 'full_chats', 'msg_ids', 'dialog_params', 'storage', 'datacenter'];
}
public function __wakeup()
@ -440,7 +428,7 @@ class MTProto extends \Volatile
'requests' => true, // Should I get info about unknown peers from PWRTelegram?
],
];
$settings = $this->array_replace_recursive($default_settings, $settings);
$settings = array_replace_recursive($this->array_cast_recursive($default_settings, true), $this->array_cast_recursive($settings, true));
if (!isset($settings['app_info']['api_id'])) {
throw new Exception('You must provide an api key and an api id, get your own @ my.telegram.org');
}
@ -617,7 +605,7 @@ class MTProto extends \Volatile
public function getV()
{
return 30;
return 32;
}
public function get_self()

View File

@ -74,6 +74,7 @@ trait UpdateHandler
$params['offset'] = array_reverse(array_keys((array) $this->updates))[abs($params['offset']) - 1];
}
$updates = [];
if (isset($this->updates["\0*\0state"])) unset($this->updates["\0*\0state"]);
$supdates = (array) $this->updates;
ksort($supdates);
foreach ($supdates as $key => $value) {