Applied fixes from StyleCI

This commit is contained in:
Daniil Gentili 2016-10-18 16:46:55 +00:00 committed by StyleCI Bot
parent 7b468c9d0d
commit 9a11d42657
2 changed files with 17 additions and 12 deletions

View File

@ -149,10 +149,11 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
'api_hash' => $this->settings['app_info']['api_hash'], 'api_hash' => $this->settings['app_info']['api_hash'],
'lang_code' => $this->settings['app_info']['lang_code'], 'lang_code' => $this->settings['app_info']['lang_code'],
]); ]);
var_dump($nearestDc); var_dump($nearestDc);
} }
public function write_client_info() { public function write_client_info()
{
$this->log->log('Writing client info...'); $this->log->log('Writing client info...');
$nearestDc = $this->method_call('invokeWithLayer', [ $nearestDc = $this->method_call('invokeWithLayer', [
'layer' => $this->settings['tl_schema']['layer'], 'layer' => $this->settings['tl_schema']['layer'],
@ -170,6 +171,7 @@ var_dump($nearestDc);
$this->connection->dc_connect($nearestDc['nearest_dc']); $this->connection->dc_connect($nearestDc['nearest_dc']);
} }
} }
public function __destruct() public function __destruct()
{ {
unset($this->sock); unset($this->sock);

View File

@ -458,11 +458,13 @@ class AuthKeyHandler extends AckHandler
throw new Exception('Auth Failed'); throw new Exception('Auth Failed');
} }
public function bind_temp_auth_key($expires_in) {
public function bind_temp_auth_key($expires_in)
{
$nonce = $this->struct->unpack('<q', \phpseclib\Crypt\Random::string(8))[0]; $nonce = $this->struct->unpack('<q', \phpseclib\Crypt\Random::string(8))[0];
$expires_at = time() + $expires_in; $expires_at = time() + $expires_in;
$temp_auth_key_id = $this->struct->unpack('<q', $this->settings['authorization']['temp_auth_key']['id'])[0]; $temp_auth_key_id = $this->struct->unpack('<q', $this->settings['authorization']['temp_auth_key']['id'])[0];
$perm_auth_key_id= $this->struct->unpack('<q', $this->settings['authorization']['auth_key']['id'])[0]; $perm_auth_key_id = $this->struct->unpack('<q', $this->settings['authorization']['auth_key']['id'])[0];
$temp_session_id = $this->struct->unpack('<q', $this->settings['authorization']['session_id'])[0]; $temp_session_id = $this->struct->unpack('<q', $this->settings['authorization']['session_id'])[0];
$message_data = $this->tl->serialize_obj('bind_auth_key_inner', $message_data = $this->tl->serialize_obj('bind_auth_key_inner',
[ [
@ -485,6 +487,7 @@ class AuthKeyHandler extends AckHandler
if ($this->method_call('auth.bindTempAuthKey', ['perm_auth_key_id' => $perm_auth_key_id, 'nonce' => $nonce, 'expires_at' => $expires_at, 'encrypted_message' => $encrypted_message])) { if ($this->method_call('auth.bindTempAuthKey', ['perm_auth_key_id' => $perm_auth_key_id, 'nonce' => $nonce, 'expires_at' => $expires_at, 'encrypted_message' => $encrypted_message])) {
$this->log->log('Successfully binded temporary and permanent authorization keys.'); $this->log->log('Successfully binded temporary and permanent authorization keys.');
$this->write_client_info(); $this->write_client_info();
return true; return true;
} }
throw new Exception('An error occurred while binding temporary and permanent authorization keys.'); throw new Exception('An error occurred while binding temporary and permanent authorization keys.');