uhh
This commit is contained in:
parent
9a11d42657
commit
37fa11e81a
@ -484,7 +484,7 @@ class AuthKeyHandler extends AckHandler
|
|||||||
list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $this->settings['authorization']['auth_key']['auth_key']);
|
list($aes_key, $aes_iv) = $this->aes_calculate($message_key, $this->settings['authorization']['auth_key']['auth_key']);
|
||||||
$encrypted_message = $this->settings['authorization']['auth_key']['id'].$message_key.$this->ige_encrypt($encrypted_data.$padding, $aes_key, $aes_iv);
|
$encrypted_message = $this->settings['authorization']['auth_key']['id'].$message_key.$this->ige_encrypt($encrypted_data.$padding, $aes_key, $aes_iv);
|
||||||
|
|
||||||
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], $message_id)) {
|
||||||
$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();
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ class CallHandler extends AuthKeyHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function method_call($method, $args)
|
public function method_call($method, $args, $message_id = null)
|
||||||
{
|
{
|
||||||
foreach (range(1, $this->settings['max_tries']['query']) as $i) {
|
foreach (range(1, $this->settings['max_tries']['query']) as $i) {
|
||||||
try {
|
try {
|
||||||
$args = $this->tl->get_named_method_args($method, $args);
|
$args = $this->tl->get_named_method_args($method, $args);
|
||||||
$int_message_id = $this->send_message($this->tl->serialize_method($method, $args), $this->tl->content_related($method));
|
$int_message_id = $this->send_message($this->tl->serialize_method($method, $args), $this->tl->content_related($method), $message_id);
|
||||||
$this->outgoing_messages[$int_message_id]['content'] = ['method' => $method, 'args' => $args];
|
$this->outgoing_messages[$int_message_id]['content'] = ['method' => $method, 'args' => $args];
|
||||||
$server_answer = $this->wait_for_response($int_message_id, $method);
|
$server_answer = $this->wait_for_response($int_message_id, $method);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -21,9 +21,11 @@ class MessageHandler extends Crypt
|
|||||||
* Forming the message frame and sending message to server
|
* Forming the message frame and sending message to server
|
||||||
* :param message: byte string to send.
|
* :param message: byte string to send.
|
||||||
*/
|
*/
|
||||||
public function send_message($message_data, $content_related)
|
public function send_message($message_data, $content_related, $int_message_id = null)
|
||||||
{
|
{
|
||||||
$int_message_id = $this->generate_message_id();
|
if ($int_message_id == null) {
|
||||||
|
$int_message_id = $this->generate_message_id();
|
||||||
|
}
|
||||||
$message_id = $this->struct->pack('<Q', $int_message_id);
|
$message_id = $this->struct->pack('<Q', $int_message_id);
|
||||||
if (($this->settings['authorization']['temp_auth_key']['auth_key'] == null) || ($this->settings['authorization']['temp_auth_key']['server_salt'] == null)) {
|
if (($this->settings['authorization']['temp_auth_key']['auth_key'] == null) || ($this->settings['authorization']['temp_auth_key']['server_salt'] == null)) {
|
||||||
$message = $this->string2bin('\x00\x00\x00\x00\x00\x00\x00\x00').$message_id.$this->struct->pack('<I', strlen($message_data)).$message_data;
|
$message = $this->string2bin('\x00\x00\x00\x00\x00\x00\x00\x00').$message_id.$this->struct->pack('<I', strlen($message_data)).$message_data;
|
||||||
|
@ -41,6 +41,7 @@ class ResponseHandler extends MsgIdHandler
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'bad_msg_notification':
|
case 'bad_msg_notification':
|
||||||
|
throw new Exception('Received bad_msg_notification '.var_export($response, true));
|
||||||
break;
|
break;
|
||||||
case 'bad_server_salt':
|
case 'bad_server_salt':
|
||||||
$this->settings['authorization']['temp_auth_key']['server_salt'] = $response['new_server_salt'];
|
$this->settings['authorization']['temp_auth_key']['server_salt'] = $response['new_server_salt'];
|
||||||
|
Loading…
Reference in New Issue
Block a user