mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 04:35:12 +01:00
Improved parsing of settings and logging
This commit is contained in:
parent
91f43c5442
commit
6113c0d63c
@ -57,6 +57,7 @@ class API extends APIFactory
|
||||
public function &__get($name)
|
||||
{
|
||||
if ($name === 'settings') {
|
||||
$this->API->setdem = true;
|
||||
return $this->API->settings;
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,10 @@ class APIFactory
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if ($this->API->setdem) {
|
||||
$this->API->setdem = false;
|
||||
$this->API->__construct($this->API->settings);
|
||||
}
|
||||
$this->API->get_config([], ['datacenter' => $this->API->datacenter->curdc]);
|
||||
$aargs = isset($arguments[1]) && $this->is_array($arguments[1]) ? $arguments[1] : [];
|
||||
$aargs['datacenter'] = $this->API->datacenter->curdc;
|
||||
|
@ -148,7 +148,7 @@ class Logger
|
||||
public static function log($params, $level = self::NOTICE)
|
||||
{
|
||||
if (self::$mode === 4) {
|
||||
return self::$optional(is_array($params) ? $params : [$params], $level);
|
||||
return call_user_func_array(self::$optional, [is_array($params) ? $params : [$params], $level]);
|
||||
}
|
||||
if ($level > self::$level) {
|
||||
return false;
|
||||
|
@ -183,7 +183,7 @@ class MTProto extends \Volatile
|
||||
private $ipv6 = false;
|
||||
public $run_workers = false;
|
||||
public $threads = false;
|
||||
|
||||
public $setdem = false;
|
||||
public function ___construct($settings = [])
|
||||
{
|
||||
\danog\MadelineProto\Logger::class_exists();
|
||||
|
@ -118,6 +118,7 @@ class pony extends \danog\MadelineProto\VoIP
|
||||
|
||||
echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote
|
||||
'.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
|
||||
|
||||
if (stripos(readline('Do you want to make the secret chat tests? (y/n): '), 'y') !== false) {
|
||||
$start = false;
|
||||
var_dump($id = $MadelineProto->request_call('@danogentili', '\pony'));
|
||||
|
Loading…
Reference in New Issue
Block a user