First step to initConnection

This commit is contained in:
danogentili 2016-10-14 00:49:43 +02:00
parent 55e3905495
commit 028cadc349
3 changed files with 17 additions and 2 deletions

View File

@ -37,7 +37,7 @@ src/danog/MadelineProto/
MTProto - Extends MTProtoTools, handles initial connection, generation of authorization keys, istantiation of classes MTProto - Extends MTProtoTools, handles initial connection, generation of authorization keys, istantiation of classes
MTProtoTools - Extends all of the classes in MTProtoTools/ MTProtoTools - Extends all of the classes in MTProtoTools/
prime.py - prime module (python) for p and q generation prime.py - prime module (python) for p and q generation
PrimeModule.php - prime module (php) for p and q generation by wrapping the python module, using wolfram alpha or a (broken) built in engine PrimeModule.php - prime module (php) for p and q generation by wrapping the python module, using wolfram alpha or a built in PHP engine
RSA - Handles RSA public keys and signatures RSA - Handles RSA public keys and signatures
Tools - Various tools (positive modulus, string2bin, python-like range) Tools - Various tools (positive modulus, string2bin, python-like range)
``` ```

View File

@ -68,6 +68,10 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
'app_info' => [ 'app_info' => [
'api_id' => 25628, 'api_id' => 25628,
'api_hash' => '1fe17cda7d355166cdaa71f04122873c', 'api_hash' => '1fe17cda7d355166cdaa71f04122873c',
'device_model' => php_uname('s'),
'system_version' => php_uname('r'),
'app_version' => 'Unicorn',
'lang_code' => 'en',
], ],
'tl_schema' => [ 'tl_schema' => [
'layer' => 55, 'layer' => 55,
@ -128,6 +132,16 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
} }
$this->settings['authorization']['temp_auth_key'] = $this->create_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']); $this->settings['authorization']['temp_auth_key'] = $this->create_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in']);
} }
$nearestDc = $this->method_call('invokeWithLayer', [
'layer' => $this->settings["tl_schema"]["layer"],
'query' => $this->tl->serialize_method('initConnection',
array_merge(
$this->settings["app_info"],
["query" => $this->tl->serialize_method('help.getNearestDc', [])]
)
)
]);
var_dump($nearestDc);
} }
public function __destruct() public function __destruct()

View File

@ -43,6 +43,7 @@ class ResponseHandler extends MsgIdHandler
case 'bad_msg_notification': case 'bad_msg_notification':
break; break;
case 'bad_server_salt': case 'bad_server_salt':
$this->settings["authorization"]["temp_auth_key"]["server_salt"] = $response["new_server_salt"];
$this->ack_outgoing_message_id($response['bad_msg_id']); // Acknowledge that the server received my request $this->ack_outgoing_message_id($response['bad_msg_id']); // Acknowledge that the server received my request
$this->outgoing_messages[$response['bad_msg_id']]['response'] = $last_received; $this->outgoing_messages[$response['bad_msg_id']]['response'] = $last_received;
$this->incoming_messages[$last_received]['content'] = $response; $this->incoming_messages[$last_received]['content'] = $response;
@ -58,7 +59,7 @@ class ResponseHandler extends MsgIdHandler
} }
break; break;
case 'new_session_created': case 'new_session_created':
// $this->settings['authorization']['temp_auth_key']['server_salt'] = $response['server_salt']; $this->settings['authorization']['temp_auth_key']['server_salt'] = $response['server_salt'];
$this->ack_incoming_message_id($last_received); // Acknowledge that I received the server's response $this->ack_incoming_message_id($last_received); // Acknowledge that I received the server's response
$this->log->log('new session created'); $this->log->log('new session created');
$this->log->log($response); $this->log->log($response);