Fixes
This commit is contained in:
parent
b306c98e4b
commit
c59aae4218
@ -839,18 +839,21 @@ class MTProto implements TLCallback
|
|||||||
}
|
}
|
||||||
yield $dcs;
|
yield $dcs;
|
||||||
yield $this->init_authorization_async();
|
yield $this->init_authorization_async();
|
||||||
$this->phoneConfigWatcherId = Loop::repeat(24 * 3600 * 1000, function ($watcherId) {
|
if (!$this->phoneConfigWatcherId) $this->phoneConfigWatcherId = Loop::repeat(24 * 3600 * 1000, [$this, 'get_phone_config_async']);
|
||||||
if ($this->authorized === self::LOGGED_IN) {
|
yield $this->get_phone_config_async();
|
||||||
$this->logger->logger("Fetching phone config...");
|
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
|
||||||
} else {
|
|
||||||
$this->logger->logger("Not fetching phone config");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
|
||||||
$this->logger->logger("Started phone config fetcher");
|
$this->logger->logger("Started phone config fetcher");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_phone_config_async($watcherId = null)
|
||||||
|
{
|
||||||
|
if ($this->authorized === self::LOGGED_IN && extension_loaded('libtgvoip')) {
|
||||||
|
$this->logger->logger("Fetching phone config...");
|
||||||
|
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->settings['connection_settings']['default_dc']]));
|
||||||
|
} else {
|
||||||
|
$this->logger->logger("Not fetching phone config");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function get_config($config = [], $options = [])
|
public function get_config($config = [], $options = [])
|
||||||
{
|
{
|
||||||
return $this->wait($this->get_config_async($config, $options));
|
return $this->wait($this->get_config_async($config, $options));
|
||||||
@ -861,7 +864,7 @@ class MTProto implements TLCallback
|
|||||||
if ($this->config['expires'] > time()) {
|
if ($this->config['expires'] > time()) {
|
||||||
return $this->config;
|
return $this->config;
|
||||||
}
|
}
|
||||||
$this->config = empty($config) ? yield $this->method_call_async_read('help.getConfig', $config, empty($options) ? ['datacenter' => $this->datacenter->curdc] : $options) : $config;
|
$this->config = empty($config) ? yield $this->method_call_async_read('help.getConfig', $config, empty($options) ? ['datacenter' => $this->settings['connection_settings']['default_dc']] : $options) : $config;
|
||||||
yield $this->parse_config();
|
yield $this->parse_config();
|
||||||
|
|
||||||
return $this->config;
|
return $this->config;
|
||||||
|
@ -89,9 +89,4 @@ if (class_exists('\\danog\\MadelineProto\\VoIPServerConfigInternal')) {
|
|||||||
return array_merge(self::$_configDefault, self::$_config);
|
return array_merge(self::$_configDefault, self::$_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
class VoIPServerConfig
|
|
||||||
{
|
|
||||||
public static function update(array $config) {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ trait Login
|
|||||||
$this->authorization = $authorization;
|
$this->authorization = $authorization;
|
||||||
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
||||||
yield $this->init_authorization_async();
|
yield $this->init_authorization_async();
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
yield $this->get_phone_config_async();
|
||||||
|
|
||||||
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE);
|
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ trait Login
|
|||||||
$this->datacenter->sockets[$dc_id]->authorized = true;
|
$this->datacenter->sockets[$dc_id]->authorized = true;
|
||||||
$this->authorized = self::LOGGED_IN;
|
$this->authorized = self::LOGGED_IN;
|
||||||
yield $this->init_authorization_async();
|
yield $this->init_authorization_async();
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
yield $this->get_phone_config_async();
|
||||||
|
|
||||||
return yield $this->get_self_async();
|
return yield $this->get_self_async();
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ trait Login
|
|||||||
$this->authorized = self::LOGGED_IN;
|
$this->authorized = self::LOGGED_IN;
|
||||||
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
||||||
yield $this->init_authorization_async();
|
yield $this->init_authorization_async();
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
yield $this->get_phone_config_async();
|
||||||
|
|
||||||
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['signup_ok'], \danog\MadelineProto\Logger::NOTICE);
|
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['signup_ok'], \danog\MadelineProto\Logger::NOTICE);
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ trait Login
|
|||||||
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
$this->datacenter->sockets[$this->datacenter->curdc]->authorized = true;
|
||||||
yield $this->init_authorization_async();
|
yield $this->init_authorization_async();
|
||||||
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE);
|
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_ok'], \danog\MadelineProto\Logger::NOTICE);
|
||||||
VoIPServerConfig::updateDefault(yield $this->method_call_async_read('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
|
yield $this->get_phone_config_async();
|
||||||
|
|
||||||
return $this->authorization;
|
return $this->authorization;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user