Fixes to the lua module

This commit is contained in:
Daniil Gentili 2017-06-26 15:57:03 +02:00
parent 18c4829b86
commit 19f133676f
4 changed files with 17 additions and 6 deletions

View File

@ -46,7 +46,7 @@ class Lua
$this->Lua->registerCallback($method, [$this->MadelineProto->API, $method]);
}
$methods = [];
foreach ($this->MadelineProto->API->methods->method_namespace as $method => $namespace) {
foreach ($this->MadelineProto->get_methods_namespaced() as $method => $namespace) {
$methods[$namespace][$method] = [$this->MadelineProto->{$namespace}, $method];
}
foreach ($this->MadelineProto->get_method_namespaces() as $namespace) {

View File

@ -735,7 +735,7 @@ class MTProto extends \Volatile
public function getV()
{
return 45;
return 47;
}
public function get_self()

View File

@ -221,6 +221,11 @@ trait TL
return array_unique($this->array_values($this->methods->method_namespace));
}
public function get_methods_namespaced()
{
return $this->methods->method_namespace;
}
public function serialize_bool($bool)
{
return $this->constructors->find_by_predicate($bool ? 'boolTrue' : 'boolFalse')['id'];

View File

@ -90,15 +90,21 @@ trait AuthKeyHandler
$this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']);
$this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], true);
$this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']);
var_dump('config');
var_dump($this->config['call_connect_timeout_ms'] / 1000);
$this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']);
var_dump('shared config');
$this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
var_dump('endpoints');
var_dump(array_merge([$res['connection']], $res['alternative_connections']));
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $this->settings['calls']['allow_p2p']);
var_dump('start');
$this->calls[$params['id']]['controller']->start();
readline();
var_dump("SENDING DAT");
$f = fopen("output.raw", 'r');
while (!feof($f)) {
var_dump("SENDING 960 frames");
$this->calls[$params['id']]['controller']->writeFrames(stream_get_contents($f, 960*2));
}
$this->handle_pending_updates();
}