1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 15:14:39 +01:00

Various bugfixes and abstractions

This commit is contained in:
Daniil Gentili 2018-07-07 19:48:10 +02:00
parent 935ae7009a
commit 62ea79cc06
5 changed files with 11 additions and 4 deletions

View File

@ -544,7 +544,10 @@ trait AuthKeyHandler
$socket->authorized = false;
} elseif ($socket->auth_key === null && $media) {
$socket->auth_key = $this->datacenter->sockets[intval($id)]->auth_key;
$socket->authorized = $this->datacenter->sockets[intval($id)]->authorized;
$socket->authorized = &$this->datacenter->sockets[intval($id)]->authorized;
}
if ($media) {
$socket->authorized = &$this->datacenter->sockets[intval($id)]->authorized;
}
if ($this->settings['connection_settings'][$dc_config_number]['pfs']) {
if (!$cdn) {

View File

@ -395,6 +395,7 @@ trait UpdateHandler
}
break;
}
if ($channel_id === false) {
$cur_state = &$this->load_update_state();
} else {

View File

@ -499,11 +499,14 @@ trait TL
$serialized .= pack('@4');
continue;
}
if (in_array($current_argument['type'], ['bytes', 'string', 'Vector t'])) {
$serialized .= pack('@4');
continue;
}
if ($id = $this->constructors->find_by_predicate(lcfirst($current_argument['type']).'Empty')) {
$serialized .= $id['id'];
continue;
}
throw new Exception(\danog\MadelineProto\Lang::$current_lang['params_missing'], $current_argument['name']);
}

View File

@ -35,7 +35,7 @@ trait Loop
set_time_limit(-1);
} catch (\danog\MadelineProto\Exception $e) {
register_shutdown_function(function () {
$this->logger->logger(['Restarting script...']);
//$this->logger->logger(['Restarting script...']);
$a = fsockopen((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']);
fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n");
});

View File

@ -20,7 +20,7 @@ trait TOS
{
public function check_tos()
{
if ($this->authorized === self::LOGGED_IN && !$this->get_self()['bot']) {
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot']) {
if ($this->tos['expires'] < time()) {
$this->logger->logger('Fetching TOS...');
$this->tos = $this->method_call('help.getTermsOfServiceUpdate', [], ['datacenter' => $this->datacenter->curdc]);