Apply fixes from StyleCI
This commit is contained in:
parent
e5da891ac2
commit
da912540f9
@ -66,7 +66,7 @@ $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sem
|
|||||||
echo 'Serializing MadelineProto to s.madeline...'.PHP_EOL;
|
echo 'Serializing MadelineProto to s.madeline...'.PHP_EOL;
|
||||||
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL;
|
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL;
|
||||||
|
|
||||||
$sent = [-440592694=>true];
|
$sent = [-440592694 => true];
|
||||||
|
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -32,16 +32,16 @@ class API extends APIFactory
|
|||||||
$unserialized = file_get_contents($params);
|
$unserialized = file_get_contents($params);
|
||||||
flock($lock, LOCK_UN);
|
flock($lock, LOCK_UN);
|
||||||
fclose($lock);
|
fclose($lock);
|
||||||
|
|
||||||
$tounserialize = str_replace('O:26:"danog\MadelineProto\Button":', 'O:35:"danog\MadelineProto\TL\Types\Button":', $unserialized);
|
$tounserialize = str_replace('O:26:"danog\MadelineProto\Button":', 'O:35:"danog\MadelineProto\TL\Types\Button":', $unserialized);
|
||||||
foreach (['RSA', 'TL\TLMethod', 'TL\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\Types\Button', 'TL\Types\Bytes', 'APIFactory'] as $class) {
|
foreach (['RSA', 'TL\TLMethod', 'TL\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\Types\Button', 'TL\Types\Bytes', 'APIFactory'] as $class) {
|
||||||
class_exists('\danog\MadelineProto\\'.$class);
|
class_exists('\danog\MadelineProto\\'.$class);
|
||||||
}
|
}
|
||||||
class_exists('\Volatile');
|
class_exists('\Volatile');
|
||||||
\danog\MadelineProto\Logger::class_exists();
|
\danog\MadelineProto\Logger::class_exists();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// $unserialized = \danog\Serialization::unserialize($tounserialize);
|
// $unserialized = \danog\Serialization::unserialize($tounserialize);
|
||||||
$unserialized = unserialize($tounserialize);
|
$unserialized = unserialize($tounserialize);
|
||||||
} catch (\danog\MadelineProto\Bug74586Exception $e) {
|
} catch (\danog\MadelineProto\Bug74586Exception $e) {
|
||||||
$unserialized = \danog\Serialization::unserialize($tounserialize);
|
$unserialized = \danog\Serialization::unserialize($tounserialize);
|
||||||
@ -63,9 +63,10 @@ class API extends APIFactory
|
|||||||
if ($unserialized === false) {
|
if ($unserialized === false) {
|
||||||
throw new Exception(\danog\MadelineProto\Lang::$current_lang['deserialization_error']);
|
throw new Exception(\danog\MadelineProto\Lang::$current_lang['deserialization_error']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->APIFactory();
|
$this->APIFactory();
|
||||||
$this->API = $unserialized->API;
|
$this->API = $unserialized->API;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->API = new MTProto($params);
|
$this->API = new MTProto($params);
|
||||||
|
@ -78,12 +78,12 @@ class MTProto
|
|||||||
'updates.getDifference' => 'You cannot use this method directly, see https://daniil.it/MadelineProto for more info on handling updates',
|
'updates.getDifference' => 'You cannot use this method directly, see https://daniil.it/MadelineProto for more info on handling updates',
|
||||||
'updates.getState' => 'You cannot use this method directly, see https://daniil.it/MadelineProto for more info on handling updates',
|
'updates.getState' => 'You cannot use this method directly, see https://daniil.it/MadelineProto for more info on handling updates',
|
||||||
|
|
||||||
'upload.getCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.getCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
'upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.getCdnFileHashes' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
'upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.reuploadCdnFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
'upload.getFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.getFile' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
'upload.saveFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.saveFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
'upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
'upload.saveBigFilePart' => 'You cannot use this method directly, use the upload, download_to_stream, download_to_file, download_to_dir methods instead; see https://daniil.it/MadelineProto for more info',
|
||||||
|
|
||||||
];
|
];
|
||||||
const BAD_MSG_ERROR_CODES = [
|
const BAD_MSG_ERROR_CODES = [
|
||||||
@ -153,7 +153,7 @@ class MTProto
|
|||||||
|
|
||||||
];
|
];
|
||||||
const TD_REVERSE = [
|
const TD_REVERSE = [
|
||||||
'sendMessage'=> 'messages.sendMessage',
|
'sendMessage' => 'messages.sendMessage',
|
||||||
];
|
];
|
||||||
const TD_IGNORE = ['updateMessageID'];
|
const TD_IGNORE = ['updateMessageID'];
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ class MTProto
|
|||||||
private $msg_ids = [];
|
private $msg_ids = [];
|
||||||
private $v = 0;
|
private $v = 0;
|
||||||
|
|
||||||
private $dialog_params = ['_' => 'MadelineProto.dialogParams', 'limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0];
|
private $dialog_params = ['_' => 'MadelineProto.dialogParams', 'limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0];
|
||||||
private $zero;
|
private $zero;
|
||||||
private $one;
|
private $one;
|
||||||
private $two;
|
private $two;
|
||||||
@ -520,35 +520,35 @@ class MTProto
|
|||||||
],
|
],
|
||||||
'connection_settings' => [ // connection settings
|
'connection_settings' => [ // connection settings
|
||||||
'all' => [ // These settings will be applied on every datacenter that hasn't a custom settings subarray...
|
'all' => [ // These settings will be applied on every datacenter that hasn't a custom settings subarray...
|
||||||
'protocol' => 'tcp_full', // can be tcp_full, tcp_abridged, tcp_intermediate, http, https, obfuscated2, udp (unsupported)
|
'protocol' => 'tcp_full', // can be tcp_full, tcp_abridged, tcp_intermediate, http, https, obfuscated2, udp (unsupported)
|
||||||
'test_mode' => false, // decides whether to connect to the main telegram servers or to the testing servers (deep telegram)
|
'test_mode' => false, // decides whether to connect to the main telegram servers or to the testing servers (deep telegram)
|
||||||
'ipv6' => $this->ipv6, // decides whether to use ipv6, ipv6 attribute of API attribute of API class contains autodetected boolean
|
'ipv6' => $this->ipv6, // decides whether to use ipv6, ipv6 attribute of API attribute of API class contains autodetected boolean
|
||||||
'timeout' => 2, // timeout for sockets
|
'timeout' => 2, // timeout for sockets
|
||||||
'proxy' => '\Socket', // The proxy class to use
|
'proxy' => '\Socket', // The proxy class to use
|
||||||
'proxy_extra' => [], // Extra parameters to pass to the proxy class using setExtra
|
'proxy_extra' => [], // Extra parameters to pass to the proxy class using setExtra
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'app_info' => [ // obtained in https://my.telegram.org
|
'app_info' => [ // obtained in https://my.telegram.org
|
||||||
//'api_id' => you should put an API id in the settings array you provide
|
//'api_id' => you should put an API id in the settings array you provide
|
||||||
//'api_hash' => you should put an API hash in the settings array you provide
|
//'api_hash' => you should put an API hash in the settings array you provide
|
||||||
'device_model' => $device_model,
|
'device_model' => $device_model,
|
||||||
'system_version' => $system_version,
|
'system_version' => $system_version,
|
||||||
'app_version' => 'Unicorn', // 🌚
|
'app_version' => 'Unicorn', // 🌚
|
||||||
// 'app_version' => self::V,
|
// 'app_version' => self::V,
|
||||||
'lang_code' => $lang_code,
|
'lang_code' => $lang_code,
|
||||||
],
|
],
|
||||||
'tl_schema' => [ // TL scheme files
|
'tl_schema' => [ // TL scheme files
|
||||||
'layer' => 72, // layer version
|
'layer' => 72, // layer version
|
||||||
'src' => [
|
'src' => [
|
||||||
'mtproto' => __DIR__.'/TL_mtproto_v1.json', // mtproto TL scheme
|
'mtproto' => __DIR__.'/TL_mtproto_v1.json', // mtproto TL scheme
|
||||||
'telegram' => __DIR__.'/TL_telegram_v72.tl', // telegram TL scheme
|
'telegram' => __DIR__.'/TL_telegram_v72.tl', // telegram TL scheme
|
||||||
'secret' => __DIR__.'/TL_secret.tl', // secret chats TL scheme
|
'secret' => __DIR__.'/TL_secret.tl', // secret chats TL scheme
|
||||||
'calls' => __DIR__.'/TL_calls.tl', // calls TL scheme
|
'calls' => __DIR__.'/TL_calls.tl', // calls TL scheme
|
||||||
//'td' => __DIR__.'/TL_td.tl', // telegram-cli TL scheme
|
//'td' => __DIR__.'/TL_td.tl', // telegram-cli TL scheme
|
||||||
'botAPI' => __DIR__.'/TL_botAPI.tl', // bot API TL scheme for file ids
|
'botAPI' => __DIR__.'/TL_botAPI.tl', // bot API TL scheme for file ids
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'logger' => [ // Logger settings
|
'logger' => [ // Logger settings
|
||||||
/*
|
/*
|
||||||
* logger modes:
|
* logger modes:
|
||||||
* 0 - No logger
|
* 0 - No logger
|
||||||
@ -558,38 +558,38 @@ class MTProto
|
|||||||
* 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level
|
* 4 - Call callable provided in logger_param. logger_param must accept two parameters: array $message, int $level
|
||||||
* $message is an array containing the messages the log, $level, is the logging level
|
* $message is an array containing the messages the log, $level, is the logging level
|
||||||
*/
|
*/
|
||||||
'logger' => 1, // write to
|
'logger' => 1, // write to
|
||||||
'logger_param' => '/tmp/MadelineProto.log',
|
'logger_param' => '/tmp/MadelineProto.log',
|
||||||
'logger' => 3, // overwrite previous setting and echo logs
|
'logger' => 3, // overwrite previous setting and echo logs
|
||||||
'logger_level' => Logger::VERBOSE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
|
'logger_level' => Logger::VERBOSE, // Logging level, available logging levels are: ULTRA_VERBOSE, VERBOSE, NOTICE, WARNING, ERROR, FATAL_ERROR. Can be provided as last parameter to the logging function.
|
||||||
'rollbar_token' => 'c07d9b2f73c2461297b0beaef6c1662f',
|
'rollbar_token' => 'c07d9b2f73c2461297b0beaef6c1662f',
|
||||||
//'rollbar_token' => 'f9fff6689aea4905b58eec73f66c791d' // You can provide a token for the rollbar log management system
|
//'rollbar_token' => 'f9fff6689aea4905b58eec73f66c791d' // You can provide a token for the rollbar log management system
|
||||||
],
|
],
|
||||||
'max_tries' => [
|
'max_tries' => [
|
||||||
'query' => 5, // How many times should I try to call a method or send an object before throwing an exception
|
'query' => 5, // How many times should I try to call a method or send an object before throwing an exception
|
||||||
'authorization' => 5, // How many times should I try to generate an authorization key before throwing an exception
|
'authorization' => 5, // How many times should I try to generate an authorization key before throwing an exception
|
||||||
'response' => 5, // How many times should I try to get a response of a query before throwing an exception
|
'response' => 5, // How many times should I try to get a response of a query before throwing an exception
|
||||||
],
|
],
|
||||||
'flood_timeout' => [
|
'flood_timeout' => [
|
||||||
'wait_if_lt' => 20, // Sleeps if flood block time is lower than this
|
'wait_if_lt' => 20, // Sleeps if flood block time is lower than this
|
||||||
],
|
],
|
||||||
'msg_array_limit' => [ // How big should be the arrays containing the incoming and outgoing messages?
|
'msg_array_limit' => [ // How big should be the arrays containing the incoming and outgoing messages?
|
||||||
'incoming' => 200,
|
'incoming' => 200,
|
||||||
'outgoing' => 200,
|
'outgoing' => 200,
|
||||||
'call_queue' => 200,
|
'call_queue' => 200,
|
||||||
],
|
],
|
||||||
'peer' => [
|
'peer' => [
|
||||||
'full_info_cache_time' => 60,
|
'full_info_cache_time' => 60,
|
||||||
],
|
],
|
||||||
'requests' => [
|
'requests' => [
|
||||||
'gzip_encode_if_gt' => 500, // Should I try using gzip encoding for requests bigger than N bytes? Set to -1 to disable.
|
'gzip_encode_if_gt' => 500, // Should I try using gzip encoding for requests bigger than N bytes? Set to -1 to disable.
|
||||||
],
|
],
|
||||||
'updates' => [
|
'updates' => [
|
||||||
'handle_updates' => true, // Should I handle updates?
|
'handle_updates' => true, // Should I handle updates?
|
||||||
'callback' => 'get_updates_update_handler', // A callable function that will be called every time an update is received, must accept an array (for the update) as the only parameter
|
'callback' => 'get_updates_update_handler', // A callable function that will be called every time an update is received, must accept an array (for the update) as the only parameter
|
||||||
],
|
],
|
||||||
'secret_chats' => [
|
'secret_chats' => [
|
||||||
'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats
|
'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats
|
||||||
],
|
],
|
||||||
'threading' => [
|
'threading' => [
|
||||||
'allow_threading' => false, // Should I use threading, if it is enabled?
|
'allow_threading' => false, // Should I use threading, if it is enabled?
|
||||||
@ -749,15 +749,15 @@ class MTProto
|
|||||||
'layer' => $this->settings['tl_schema']['layer'],
|
'layer' => $this->settings['tl_schema']['layer'],
|
||||||
'query' => $this->serialize_method('initConnection',
|
'query' => $this->serialize_method('initConnection',
|
||||||
[
|
[
|
||||||
'api_id' => $this->settings['app_info']['api_id'],
|
'api_id' => $this->settings['app_info']['api_id'],
|
||||||
'api_hash' => $this->settings['app_info']['api_hash'],
|
'api_hash' => $this->settings['app_info']['api_hash'],
|
||||||
'device_model' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['device_model'] : 'n/a',
|
'device_model' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['device_model'] : 'n/a',
|
||||||
'system_version' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['system_version'] : 'n/a',
|
'system_version' => strpos($options['datacenter'], 'cdn') === false ? $this->settings['app_info']['system_version'] : 'n/a',
|
||||||
'app_version' => $this->settings['app_info']['app_version'],
|
'app_version' => $this->settings['app_info']['app_version'],
|
||||||
'system_lang_code' => $this->settings['app_info']['lang_code'],
|
'system_lang_code' => $this->settings['app_info']['lang_code'],
|
||||||
'lang_code' => $this->settings['app_info']['lang_code'],
|
'lang_code' => $this->settings['app_info']['lang_code'],
|
||||||
'lang_pack' => '',
|
'lang_pack' => '',
|
||||||
'query' => $this->serialize_method($method, $arguments),
|
'query' => $this->serialize_method($method, $arguments),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -103,13 +103,13 @@ trait AuthKeyHandler
|
|||||||
$new_nonce = $this->random(32);
|
$new_nonce = $this->random(32);
|
||||||
|
|
||||||
$data_unserialized = [
|
$data_unserialized = [
|
||||||
'pq' => $pq_bytes,
|
'pq' => $pq_bytes,
|
||||||
'p' => $p_bytes,
|
'p' => $p_bytes,
|
||||||
'q' => $q_bytes,
|
'q' => $q_bytes,
|
||||||
'nonce' => $nonce,
|
'nonce' => $nonce,
|
||||||
'server_nonce' => $server_nonce,
|
'server_nonce' => $server_nonce,
|
||||||
'new_nonce' => $new_nonce,
|
'new_nonce' => $new_nonce,
|
||||||
'expires_in' => $expires_in,
|
'expires_in' => $expires_in,
|
||||||
];
|
];
|
||||||
$p_q_inner_data = $this->serialize_object(['type' => 'p_q_inner_data'.($expires_in < 0 ? '' : '_temp')], $data_unserialized, 'p_q_inner_data');
|
$p_q_inner_data = $this->serialize_object(['type' => 'p_q_inner_data'.($expires_in < 0 ? '' : '_temp')], $data_unserialized, 'p_q_inner_data');
|
||||||
|
|
||||||
@ -282,10 +282,10 @@ trait AuthKeyHandler
|
|||||||
$data = $this->serialize_object(
|
$data = $this->serialize_object(
|
||||||
['type' => 'client_DH_inner_data'],
|
['type' => 'client_DH_inner_data'],
|
||||||
[
|
[
|
||||||
'nonce' => $nonce,
|
'nonce' => $nonce,
|
||||||
'server_nonce' => $server_nonce,
|
'server_nonce' => $server_nonce,
|
||||||
'retry_id' => $retry_id,
|
'retry_id' => $retry_id,
|
||||||
'g_b' => $g_b_str,
|
'g_b' => $g_b_str,
|
||||||
], 'client_DH_inner_data'
|
], 'client_DH_inner_data'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -318,9 +318,9 @@ trait AuthKeyHandler
|
|||||||
$Set_client_DH_params_answer = $this->method_call(
|
$Set_client_DH_params_answer = $this->method_call(
|
||||||
'set_client_DH_params',
|
'set_client_DH_params',
|
||||||
[
|
[
|
||||||
'nonce' => $nonce,
|
'nonce' => $nonce,
|
||||||
'server_nonce' => $server_nonce,
|
'server_nonce' => $server_nonce,
|
||||||
'encrypted_data' => $encrypted_data,
|
'encrypted_data' => $encrypted_data,
|
||||||
],
|
],
|
||||||
['datacenter' => $datacenter]
|
['datacenter' => $datacenter]
|
||||||
|
|
||||||
@ -531,11 +531,11 @@ trait AuthKeyHandler
|
|||||||
$temp_session_id = $this->datacenter->sockets[$datacenter]->session_id;
|
$temp_session_id = $this->datacenter->sockets[$datacenter]->session_id;
|
||||||
$message_data = $this->serialize_object(['type' => 'bind_auth_key_inner'],
|
$message_data = $this->serialize_object(['type' => 'bind_auth_key_inner'],
|
||||||
[
|
[
|
||||||
'nonce' => $nonce,
|
'nonce' => $nonce,
|
||||||
'temp_auth_key_id' => $temp_auth_key_id,
|
'temp_auth_key_id' => $temp_auth_key_id,
|
||||||
'perm_auth_key_id' => $perm_auth_key_id,
|
'perm_auth_key_id' => $perm_auth_key_id,
|
||||||
'temp_session_id' => $temp_session_id,
|
'temp_session_id' => $temp_session_id,
|
||||||
'expires_at' => $expires_at,
|
'expires_at' => $expires_at,
|
||||||
], 'bind_temp_auth_key_inner'
|
], 'bind_temp_auth_key_inner'
|
||||||
);
|
);
|
||||||
$message_id = $this->generate_message_id($datacenter);
|
$message_id = $this->generate_message_id($datacenter);
|
||||||
|
@ -214,7 +214,7 @@ trait PeerHandler
|
|||||||
return $this->gen_all($this->chats[$id]);
|
return $this->gen_all($this->chats[$id]);
|
||||||
}
|
}
|
||||||
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true) {
|
if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true) {
|
||||||
$dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http'=> [
|
$dbres = json_decode(@file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http' => [
|
||||||
'timeout' => 2,
|
'timeout' => 2,
|
||||||
],
|
],
|
||||||
])), true);
|
])), true);
|
||||||
|
@ -58,6 +58,6 @@ class Serialization
|
|||||||
*/
|
*/
|
||||||
public static function deserialize($filename, $no_updates = false)
|
public static function deserialize($filename, $no_updates = false)
|
||||||
{
|
{
|
||||||
throw new \danog\MadelineProto\Exception('You can\'t call \danog\MadelineProto\Serialization::deserialize($filename) anymore, use new \danog\MadelineProto\API($filename) instead'.PHP_EOL.PHP_EOL."Protip: run the following command to fix all of your scripts:".PHP_EOL.PHP_EOL."find . -type f -exec sed 's/\\\\danog\\\\MadelineProto\\\\Serialization::deserialize/new \\\\danog\\\\MadelineProto\\\\API/g' -i {} +".PHP_EOL.PHP_EOL, 0, null, 'MadelineProto', 0);
|
throw new \danog\MadelineProto\Exception('You can\'t call \danog\MadelineProto\Serialization::deserialize($filename) anymore, use new \danog\MadelineProto\API($filename) instead'.PHP_EOL.PHP_EOL.'Protip: run the following command to fix all of your scripts:'.PHP_EOL.PHP_EOL."find . -type f -exec sed 's/\\\\danog\\\\MadelineProto\\\\Serialization::deserialize/new \\\\danog\\\\MadelineProto\\\\API/g' -i {} +".PHP_EOL.PHP_EOL, 0, null, 'MadelineProto', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ trait TD
|
|||||||
if (isset($params['fwd_from'])) {
|
if (isset($params['fwd_from'])) {
|
||||||
$newparams[$td] = ['_' => 'messageForwardedFromUser'];
|
$newparams[$td] = ['_' => 'messageForwardedFromUser'];
|
||||||
if (isset($params['fwd_from']['channel_id'])) {
|
if (isset($params['fwd_from']['channel_id'])) {
|
||||||
$newparams[$td] = ['_'=> 'messageForwardedPost', 'chat_id' => '-100'.$params['fwd_from']['channel_id']];
|
$newparams[$td] = ['_' => 'messageForwardedPost', 'chat_id' => '-100'.$params['fwd_from']['channel_id']];
|
||||||
}
|
}
|
||||||
$newparams[$td]['date'] = $params['fwd_from']['date'];
|
$newparams[$td]['date'] = $params['fwd_from']['date'];
|
||||||
if (isset($params['fwd_from']['channel_post'])) {
|
if (isset($params['fwd_from']['channel_post'])) {
|
||||||
|
@ -139,15 +139,15 @@ trait AuthKeyHandler
|
|||||||
$this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']);
|
$this->calls[$params['id']]->configuration['shared_config'] = array_merge($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]), $this->calls[$params['id']]->configuration['shared_config']);
|
||||||
$this->calls[$params['id']]->configuration['endpoints'] = array_merge([$res['connection']], $res['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']);
|
$this->calls[$params['id']]->configuration['endpoints'] = array_merge([$res['connection']], $res['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']);
|
||||||
$this->calls[$params['id']]->configuration = array_merge([
|
$this->calls[$params['id']]->configuration = array_merge([
|
||||||
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
||||||
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
||||||
'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER,
|
'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER,
|
||||||
'enable_NS' => true,
|
'enable_NS' => true,
|
||||||
'enable_AEC' => true,
|
'enable_AEC' => true,
|
||||||
'enable_AGC' => true,
|
'enable_AGC' => true,
|
||||||
|
|
||||||
'auth_key' => $key,
|
'auth_key' => $key,
|
||||||
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
||||||
], $this->calls[$params['id']]->configuration);
|
], $this->calls[$params['id']]->configuration);
|
||||||
$this->calls[$params['id']]->parseConfig();
|
$this->calls[$params['id']]->parseConfig();
|
||||||
$res = $this->calls[$params['id']]->startTheMagic();
|
$res = $this->calls[$params['id']]->startTheMagic();
|
||||||
@ -199,15 +199,15 @@ trait AuthKeyHandler
|
|||||||
$this->calls[$params['id']]->configuration['endpoints'] = array_merge([$params['connection']], $params['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']);
|
$this->calls[$params['id']]->configuration['endpoints'] = array_merge([$params['connection']], $params['alternative_connections'], $this->calls[$params['id']]->configuration['endpoints']);
|
||||||
|
|
||||||
$this->calls[$params['id']]->configuration = array_merge([
|
$this->calls[$params['id']]->configuration = array_merge([
|
||||||
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
'recv_timeout' => $this->config['call_receive_timeout_ms'] / 1000,
|
||||||
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
'init_timeout' => $this->config['call_connect_timeout_ms'] / 1000,
|
||||||
'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER,
|
'data_saving' => \danog\MadelineProto\VoIP::DATA_SAVING_NEVER,
|
||||||
'enable_NS' => true,
|
'enable_NS' => true,
|
||||||
'enable_AEC' => true,
|
'enable_AEC' => true,
|
||||||
'enable_AGC' => true,
|
'enable_AGC' => true,
|
||||||
|
|
||||||
'auth_key' => $key,
|
'auth_key' => $key,
|
||||||
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
'network_type' => \danog\MadelineProto\VoIP::NET_TYPE_ETHERNET,
|
||||||
], $this->calls[$params['id']]->configuration);
|
], $this->calls[$params['id']]->configuration);
|
||||||
var_dump($this->calls[$params['id']]->configuration);
|
var_dump($this->calls[$params['id']]->configuration);
|
||||||
$this->calls[$params['id']]->parseConfig();
|
$this->calls[$params['id']]->parseConfig();
|
||||||
|
@ -22,7 +22,7 @@ trait DialogHandler
|
|||||||
!isset($this->dialog_params['offset_peer']) || is_null($this->dialog_params['offset_peer']) ||
|
!isset($this->dialog_params['offset_peer']) || is_null($this->dialog_params['offset_peer']) ||
|
||||||
!isset($this->dialog_params['count']) || is_null($this->dialog_params['count'])
|
!isset($this->dialog_params['count']) || is_null($this->dialog_params['count'])
|
||||||
) {
|
) {
|
||||||
$this->dialog_params = ['limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0];
|
$this->dialog_params = ['limit' => 0, 'offset_date' => 0, 'offset_id' => 0, 'offset_peer' => ['_' => 'inputPeerEmpty'], 'count' => 0];
|
||||||
}
|
}
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
$res = ['dialogs' => [0], 'count' => 1];
|
$res = ['dialogs' => [0], 'count' => 1];
|
||||||
|
@ -45,9 +45,9 @@ trait Login
|
|||||||
$this->authorization = $this->method_call(
|
$this->authorization = $this->method_call(
|
||||||
'auth.importBotAuthorization',
|
'auth.importBotAuthorization',
|
||||||
[
|
[
|
||||||
'bot_auth_token' => $token,
|
'bot_auth_token' => $token,
|
||||||
'api_id' => $this->settings['app_info']['api_id'],
|
'api_id' => $this->settings['app_info']['api_id'],
|
||||||
'api_hash' => $this->settings['app_info']['api_hash'],
|
'api_hash' => $this->settings['app_info']['api_hash'],
|
||||||
], ['datacenter' => $this->datacenter->curdc]
|
], ['datacenter' => $this->datacenter->curdc]
|
||||||
);
|
);
|
||||||
$this->authorized = self::LOGGED_IN;
|
$this->authorized = self::LOGGED_IN;
|
||||||
|
@ -13,7 +13,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
require '../vendor/autoload.php';
|
require '../vendor/autoload.php';
|
||||||
$settings = [];
|
$settings = [];
|
||||||
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
||||||
$MadelineProto = false;
|
$MadelineProto = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -12,7 +12,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require '../vendor/autoload.php';
|
require '../vendor/autoload.php';
|
||||||
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
||||||
$MadelineProto = false;
|
$MadelineProto = false;
|
||||||
$uMadelineProto = false;
|
$uMadelineProto = false;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with Mad
|
|||||||
If not, see <http://www.gnu.org/licenses/>.
|
If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
require '../vendor/autoload.php';
|
require '../vendor/autoload.php';
|
||||||
$settings = ['app_info'=>['api_id'=>6, 'api_hash'=>'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']];
|
||||||
include_once 'token.php';
|
include_once 'token.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user