Final improvements

This commit is contained in:
Daniil Gentili 2018-04-01 17:30:57 +00:00
parent caaffb60f1
commit e8b77cb722
2 changed files with 4 additions and 3 deletions

View File

@ -54,7 +54,7 @@ class MTProto
/*
const V = 71;
*/
const V = 99;
const V = 100;
const NOT_LOGGED_IN = 0;
const WAITING_CODE = 1;
const WAITING_SIGNUP = -1;
@ -462,6 +462,7 @@ class MTProto
// Extra parameters to pass to the proxy class using setExtra
'pfs' => extension_loaded('gmp'),
],
'default_dc' => 2
], 'app_info' => [
// obtained in https://my.telegram.org
//'api_id' => you should put an API id in the settings array you provide

View File

@ -247,8 +247,8 @@ trait CallHandler
} catch (\danog\MadelineProto\Exception $e) {
$last_error = $e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine();
if (strpos($e->getMessage(), 'Received request to switch to DC ') === 0) {
if ($this->authorized_dc === -1 && ($method === 'users.getUsers' && $args = ['id' => [['_' => 'inputUserSelf']]]) || $method === 'auth.exportAuthorization') {
$this->authorized_dc = $this->datacenter->curdc;
if (($method === 'users.getUsers' && $args = ['id' => [['_' => 'inputUserSelf']]]) || $method === 'auth.exportAuthorization' || $method === 'updates.getDifference') {
$this->settings['connection_settings']['default_dc'] = $this->authorized_dc = $this->datacenter->curdc;
}
$last_recv = $this->datacenter->sockets[$aargs['datacenter']]->last_recv;
\danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);