diff --git a/bot.php b/bot.php
index 5184359e..df622a39 100755
--- a/bot.php
+++ b/bot.php
@@ -12,7 +12,7 @@ If not, see .
*/
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
-/**
+/*
* Various ways to load MadelineProto
*/
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
@@ -29,12 +29,14 @@ class EventHandler extends \danog\MadelineProto\EventHandler
{
public function onAny($update)
{
- \danog\MadelineProto\Logger::log("Received an update of type ".$update['_']);
+ \danog\MadelineProto\Logger::log('Received an update of type '.$update['_']);
}
+
public function onUpdateNewChannelMessage($update)
{
$this->onUpdateNewMessage($update);
}
+
public function onUpdateNewMessage($update)
{
if (isset($update['message']['out']) && $update['message']['out']) {
@@ -63,7 +65,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
}
}
-
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
try {
diff --git a/build_docs_index.php b/build_docs_index.php
index bb4efe3a..407006d3 100644
--- a/build_docs_index.php
+++ b/build_docs_index.php
@@ -1,51 +1,52 @@
$filename) {
$lines = explode("\n", file_get_contents($filename));
- while (end($lines) === '' || strpos(end($lines), "Next")) {
- unset($lines[count($lines)-1]);
+ while (end($lines) === '' || strpos(end($lines), 'Next')) {
+ unset($lines[count($lines) - 1]);
}
- if (isset($orderedfiles[$key+1])) {
- $nextfile = "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key+1], '.md').".html";
- $prevfile = $key === 0 ? "https://docs.madelineproto.xyz" : "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key-1], '.md').".html";
+ if (isset($orderedfiles[$key + 1])) {
+ $nextfile = 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key + 1], '.md').'.html';
+ $prevfile = $key === 0 ? 'https://docs.madelineproto.xyz' : 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key - 1], '.md').'.html';
$lines[count($lines)] = "\n
";
} else {
$lines[count($lines)] = "\n";
@@ -68,13 +69,13 @@ foreach ($orderedfiles as $key => $filename) {
preg_match('|^# (.*)|', $file = file_get_contents($filename), $matches);
$title = $matches[1];
preg_match_all('|( *)\* \[(.*)\]\(#(.*)\)|', $file, $matches);
- $file = "https://docs.madelineproto.xyz/docs/".basename($filename, '.md').".html";
+ $file = 'https://docs.madelineproto.xyz/docs/'.basename($filename, '.md').'.html';
$index .= "* [$title]($file)\n";
if (basename($filename) !== 'FEATURES.md') {
foreach ($matches[1] as $key => $match) {
$spaces = " $match";
$name = $matches[2][$key];
- $url = $file."#".$matches[3][$key];
+ $url = $file.'#'.$matches[3][$key];
$index .= "$spaces* [$name]($url)\n";
}
}
diff --git a/docs/MTProto_docs/Lang.php b/docs/MTProto_docs/Lang.php
index c7acb62d..a30c5058 100644
--- a/docs/MTProto_docs/Lang.php
+++ b/docs/MTProto_docs/Lang.php
@@ -9,498 +9,496 @@
You should have received a copy of the GNU General Public License along with MadelineProto.
If not, see .
*/
-
+
namespace danog\MadelineProto;
-
+
class Lang
{
- public static $lang = array (
- 'it' =>
- array (
- 'phpseclib_fork' => 'Per favore installa questo fork di phpseclib: https://github.com/danog/phpseclib',
- 'inst_dc' => 'Istanziamento dei DataCenter...',
- 'load_rsa' => 'Caricamento delle chiavi RSA...',
- 'TL_translation' => 'Translazione degli schemi TL...',
- 'dh_prime_check_0' => 'Esecuzione dei check dh_prime (0/3)...',
- 'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.',
- 'serialization_ofd' => 'La serializzazione non è aggiornata, reistanziamento dell\'oggetto in corso!',
- 'getupdates_deserialization' => 'Ottenimento aggiornamenti dopo deserializzazione...',
- 'shutdown_reader_pool' => 'Chiusura pool di lettura, %d thread rimasti',
- 'threading_on' => 'IL THREADING È ABILITATO',
- 'socket_reader' => 'Lettore socket su DC %s: ',
- 'socket_status_1' => 'CREAZIONE',
- 'socket_status_2' => 'INVIO',
- 'socket_status_3' => 'ATTESA',
- 'socket_status_4' => 'PRONTO',
- 'socket_status_5' => 'AVVIATO',
- 'api_not_set' => 'Devi specificare una chiave ed un ID API, ottienili su https://my.telegram.org',
- 'session_corrupted' => 'La sessione si è corrotta!',
- 'reset_session_seqno' => 'Resettando ID sessione e numero di sequenza sul DC %s...',
- 'gen_perm_auth_key' => 'Generando chiave di autorizzazione permanente per il DC %s...',
- 'gen_temp_auth_key' => 'Generando chiave di autorizzazione temporanea per il DC %s...',
- 'copy_auth_dcs' => 'Copiando autorizzazione dal DC %s al DC %s...',
- 'write_client_info' => 'Scrittura info sul client (eseguendo nel contempo il metodo %s)...',
- 'config_updated' => 'La configurazione è stata aggiornata!',
- 'length_not_4' => 'La lunghezza non è uguale a 4',
- 'length_not_8' => 'La lunghezza non è uguale a 8',
- 'value_bigger_than_2147483647' => 'Il valore fornito (%s) è maggiore di 2147483647',
- 'value_smaller_than_2147483648' => 'Il valore fornito (%s) è minore di -2147483648',
- 'value_bigger_than_9223372036854775807' => 'Il valore fornito (%s) è maggiore di 9223372036854775807',
+ public static $lang = [
+ 'it' => [
+ 'phpseclib_fork' => 'Per favore installa questo fork di phpseclib: https://github.com/danog/phpseclib',
+ 'inst_dc' => 'Istanziamento dei DataCenter...',
+ 'load_rsa' => 'Caricamento delle chiavi RSA...',
+ 'TL_translation' => 'Translazione degli schemi TL...',
+ 'dh_prime_check_0' => 'Esecuzione dei check dh_prime (0/3)...',
+ 'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.',
+ 'serialization_ofd' => 'La serializzazione non è aggiornata, reistanziamento dell\'oggetto in corso!',
+ 'getupdates_deserialization' => 'Ottenimento aggiornamenti dopo deserializzazione...',
+ 'shutdown_reader_pool' => 'Chiusura pool di lettura, %d thread rimasti',
+ 'threading_on' => 'IL THREADING È ABILITATO',
+ 'socket_reader' => 'Lettore socket su DC %s: ',
+ 'socket_status_1' => 'CREAZIONE',
+ 'socket_status_2' => 'INVIO',
+ 'socket_status_3' => 'ATTESA',
+ 'socket_status_4' => 'PRONTO',
+ 'socket_status_5' => 'AVVIATO',
+ 'api_not_set' => 'Devi specificare una chiave ed un ID API, ottienili su https://my.telegram.org',
+ 'session_corrupted' => 'La sessione si è corrotta!',
+ 'reset_session_seqno' => 'Resettando ID sessione e numero di sequenza sul DC %s...',
+ 'gen_perm_auth_key' => 'Generando chiave di autorizzazione permanente per il DC %s...',
+ 'gen_temp_auth_key' => 'Generando chiave di autorizzazione temporanea per il DC %s...',
+ 'copy_auth_dcs' => 'Copiando autorizzazione dal DC %s al DC %s...',
+ 'write_client_info' => 'Scrittura info sul client (eseguendo nel contempo il metodo %s)...',
+ 'config_updated' => 'La configurazione è stata aggiornata!',
+ 'length_not_4' => 'La lunghezza non è uguale a 4',
+ 'length_not_8' => 'La lunghezza non è uguale a 8',
+ 'value_bigger_than_2147483647' => 'Il valore fornito (%s) è maggiore di 2147483647',
+ 'value_smaller_than_2147483648' => 'Il valore fornito (%s) è minore di -2147483648',
+ 'value_bigger_than_9223372036854775807' => 'Il valore fornito (%s) è maggiore di 9223372036854775807',
'value_smaller_than_9223372036854775808' => 'Il valore fornito (%s) è minore di -9223372036854775808',
- 'value_bigger_than_4294967296' => 'Il valore fornito (%s) è maggiore di 4294967296',
- 'value_smaller_than_0' => 'Il valore fornito (%s) è minore di 0',
- 'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito',
- 'file_not_exist' => 'Il file specificato non esiste',
- 'deserialization_error' => 'C\'è stato un errore durante la deserializzazione',
- 'rsa_init' => 'Istanziamento di \\phpseclib\\Crypt\\RSA in corso...',
- 'loading_key' => 'Caricamento della chiave in corso...',
- 'computing_fingerprint' => 'Calcolo del fingerprint in corso...',
- 'rsa_encrypting' => 'Criptando con chiave RSA...',
- 'rpc_tg_error' => 'Telegram ha ritornato un errore RPC: %s (%s), causato da %s:%sTL trace:',
- 'v_error' => '506572206661766f726520616767696f726e612071756573746120696e7374616c6c617a696f6e65206469204d6164656c696e6550726f746f20636f6e206769742070756c6c206520636f6d706f73657220757064617465',
- 'v_tgerror' => '506572206661766f726520616767696f726e61207068702d6c69627467766f6970',
- 'no_mode_specified' => 'Nessuna modalità di logging è stata specificata!',
- 'constructor_function_uncalled' => 'Il metodo costruttore non è stato ancora chiamato! Per favore chiama il metodo costruttore prima di usare questo metodo.',
- 'proxy_class_invalid' => 'È stata specificata una classe proxy errata!',
- 'socket_con_error' => 'Connessione fallita.',
- 'protocol_not_implemented' => 'Questo protocollo non è stato ancora implementato.',
- 'protocol_invalid' => 'È stato fornito un protocollo non valido',
- 'nothing_in_socket' => 'Non c\'è niente nel socket!',
- 'wrong_length_read' => 'ATTENZIONE: Non sono stati letti abbastanza byte (dovevo leggere %s, ho letto %s)!',
- 'no_data_in_socket' => 'Non ci sono dati nel socket!',
- 'dc_con_start' => 'Connessione al DC %s in corso...',
- 'dc_con_stop' => 'Disconnessione dal DC %s in corso...',
- 'dc_con_test_start' => 'Connessione al DC %s (server %s, %s, %s)...',
- 'script_not_exist' => 'Lo script fornito non esiste',
- 'apifactory_start' => 'Sto avviando la fabbrica di API...',
- 'madelineproto_ready' => 'MadelineProto è pronto!',
- 'logout_error' => 'C\'è stato un errore durante il logout!',
- 'logout_ok' => 'Il logout è stato eseguito correttamente!',
- 'already_logged_in' => 'Questa istanza di MadelineProto è già loggata, prima faccio il logout...',
- 'login_ok' => 'Il login è stato eseguito correttamente!',
- 'login_user' => 'Sto eseguendo il login come utente normale...',
- 'login_bot' => 'Sto eseguendo il login come bot...',
- 'login_code_sending' => 'Sto inviando il codice...',
- 'login_code_sent' => 'Il codice è stato inviato correttamente! Una volta ricevuto il codice dovrai usare la funzione complete_phone_login.',
- 'login_code_uncalled' => 'Non sto aspettando il codice! Usa la funzione phone_login.',
- 'login_2fa_enabled' => 'L\'autenticazione a due fattori è abilitata, dovrai chiamare il metodo complete_2fa_login...',
- 'login_need_signup' => 'Questo numero non è registrato su telegram, dovrai chiamare la funzione complete_signup...',
- 'login_auth_key' => 'Sto facendo il login con la chiave di autorizzazione...',
- 'not_logged_in' => 'Non ho ancora fatto il login!',
- 'signup_uncalled' => 'Chiama prima le funzioni phone_login e complete_phone_login.',
- 'signing_up' => 'Mi sto registrando su telegram come utente normale...',
- 'signup_ok' => 'Mi sono registrato su Telegram!',
- '2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phone_login e complete_phone_login!',
- 'getting_dialogs' => 'Sto ottenendo la lista delle chat...',
- 'libtgvoip_required' => 'È necessario installare l\'estensione php-libtgvoip per accettare e gestire chiamate vocali, vistate https://docs.madelineproto.xyz per più info.',
- 'peer_not_in_db' => 'Questo utente/gruppo/canale non è presente nel database interno MadelineProto',
- 'calling_user' => 'Sto chiamando %s...',
- 'generating_a' => 'Sto generando a...',
- 'generating_g_a' => 'Sto generando g_a...',
- 'call_error_1' => 'Impossibile trovare ed accettare la chiamata %s',
- 'accepting_call' => 'Sto accettando una chiamata da %s...',
- 'generating_b' => 'Sto generando b...',
- 'call_already_accepted' => 'La chiamata %s è già stata accettata.',
- 'call_already_declined' => 'La chiamata %s è già stata annullata.',
- 'call_error_2' => 'Impossibile trovare e confermare la chiamata %s',
- 'call_confirming' => 'Sto confermando una chiamata da %s',
- 'call_error_3' => 'Impossibile trovare e completare la chiamata %s',
- 'call_completing' => 'Sto completando una chiamata da %s...',
- 'invalid_g_a' => 'g_a non valido!',
- 'fingerprint_invalid' => 'fingerprint della chiave non valido!',
- 'call_discarding' => 'Sto rifiutando la chiamata %s...',
- 'call_set_rating' => 'Sto inviando la recensione della chiamata %s...',
- 'call_debug_saving' => 'Sto inviando i dati di debug della chiamata %s...',
- 'TL_loading' => 'Sto caricando gli schemi TL...',
- 'file_parsing' => 'Leggendo %s...',
- 'crc32_mismatch' => 'CRC32 non valido (%s diverso da %s) per %s',
- 'src_file_invalid' => 'È stato fornito un file sorgente non valido: ',
- 'translating_obj' => 'Traducendo gli oggetti...',
- 'translating_methods' => 'Traducendo i metodi...',
- 'bool_error' => 'Non sono riuscito ad estrarre un booleano',
- 'not_numeric' => 'Il valore fornito non è numerico',
- 'long_not_16' => 'Il valore fornito non è lungo 16 byte',
- 'long_not_32' => 'Il valore fornito non è lungo 32 byte',
- 'long_not_64' => 'Il valore fornito non è lungo 64 byte',
- 'array_invalid' => 'Il valore fornito non è un array',
- 'predicate_not_set' => 'Il predicato (valore sotto chiave _, esempio [\'_\' => \'inputPeer\']) non è impostato!',
- 'type_extract_error' => 'Impossibile estrarre il tipo "%s"',
- 'method_not_found' => 'Impossibile trovare il seguente metodo: ',
- 'params_missing' => 'Non hai fornito un parametro obbligatorio, rileggi la documentazione API',
- 'sec_peer_not_in_db' => 'La chat segreta non è presente nel database interno MadelineProto',
- 'stream_handle_invalid' => 'Il valore fornito non è uno stream',
- 'length_too_big' => 'Il valore fornito è troppo lungo',
- 'deserialize_not_str' => 'Il valore generato non è una stringa',
- 'type_extract_error_id' => 'Non sono riuscito ad estrarre il tipo %s con ID %s',
- 'vector_invalid' => 'ID vettore non valido: ',
- 'constructor_not_found' => 'Costruttore non trovato per tipo: ',
- 'rand_bytes_too_small' => 'random_bytes è troppo corto!',
- 'botapi_conversion_error' => 'NOn sono risucito a convertire %s in un oggetto bot API',
- 'non_text_conversion' => 'Non posso ancora convertire messaggi media',
- 'last_byte_invalid' => 'L\'ultimo byte non è valido',
- 'file_type_invalid' => 'È stato fornito un tipo file errato',
- 'recreate_temp_auth_key' => 'Sono stato costretto a rigenerare la chiave di autorizzazione temporanea',
- 'resetting_auth_key' => 'ATTENZIONE: Sto resettando la chiave temporanea...',
- 'shutting_down_reader_pool' => 'Chisura pool di lettura',
- 'shutting_down_handler_pool' => 'Chiusura pool di gestione per DC %s, %d thread rimasti',
- 'secret_chat_skipping' => 'Non ho la chat segreta %s nel database, ignorando messaggio',
- 'fingerprint_mismatch' => 'Fingerprint della chiave non valido',
- 'msg_data_length_too_big' => 'message_data_length è troppo grande',
- 'length_not_divisible_16' => 'La lunghezza dei dati decifrati non è divisibile per 16',
- 'msg_key_mismatch' => 'msg_key non valido',
- 'rand_bytes_too_short' => 'random_bytes è troppo corto!',
- 'resending_unsupported' => 'IL riinvio di messaggi non è ancora supportato',
- 'unrecognized_dec_msg' => 'È stato ricevuto un messaggio decifrato sconosciuto: ',
- 'serializing_madelineproto' => 'Sto serializzando MadelineProto...',
- 'req_pq' => 'Sto richiedendo pq...',
- 'done' => 'Fatto!',
- 'cdn_reupload' => 'Il file non è disponibile sul nostro CDN, richiedo la copia!',
- 'stored_on_cdn' => 'Il file è scaricabile tramite CDN!',
- ),
- 'en' =>
- array (
- 'req_pq' => 'Requesting pq...',
- 'done' => 'Done!',
- 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
- 'stored_on_cdn' => 'File is stored on CDN!',
- 'serializing_madelineproto' => 'Serializing MadelineProto...',
- 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
- 'inst_dc' => 'Istantiating DataCenter...',
- 'load_rsa' => 'Loading RSA keys...',
- 'TL_translation' => 'Translating TL schemas...',
- 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
- 'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
- 'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
- 'getupdates_deserialization' => 'Getting updates after deserialization...',
- 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
- 'threading_on' => 'THREADING IS ENABLED',
- 'socket_reader' => 'Socket reader on DC %s: ',
- 'socket_status_1' => 'CREATING',
- 'socket_status_2' => 'SUBMITTING',
- 'socket_status_3' => 'WAITING',
- 'socket_status_4' => 'READY',
- 'socket_status_5' => 'WORKING',
- 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
- 'session_corrupted' => 'The session is corrupted!',
- 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
- 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
- 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
- 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
- 'write_client_info' => 'Writing client info (also executing %s)...',
- 'config_updated' => 'Updated config!',
- 'length_not_4' => 'Length is not equal to 4',
- 'length_not_8' => 'Length is not equal to 8',
- 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
- 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
- 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
- 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
- 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
- 'value_smaller_than_0' => 'Provided value %s is smaller than 0',
- 'encode_double_error' => 'Could not properly encode double',
- 'file_not_exist' => 'File does not exist',
- 'deserialization_error' => 'An error occurred on deserialization',
- 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
- 'loading_key' => 'Loading key...',
- 'computing_fingerprint' => 'Computing fingerprint...',
- 'rsa_encrypting' => 'Encrypting with rsa key...',
- 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
- 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
- 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
- 'no_mode_specified' => 'No mode was specified!',
- 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
- 'proxy_class_invalid' => 'Invalid proxy class provided!',
- 'socket_con_error' => 'Connection: couldn\'t connect to socket.',
- 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
- 'protocol_invalid' => 'Connection: invalid protocol specified.',
- 'nothing_in_socket' => 'Nothing in the socket!',
- 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
- 'no_data_in_socket' => 'No data in the socket!',
- 'dc_con_start' => 'Connecting to DC %s...',
- 'dc_con_stop' => 'Disconnecting from DC %s...',
- 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
- 'script_not_exist' => 'Provided script does not exist',
- 'apifactory_start' => 'Running APIFactory...',
- 'madelineproto_ready' => 'MadelineProto is ready!',
- 'logout_error' => 'An error occurred while logging out!',
- 'logout_ok' => 'Logged out successfully!',
- 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
- 'login_ok' => 'Logged in successfully!',
- 'login_user' => 'Logging in as a normal user...',
- 'login_bot' => 'Logging in as a bot...',
- 'login_code_sending' => 'Sending code...',
- 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
- 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
- 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
- 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
- 'login_auth_key' => 'Logging in using auth key...',
- 'not_logged_in' => 'I\'m not logged in!',
- 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
- 'signing_up' => 'Signing up as a normal user...',
- 'signup_ok' => 'Signed up in successfully!',
- '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
- 'getting_dialogs' => 'Getting dialogs...',
- 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
- 'peer_not_in_db' => 'This peer is not present in the internal peer database',
- 'calling_user' => 'Calling %s...',
- 'generating_a' => 'Generating a...',
- 'generating_g_a' => 'Generating g_a...',
- 'call_error_1' => 'Could not find and accept call %s',
- 'accepting_call' => 'Accepting call from %s...',
- 'generating_b' => 'Generating b...',
- 'call_already_accepted' => 'Call %s already accepted',
- 'call_already_declined' => 'Call %s already declined',
- 'call_error_2' => 'Could not find and confirm call %s',
- 'call_confirming' => 'Confirming call from %s...',
- 'call_error_3' => 'Could not find and complete call %s',
- 'call_completing' => 'Completing call from %s...',
- 'invalid_g_a' => 'Invalid g_a!',
- 'fingerprint_invalid' => 'Invalid key fingerprint!',
- 'call_discarding' => 'Discarding call %s...',
- 'call_set_rating' => 'Setting rating for call %s...',
- 'call_debug_saving' => 'Saving debug data for call %s...',
- 'TL_loading' => 'Loading TL schemes...',
- 'file_parsing' => 'Parsing %s...',
- 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
- 'src_file_invalid' => 'Invalid source file was provided: ',
- 'translating_obj' => 'Translating objects...',
- 'translating_methods' => 'Translating methods...',
- 'bool_error' => 'Could not extract boolean',
- 'not_numeric' => 'Given value isn\'t numeric',
- 'long_not_16' => 'Given value is not 16 bytes long',
- 'long_not_32' => 'Given value is not 32 bytes long',
- 'long_not_64' => 'Given value is not 64 bytes long',
- 'array_invalid' => 'You didn\'t provide a valid array',
- 'predicate_not_set' => 'Predicate (value under _) was not set!',
- 'type_extract_error' => 'Could not extract type "%s"',
- 'method_not_found' => 'Could not find method: ',
- 'params_missing' => 'Missing required parameter',
- 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
- 'stream_handle_invalid' => 'An invalid stream handle was provided.',
- 'length_too_big' => 'Length is too big',
- 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
- 'type_extract_error_id' => 'Could not extract type: %s with id %s',
- 'vector_invalid' => 'Invalid vector constructor: ',
- 'constructor_not_found' => 'Constructor not found for type: ',
- 'rand_bytes_too_small' => 'random_bytes is too small!',
- 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
- 'non_text_conversion' => 'Can\'t convert non text messages yet!',
- 'last_byte_invalid' => 'Invalid last byte',
- 'file_type_invalid' => 'Invalid file type detected (%s)',
- 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
- 'resetting_auth_key' => 'WARNING: Resetting auth key...',
- 'shutting_down_reader_pool' => 'Shutting down reader pool ',
- 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
- 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
- 'fingerprint_mismatch' => 'Key fingerprint mismatch',
- 'msg_data_length_too_big' => 'message_data_length is too big',
- 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
- 'msg_key_mismatch' => 'msg_key mismatch',
- 'rand_bytes_too_short' => 'random_bytes is too short!',
- 'resending_unsupported' => 'Resending of messages is not yet supported',
- 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
- 'method_req_pq' => '',
- 'method_req_pq_param_nonce' => '',
- 'method_req_pq_multi' => '',
- 'method_req_pq_multi_param_nonce' => '',
- 'method_req_DH_params' => '',
- 'method_req_DH_params_param_nonce' => '',
- 'method_req_DH_params_param_server_nonce' => '',
- 'method_req_DH_params_param_p' => '',
- 'method_req_DH_params_param_q' => '',
- 'method_req_DH_params_param_public_key_fingerprint' => '',
- 'method_req_DH_params_param_encrypted_data' => '',
- 'method_set_client_DH_params' => '',
- 'method_set_client_DH_params_param_nonce' => '',
- 'method_set_client_DH_params_param_server_nonce' => '',
- 'method_set_client_DH_params_param_encrypted_data' => '',
- 'method_rpc_drop_answer' => '',
- 'method_rpc_drop_answer_param_req_msg_id' => '',
- 'method_get_future_salts' => '',
- 'method_get_future_salts_param_num' => '',
- 'method_ping' => '',
- 'method_ping_param_ping_id' => '',
- 'method_ping_delay_disconnect' => '',
- 'method_ping_delay_disconnect_param_ping_id' => '',
+ 'value_bigger_than_4294967296' => 'Il valore fornito (%s) è maggiore di 4294967296',
+ 'value_smaller_than_0' => 'Il valore fornito (%s) è minore di 0',
+ 'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito',
+ 'file_not_exist' => 'Il file specificato non esiste',
+ 'deserialization_error' => 'C\'è stato un errore durante la deserializzazione',
+ 'rsa_init' => 'Istanziamento di \\phpseclib\\Crypt\\RSA in corso...',
+ 'loading_key' => 'Caricamento della chiave in corso...',
+ 'computing_fingerprint' => 'Calcolo del fingerprint in corso...',
+ 'rsa_encrypting' => 'Criptando con chiave RSA...',
+ 'rpc_tg_error' => 'Telegram ha ritornato un errore RPC: %s (%s), causato da %s:%sTL trace:',
+ 'v_error' => '506572206661766f726520616767696f726e612071756573746120696e7374616c6c617a696f6e65206469204d6164656c696e6550726f746f20636f6e206769742070756c6c206520636f6d706f73657220757064617465',
+ 'v_tgerror' => '506572206661766f726520616767696f726e61207068702d6c69627467766f6970',
+ 'no_mode_specified' => 'Nessuna modalità di logging è stata specificata!',
+ 'constructor_function_uncalled' => 'Il metodo costruttore non è stato ancora chiamato! Per favore chiama il metodo costruttore prima di usare questo metodo.',
+ 'proxy_class_invalid' => 'È stata specificata una classe proxy errata!',
+ 'socket_con_error' => 'Connessione fallita.',
+ 'protocol_not_implemented' => 'Questo protocollo non è stato ancora implementato.',
+ 'protocol_invalid' => 'È stato fornito un protocollo non valido',
+ 'nothing_in_socket' => 'Non c\'è niente nel socket!',
+ 'wrong_length_read' => 'ATTENZIONE: Non sono stati letti abbastanza byte (dovevo leggere %s, ho letto %s)!',
+ 'no_data_in_socket' => 'Non ci sono dati nel socket!',
+ 'dc_con_start' => 'Connessione al DC %s in corso...',
+ 'dc_con_stop' => 'Disconnessione dal DC %s in corso...',
+ 'dc_con_test_start' => 'Connessione al DC %s (server %s, %s, %s)...',
+ 'script_not_exist' => 'Lo script fornito non esiste',
+ 'apifactory_start' => 'Sto avviando la fabbrica di API...',
+ 'madelineproto_ready' => 'MadelineProto è pronto!',
+ 'logout_error' => 'C\'è stato un errore durante il logout!',
+ 'logout_ok' => 'Il logout è stato eseguito correttamente!',
+ 'already_logged_in' => 'Questa istanza di MadelineProto è già loggata, prima faccio il logout...',
+ 'login_ok' => 'Il login è stato eseguito correttamente!',
+ 'login_user' => 'Sto eseguendo il login come utente normale...',
+ 'login_bot' => 'Sto eseguendo il login come bot...',
+ 'login_code_sending' => 'Sto inviando il codice...',
+ 'login_code_sent' => 'Il codice è stato inviato correttamente! Una volta ricevuto il codice dovrai usare la funzione complete_phone_login.',
+ 'login_code_uncalled' => 'Non sto aspettando il codice! Usa la funzione phone_login.',
+ 'login_2fa_enabled' => 'L\'autenticazione a due fattori è abilitata, dovrai chiamare il metodo complete_2fa_login...',
+ 'login_need_signup' => 'Questo numero non è registrato su telegram, dovrai chiamare la funzione complete_signup...',
+ 'login_auth_key' => 'Sto facendo il login con la chiave di autorizzazione...',
+ 'not_logged_in' => 'Non ho ancora fatto il login!',
+ 'signup_uncalled' => 'Chiama prima le funzioni phone_login e complete_phone_login.',
+ 'signing_up' => 'Mi sto registrando su telegram come utente normale...',
+ 'signup_ok' => 'Mi sono registrato su Telegram!',
+ '2fa_uncalled' => 'Non sto aspettando la password, chiama prima le funzioni phone_login e complete_phone_login!',
+ 'getting_dialogs' => 'Sto ottenendo la lista delle chat...',
+ 'libtgvoip_required' => 'È necessario installare l\'estensione php-libtgvoip per accettare e gestire chiamate vocali, vistate https://docs.madelineproto.xyz per più info.',
+ 'peer_not_in_db' => 'Questo utente/gruppo/canale non è presente nel database interno MadelineProto',
+ 'calling_user' => 'Sto chiamando %s...',
+ 'generating_a' => 'Sto generando a...',
+ 'generating_g_a' => 'Sto generando g_a...',
+ 'call_error_1' => 'Impossibile trovare ed accettare la chiamata %s',
+ 'accepting_call' => 'Sto accettando una chiamata da %s...',
+ 'generating_b' => 'Sto generando b...',
+ 'call_already_accepted' => 'La chiamata %s è già stata accettata.',
+ 'call_already_declined' => 'La chiamata %s è già stata annullata.',
+ 'call_error_2' => 'Impossibile trovare e confermare la chiamata %s',
+ 'call_confirming' => 'Sto confermando una chiamata da %s',
+ 'call_error_3' => 'Impossibile trovare e completare la chiamata %s',
+ 'call_completing' => 'Sto completando una chiamata da %s...',
+ 'invalid_g_a' => 'g_a non valido!',
+ 'fingerprint_invalid' => 'fingerprint della chiave non valido!',
+ 'call_discarding' => 'Sto rifiutando la chiamata %s...',
+ 'call_set_rating' => 'Sto inviando la recensione della chiamata %s...',
+ 'call_debug_saving' => 'Sto inviando i dati di debug della chiamata %s...',
+ 'TL_loading' => 'Sto caricando gli schemi TL...',
+ 'file_parsing' => 'Leggendo %s...',
+ 'crc32_mismatch' => 'CRC32 non valido (%s diverso da %s) per %s',
+ 'src_file_invalid' => 'È stato fornito un file sorgente non valido: ',
+ 'translating_obj' => 'Traducendo gli oggetti...',
+ 'translating_methods' => 'Traducendo i metodi...',
+ 'bool_error' => 'Non sono riuscito ad estrarre un booleano',
+ 'not_numeric' => 'Il valore fornito non è numerico',
+ 'long_not_16' => 'Il valore fornito non è lungo 16 byte',
+ 'long_not_32' => 'Il valore fornito non è lungo 32 byte',
+ 'long_not_64' => 'Il valore fornito non è lungo 64 byte',
+ 'array_invalid' => 'Il valore fornito non è un array',
+ 'predicate_not_set' => 'Il predicato (valore sotto chiave _, esempio [\'_\' => \'inputPeer\']) non è impostato!',
+ 'type_extract_error' => 'Impossibile estrarre il tipo "%s"',
+ 'method_not_found' => 'Impossibile trovare il seguente metodo: ',
+ 'params_missing' => 'Non hai fornito un parametro obbligatorio, rileggi la documentazione API',
+ 'sec_peer_not_in_db' => 'La chat segreta non è presente nel database interno MadelineProto',
+ 'stream_handle_invalid' => 'Il valore fornito non è uno stream',
+ 'length_too_big' => 'Il valore fornito è troppo lungo',
+ 'deserialize_not_str' => 'Il valore generato non è una stringa',
+ 'type_extract_error_id' => 'Non sono riuscito ad estrarre il tipo %s con ID %s',
+ 'vector_invalid' => 'ID vettore non valido: ',
+ 'constructor_not_found' => 'Costruttore non trovato per tipo: ',
+ 'rand_bytes_too_small' => 'random_bytes è troppo corto!',
+ 'botapi_conversion_error' => 'NOn sono risucito a convertire %s in un oggetto bot API',
+ 'non_text_conversion' => 'Non posso ancora convertire messaggi media',
+ 'last_byte_invalid' => 'L\'ultimo byte non è valido',
+ 'file_type_invalid' => 'È stato fornito un tipo file errato',
+ 'recreate_temp_auth_key' => 'Sono stato costretto a rigenerare la chiave di autorizzazione temporanea',
+ 'resetting_auth_key' => 'ATTENZIONE: Sto resettando la chiave temporanea...',
+ 'shutting_down_reader_pool' => 'Chisura pool di lettura',
+ 'shutting_down_handler_pool' => 'Chiusura pool di gestione per DC %s, %d thread rimasti',
+ 'secret_chat_skipping' => 'Non ho la chat segreta %s nel database, ignorando messaggio',
+ 'fingerprint_mismatch' => 'Fingerprint della chiave non valido',
+ 'msg_data_length_too_big' => 'message_data_length è troppo grande',
+ 'length_not_divisible_16' => 'La lunghezza dei dati decifrati non è divisibile per 16',
+ 'msg_key_mismatch' => 'msg_key non valido',
+ 'rand_bytes_too_short' => 'random_bytes è troppo corto!',
+ 'resending_unsupported' => 'IL riinvio di messaggi non è ancora supportato',
+ 'unrecognized_dec_msg' => 'È stato ricevuto un messaggio decifrato sconosciuto: ',
+ 'serializing_madelineproto' => 'Sto serializzando MadelineProto...',
+ 'req_pq' => 'Sto richiedendo pq...',
+ 'done' => 'Fatto!',
+ 'cdn_reupload' => 'Il file non è disponibile sul nostro CDN, richiedo la copia!',
+ 'stored_on_cdn' => 'Il file è scaricabile tramite CDN!',
+ ],
+ 'en' => [
+ 'req_pq' => 'Requesting pq...',
+ 'done' => 'Done!',
+ 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
+ 'stored_on_cdn' => 'File is stored on CDN!',
+ 'serializing_madelineproto' => 'Serializing MadelineProto...',
+ 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
+ 'inst_dc' => 'Istantiating DataCenter...',
+ 'load_rsa' => 'Loading RSA keys...',
+ 'TL_translation' => 'Translating TL schemas...',
+ 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
+ 'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
+ 'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
+ 'getupdates_deserialization' => 'Getting updates after deserialization...',
+ 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
+ 'threading_on' => 'THREADING IS ENABLED',
+ 'socket_reader' => 'Socket reader on DC %s: ',
+ 'socket_status_1' => 'CREATING',
+ 'socket_status_2' => 'SUBMITTING',
+ 'socket_status_3' => 'WAITING',
+ 'socket_status_4' => 'READY',
+ 'socket_status_5' => 'WORKING',
+ 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
+ 'session_corrupted' => 'The session is corrupted!',
+ 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
+ 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
+ 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
+ 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
+ 'write_client_info' => 'Writing client info (also executing %s)...',
+ 'config_updated' => 'Updated config!',
+ 'length_not_4' => 'Length is not equal to 4',
+ 'length_not_8' => 'Length is not equal to 8',
+ 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
+ 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
+ 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
+ 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
+ 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
+ 'value_smaller_than_0' => 'Provided value %s is smaller than 0',
+ 'encode_double_error' => 'Could not properly encode double',
+ 'file_not_exist' => 'File does not exist',
+ 'deserialization_error' => 'An error occurred on deserialization',
+ 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
+ 'loading_key' => 'Loading key...',
+ 'computing_fingerprint' => 'Computing fingerprint...',
+ 'rsa_encrypting' => 'Encrypting with rsa key...',
+ 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
+ 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
+ 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
+ 'no_mode_specified' => 'No mode was specified!',
+ 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
+ 'proxy_class_invalid' => 'Invalid proxy class provided!',
+ 'socket_con_error' => 'Connection: couldn\'t connect to socket.',
+ 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
+ 'protocol_invalid' => 'Connection: invalid protocol specified.',
+ 'nothing_in_socket' => 'Nothing in the socket!',
+ 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
+ 'no_data_in_socket' => 'No data in the socket!',
+ 'dc_con_start' => 'Connecting to DC %s...',
+ 'dc_con_stop' => 'Disconnecting from DC %s...',
+ 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
+ 'script_not_exist' => 'Provided script does not exist',
+ 'apifactory_start' => 'Running APIFactory...',
+ 'madelineproto_ready' => 'MadelineProto is ready!',
+ 'logout_error' => 'An error occurred while logging out!',
+ 'logout_ok' => 'Logged out successfully!',
+ 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
+ 'login_ok' => 'Logged in successfully!',
+ 'login_user' => 'Logging in as a normal user...',
+ 'login_bot' => 'Logging in as a bot...',
+ 'login_code_sending' => 'Sending code...',
+ 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
+ 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
+ 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
+ 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
+ 'login_auth_key' => 'Logging in using auth key...',
+ 'not_logged_in' => 'I\'m not logged in!',
+ 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
+ 'signing_up' => 'Signing up as a normal user...',
+ 'signup_ok' => 'Signed up in successfully!',
+ '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
+ 'getting_dialogs' => 'Getting dialogs...',
+ 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
+ 'peer_not_in_db' => 'This peer is not present in the internal peer database',
+ 'calling_user' => 'Calling %s...',
+ 'generating_a' => 'Generating a...',
+ 'generating_g_a' => 'Generating g_a...',
+ 'call_error_1' => 'Could not find and accept call %s',
+ 'accepting_call' => 'Accepting call from %s...',
+ 'generating_b' => 'Generating b...',
+ 'call_already_accepted' => 'Call %s already accepted',
+ 'call_already_declined' => 'Call %s already declined',
+ 'call_error_2' => 'Could not find and confirm call %s',
+ 'call_confirming' => 'Confirming call from %s...',
+ 'call_error_3' => 'Could not find and complete call %s',
+ 'call_completing' => 'Completing call from %s...',
+ 'invalid_g_a' => 'Invalid g_a!',
+ 'fingerprint_invalid' => 'Invalid key fingerprint!',
+ 'call_discarding' => 'Discarding call %s...',
+ 'call_set_rating' => 'Setting rating for call %s...',
+ 'call_debug_saving' => 'Saving debug data for call %s...',
+ 'TL_loading' => 'Loading TL schemes...',
+ 'file_parsing' => 'Parsing %s...',
+ 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
+ 'src_file_invalid' => 'Invalid source file was provided: ',
+ 'translating_obj' => 'Translating objects...',
+ 'translating_methods' => 'Translating methods...',
+ 'bool_error' => 'Could not extract boolean',
+ 'not_numeric' => 'Given value isn\'t numeric',
+ 'long_not_16' => 'Given value is not 16 bytes long',
+ 'long_not_32' => 'Given value is not 32 bytes long',
+ 'long_not_64' => 'Given value is not 64 bytes long',
+ 'array_invalid' => 'You didn\'t provide a valid array',
+ 'predicate_not_set' => 'Predicate (value under _) was not set!',
+ 'type_extract_error' => 'Could not extract type "%s"',
+ 'method_not_found' => 'Could not find method: ',
+ 'params_missing' => 'Missing required parameter',
+ 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
+ 'stream_handle_invalid' => 'An invalid stream handle was provided.',
+ 'length_too_big' => 'Length is too big',
+ 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
+ 'type_extract_error_id' => 'Could not extract type: %s with id %s',
+ 'vector_invalid' => 'Invalid vector constructor: ',
+ 'constructor_not_found' => 'Constructor not found for type: ',
+ 'rand_bytes_too_small' => 'random_bytes is too small!',
+ 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
+ 'non_text_conversion' => 'Can\'t convert non text messages yet!',
+ 'last_byte_invalid' => 'Invalid last byte',
+ 'file_type_invalid' => 'Invalid file type detected (%s)',
+ 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
+ 'resetting_auth_key' => 'WARNING: Resetting auth key...',
+ 'shutting_down_reader_pool' => 'Shutting down reader pool ',
+ 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
+ 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
+ 'fingerprint_mismatch' => 'Key fingerprint mismatch',
+ 'msg_data_length_too_big' => 'message_data_length is too big',
+ 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
+ 'msg_key_mismatch' => 'msg_key mismatch',
+ 'rand_bytes_too_short' => 'random_bytes is too short!',
+ 'resending_unsupported' => 'Resending of messages is not yet supported',
+ 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
+ 'method_req_pq' => '',
+ 'method_req_pq_param_nonce' => '',
+ 'method_req_pq_multi' => '',
+ 'method_req_pq_multi_param_nonce' => '',
+ 'method_req_DH_params' => '',
+ 'method_req_DH_params_param_nonce' => '',
+ 'method_req_DH_params_param_server_nonce' => '',
+ 'method_req_DH_params_param_p' => '',
+ 'method_req_DH_params_param_q' => '',
+ 'method_req_DH_params_param_public_key_fingerprint' => '',
+ 'method_req_DH_params_param_encrypted_data' => '',
+ 'method_set_client_DH_params' => '',
+ 'method_set_client_DH_params_param_nonce' => '',
+ 'method_set_client_DH_params_param_server_nonce' => '',
+ 'method_set_client_DH_params_param_encrypted_data' => '',
+ 'method_rpc_drop_answer' => '',
+ 'method_rpc_drop_answer_param_req_msg_id' => '',
+ 'method_get_future_salts' => '',
+ 'method_get_future_salts_param_num' => '',
+ 'method_ping' => '',
+ 'method_ping_param_ping_id' => '',
+ 'method_ping_delay_disconnect' => '',
+ 'method_ping_delay_disconnect_param_ping_id' => '',
'method_ping_delay_disconnect_param_disconnect_delay' => '',
- 'method_destroy_session' => '',
- 'method_destroy_session_param_session_id' => '',
- 'method_http_wait' => '',
- 'method_http_wait_param_max_delay' => '',
- 'method_http_wait_param_wait_after' => '',
- 'method_http_wait_param_max_wait' => '',
- ),
-);
-
+ 'method_destroy_session' => '',
+ 'method_destroy_session_param_session_id' => '',
+ 'method_http_wait' => '',
+ 'method_http_wait_param_max_delay' => '',
+ 'method_http_wait_param_wait_after' => '',
+ 'method_http_wait_param_max_wait' => '',
+ ],
+];
+
// THIS WILL BE OVERWRITTEN BY $lang["en"]
- public static $current_lang = array (
- 'req_pq' => 'Requesting pq...',
- 'done' => 'Done!',
- 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
- 'stored_on_cdn' => 'File is stored on CDN!',
- 'serializing_madelineproto' => 'Serializing MadelineProto...',
- 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
- 'inst_dc' => 'Istantiating DataCenter...',
- 'load_rsa' => 'Loading RSA keys...',
- 'TL_translation' => 'Translating TL schemas...',
- 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
- 'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
- 'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
- 'getupdates_deserialization' => 'Getting updates after deserialization...',
- 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
- 'threading_on' => 'THREADING IS ENABLED',
- 'socket_reader' => 'Socket reader on DC %s: ',
- 'socket_status_1' => 'CREATING',
- 'socket_status_2' => 'SUBMITTING',
- 'socket_status_3' => 'WAITING',
- 'socket_status_4' => 'READY',
- 'socket_status_5' => 'WORKING',
- 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
- 'session_corrupted' => 'The session is corrupted!',
- 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
- 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
- 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
- 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
- 'write_client_info' => 'Writing client info (also executing %s)...',
- 'config_updated' => 'Updated config!',
- 'length_not_4' => 'Length is not equal to 4',
- 'length_not_8' => 'Length is not equal to 8',
- 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
- 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
- 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
- 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
- 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
- 'value_smaller_than_0' => 'Provided value %s is smaller than 0',
- 'encode_double_error' => 'Could not properly encode double',
- 'file_not_exist' => 'File does not exist',
- 'deserialization_error' => 'An error occurred on deserialization',
- 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
- 'loading_key' => 'Loading key...',
- 'computing_fingerprint' => 'Computing fingerprint...',
- 'rsa_encrypting' => 'Encrypting with rsa key...',
- 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
- 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
- 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
- 'no_mode_specified' => 'No mode was specified!',
- 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
- 'proxy_class_invalid' => 'Invalid proxy class provided!',
- 'socket_con_error' => 'Connection: couldn\'t connect to socket.',
- 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
- 'protocol_invalid' => 'Connection: invalid protocol specified.',
- 'nothing_in_socket' => 'Nothing in the socket!',
- 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
- 'no_data_in_socket' => 'No data in the socket!',
- 'dc_con_start' => 'Connecting to DC %s...',
- 'dc_con_stop' => 'Disconnecting from DC %s...',
- 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
- 'script_not_exist' => 'Provided script does not exist',
- 'apifactory_start' => 'Running APIFactory...',
- 'madelineproto_ready' => 'MadelineProto is ready!',
- 'logout_error' => 'An error occurred while logging out!',
- 'logout_ok' => 'Logged out successfully!',
- 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
- 'login_ok' => 'Logged in successfully!',
- 'login_user' => 'Logging in as a normal user...',
- 'login_bot' => 'Logging in as a bot...',
- 'login_code_sending' => 'Sending code...',
- 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
- 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
- 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
- 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
- 'login_auth_key' => 'Logging in using auth key...',
- 'not_logged_in' => 'I\'m not logged in!',
- 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
- 'signing_up' => 'Signing up as a normal user...',
- 'signup_ok' => 'Signed up in successfully!',
- '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
- 'getting_dialogs' => 'Getting dialogs...',
- 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
- 'peer_not_in_db' => 'This peer is not present in the internal peer database',
- 'calling_user' => 'Calling %s...',
- 'generating_a' => 'Generating a...',
- 'generating_g_a' => 'Generating g_a...',
- 'call_error_1' => 'Could not find and accept call %s',
- 'accepting_call' => 'Accepting call from %s...',
- 'generating_b' => 'Generating b...',
- 'call_already_accepted' => 'Call %s already accepted',
- 'call_already_declined' => 'Call %s already declined',
- 'call_error_2' => 'Could not find and confirm call %s',
- 'call_confirming' => 'Confirming call from %s...',
- 'call_error_3' => 'Could not find and complete call %s',
- 'call_completing' => 'Completing call from %s...',
- 'invalid_g_a' => 'Invalid g_a!',
- 'fingerprint_invalid' => 'Invalid key fingerprint!',
- 'call_discarding' => 'Discarding call %s...',
- 'call_set_rating' => 'Setting rating for call %s...',
- 'call_debug_saving' => 'Saving debug data for call %s...',
- 'TL_loading' => 'Loading TL schemes...',
- 'file_parsing' => 'Parsing %s...',
- 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
- 'src_file_invalid' => 'Invalid source file was provided: ',
- 'translating_obj' => 'Translating objects...',
- 'translating_methods' => 'Translating methods...',
- 'bool_error' => 'Could not extract boolean',
- 'not_numeric' => 'Given value isn\'t numeric',
- 'long_not_16' => 'Given value is not 16 bytes long',
- 'long_not_32' => 'Given value is not 32 bytes long',
- 'long_not_64' => 'Given value is not 64 bytes long',
- 'array_invalid' => 'You didn\'t provide a valid array',
- 'predicate_not_set' => 'Predicate (value under _) was not set!',
- 'type_extract_error' => 'Could not extract type "%s"',
- 'method_not_found' => 'Could not find method: ',
- 'params_missing' => 'Missing required parameter',
- 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
- 'stream_handle_invalid' => 'An invalid stream handle was provided.',
- 'length_too_big' => 'Length is too big',
- 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
- 'type_extract_error_id' => 'Could not extract type: %s with id %s',
- 'vector_invalid' => 'Invalid vector constructor: ',
- 'constructor_not_found' => 'Constructor not found for type: ',
- 'rand_bytes_too_small' => 'random_bytes is too small!',
- 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
- 'non_text_conversion' => 'Can\'t convert non text messages yet!',
- 'last_byte_invalid' => 'Invalid last byte',
- 'file_type_invalid' => 'Invalid file type detected (%s)',
- 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
- 'resetting_auth_key' => 'WARNING: Resetting auth key...',
- 'shutting_down_reader_pool' => 'Shutting down reader pool ',
- 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
- 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
- 'fingerprint_mismatch' => 'Key fingerprint mismatch',
- 'msg_data_length_too_big' => 'message_data_length is too big',
- 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
- 'msg_key_mismatch' => 'msg_key mismatch',
- 'rand_bytes_too_short' => 'random_bytes is too short!',
- 'resending_unsupported' => 'Resending of messages is not yet supported',
- 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
- 'method_req_pq' => '',
- 'method_req_pq_param_nonce' => '',
- 'method_req_pq_multi' => '',
- 'method_req_pq_multi_param_nonce' => '',
- 'method_req_DH_params' => '',
- 'method_req_DH_params_param_nonce' => '',
- 'method_req_DH_params_param_server_nonce' => '',
- 'method_req_DH_params_param_p' => '',
- 'method_req_DH_params_param_q' => '',
- 'method_req_DH_params_param_public_key_fingerprint' => '',
- 'method_req_DH_params_param_encrypted_data' => '',
- 'method_set_client_DH_params' => '',
- 'method_set_client_DH_params_param_nonce' => '',
- 'method_set_client_DH_params_param_server_nonce' => '',
- 'method_set_client_DH_params_param_encrypted_data' => '',
- 'method_rpc_drop_answer' => '',
- 'method_rpc_drop_answer_param_req_msg_id' => '',
- 'method_get_future_salts' => '',
- 'method_get_future_salts_param_num' => '',
- 'method_ping' => '',
- 'method_ping_param_ping_id' => '',
- 'method_ping_delay_disconnect' => '',
- 'method_ping_delay_disconnect_param_ping_id' => '',
+ public static $current_lang = [
+ 'req_pq' => 'Requesting pq...',
+ 'done' => 'Done!',
+ 'cdn_reupload' => 'File is not stored on CDN, requesting reupload!',
+ 'stored_on_cdn' => 'File is stored on CDN!',
+ 'serializing_madelineproto' => 'Serializing MadelineProto...',
+ 'phpseclib_fork' => 'Please install this fork of phpseclib: https://github.com/danog/phpseclib',
+ 'inst_dc' => 'Istantiating DataCenter...',
+ 'load_rsa' => 'Loading RSA keys...',
+ 'TL_translation' => 'Translating TL schemas...',
+ 'dh_prime_check_0' => 'Executing dh_prime checks (0/3)...',
+ 'nearest_dc' => 'We\'re in %s, nearest DC is %d.',
+ 'serialization_ofd' => 'Serialization is out of date, reconstructing object!',
+ 'getupdates_deserialization' => 'Getting updates after deserialization...',
+ 'shutdown_reader_pool' => 'Shutting down reader pool, %d jobs left',
+ 'threading_on' => 'THREADING IS ENABLED',
+ 'socket_reader' => 'Socket reader on DC %s: ',
+ 'socket_status_1' => 'CREATING',
+ 'socket_status_2' => 'SUBMITTING',
+ 'socket_status_3' => 'WAITING',
+ 'socket_status_4' => 'READY',
+ 'socket_status_5' => 'WORKING',
+ 'api_not_set' => 'You must provide an api key and an api id, get your own @ my.telegram.org',
+ 'session_corrupted' => 'The session is corrupted!',
+ 'reset_session_seqno' => 'Resetting session id and seq_no in DC %s...',
+ 'gen_perm_auth_key' => 'Generating permanent authorization key for DC %s...',
+ 'gen_temp_auth_key' => 'Generating temporary authorization key for DC %s...',
+ 'copy_auth_dcs' => 'Copying authorization from DC %s to DC %s...',
+ 'write_client_info' => 'Writing client info (also executing %s)...',
+ 'config_updated' => 'Updated config!',
+ 'length_not_4' => 'Length is not equal to 4',
+ 'length_not_8' => 'Length is not equal to 8',
+ 'value_bigger_than_2147483647' => 'Provided value %s is bigger than 2147483647',
+ 'value_smaller_than_2147483648' => 'Provided value %s is smaller than -2147483648',
+ 'value_bigger_than_9223372036854775807' => 'Provided value %s is bigger than 9223372036854775807',
+ 'value_smaller_than_9223372036854775808' => 'Provided value %s is smaller than -9223372036854775808',
+ 'value_bigger_than_4294967296' => 'Provided value %s is bigger than 4294967296',
+ 'value_smaller_than_0' => 'Provided value %s is smaller than 0',
+ 'encode_double_error' => 'Could not properly encode double',
+ 'file_not_exist' => 'File does not exist',
+ 'deserialization_error' => 'An error occurred on deserialization',
+ 'rsa_init' => 'Istantiating \\phpseclib\\Crypt\\RSA...',
+ 'loading_key' => 'Loading key...',
+ 'computing_fingerprint' => 'Computing fingerprint...',
+ 'rsa_encrypting' => 'Encrypting with rsa key...',
+ 'rpc_tg_error' => 'Telegram returned an RPC error: %s (%s), caused by %s:%sTL trace:',
+ 'v_error' => '506c656173652075706461746520746f20746865206c61746573742076657273696f6e206f66204d6164656c696e6550726f746f2e',
+ 'v_tgerror' => '506c6561736520757064617465207068702d6c69627467766f6970',
+ 'no_mode_specified' => 'No mode was specified!',
+ 'constructor_function_uncalled' => 'The constructor function wasn\'t called! Please call the constructor function before using this method.',
+ 'proxy_class_invalid' => 'Invalid proxy class provided!',
+ 'socket_con_error' => 'Connection: couldn\'t connect to socket.',
+ 'protocol_not_implemented' => 'Connection: This protocol isn\'t implemented yet.',
+ 'protocol_invalid' => 'Connection: invalid protocol specified.',
+ 'nothing_in_socket' => 'Nothing in the socket!',
+ 'wrong_length_read' => 'WARNING: Wrong length was read (should\'ve read %s, read %s)!',
+ 'no_data_in_socket' => 'No data in the socket!',
+ 'dc_con_start' => 'Connecting to DC %s...',
+ 'dc_con_stop' => 'Disconnecting from DC %s...',
+ 'dc_con_test_start' => 'Connecting to DC %s (%s server, %s, %s)...',
+ 'script_not_exist' => 'Provided script does not exist',
+ 'apifactory_start' => 'Running APIFactory...',
+ 'madelineproto_ready' => 'MadelineProto is ready!',
+ 'logout_error' => 'An error occurred while logging out!',
+ 'logout_ok' => 'Logged out successfully!',
+ 'already_logged_in' => 'This instance of MadelineProto is already logged in. Logging out first...',
+ 'login_ok' => 'Logged in successfully!',
+ 'login_user' => 'Logging in as a normal user...',
+ 'login_bot' => 'Logging in as a bot...',
+ 'login_code_sending' => 'Sending code...',
+ 'login_code_sent' => 'Code sent successfully! Once you receive the code you should use the complete_phone_login function.',
+ 'login_code_uncalled' => 'I\'m not waiting for the code! Please call the phone_login method first',
+ 'login_2fa_enabled' => '2FA enabled, you will have to call the complete_2fa_login function...',
+ 'login_need_signup' => 'An account has not been created for this number, you will have to call the complete_signup function...',
+ 'login_auth_key' => 'Logging in using auth key...',
+ 'not_logged_in' => 'I\'m not logged in!',
+ 'signup_uncalled' => 'I\'m not waiting to signup! Please call the phone_login and the complete_phone_login methods first!',
+ 'signing_up' => 'Signing up as a normal user...',
+ 'signup_ok' => 'Signed up in successfully!',
+ '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phone_login and the complete_phone_login methods first!',
+ 'getting_dialogs' => 'Getting dialogs...',
+ 'libtgvoip_required' => 'The php-libtgvoip extension is required to accept and manage calls. See daniil.it/MadelineProto for more info.',
+ 'peer_not_in_db' => 'This peer is not present in the internal peer database',
+ 'calling_user' => 'Calling %s...',
+ 'generating_a' => 'Generating a...',
+ 'generating_g_a' => 'Generating g_a...',
+ 'call_error_1' => 'Could not find and accept call %s',
+ 'accepting_call' => 'Accepting call from %s...',
+ 'generating_b' => 'Generating b...',
+ 'call_already_accepted' => 'Call %s already accepted',
+ 'call_already_declined' => 'Call %s already declined',
+ 'call_error_2' => 'Could not find and confirm call %s',
+ 'call_confirming' => 'Confirming call from %s...',
+ 'call_error_3' => 'Could not find and complete call %s',
+ 'call_completing' => 'Completing call from %s...',
+ 'invalid_g_a' => 'Invalid g_a!',
+ 'fingerprint_invalid' => 'Invalid key fingerprint!',
+ 'call_discarding' => 'Discarding call %s...',
+ 'call_set_rating' => 'Setting rating for call %s...',
+ 'call_debug_saving' => 'Saving debug data for call %s...',
+ 'TL_loading' => 'Loading TL schemes...',
+ 'file_parsing' => 'Parsing %s...',
+ 'crc32_mismatch' => 'CRC32 mismatch (%s, %s) for %s',
+ 'src_file_invalid' => 'Invalid source file was provided: ',
+ 'translating_obj' => 'Translating objects...',
+ 'translating_methods' => 'Translating methods...',
+ 'bool_error' => 'Could not extract boolean',
+ 'not_numeric' => 'Given value isn\'t numeric',
+ 'long_not_16' => 'Given value is not 16 bytes long',
+ 'long_not_32' => 'Given value is not 32 bytes long',
+ 'long_not_64' => 'Given value is not 64 bytes long',
+ 'array_invalid' => 'You didn\'t provide a valid array',
+ 'predicate_not_set' => 'Predicate (value under _) was not set!',
+ 'type_extract_error' => 'Could not extract type "%s"',
+ 'method_not_found' => 'Could not find method: ',
+ 'params_missing' => 'Missing required parameter',
+ 'sec_peer_not_in_db' => 'This secret peer is not present in the internal peer database',
+ 'stream_handle_invalid' => 'An invalid stream handle was provided.',
+ 'length_too_big' => 'Length is too big',
+ 'deserialize_not_str' => 'Deserialize: Generated value isn\'t a string',
+ 'type_extract_error_id' => 'Could not extract type: %s with id %s',
+ 'vector_invalid' => 'Invalid vector constructor: ',
+ 'constructor_not_found' => 'Constructor not found for type: ',
+ 'rand_bytes_too_small' => 'random_bytes is too small!',
+ 'botapi_conversion_error' => 'Can\'t convert %s to a bot API object',
+ 'non_text_conversion' => 'Can\'t convert non text messages yet!',
+ 'last_byte_invalid' => 'Invalid last byte',
+ 'file_type_invalid' => 'Invalid file type detected (%s)',
+ 'recreate_temp_auth_key' => 'I had to recreate the temporary authorization key',
+ 'resetting_auth_key' => 'WARNING: Resetting auth key...',
+ 'shutting_down_reader_pool' => 'Shutting down reader pool ',
+ 'shutting_down_handler_pool' => 'Shutting down handler pool for dc %s, %d jobs left',
+ 'secret_chat_skipping' => 'I do not have the secret chat %s in the database, skipping message...',
+ 'fingerprint_mismatch' => 'Key fingerprint mismatch',
+ 'msg_data_length_too_big' => 'message_data_length is too big',
+ 'length_not_divisible_16' => 'Length of decrypted data is not divisible by 16',
+ 'msg_key_mismatch' => 'msg_key mismatch',
+ 'rand_bytes_too_short' => 'random_bytes is too short!',
+ 'resending_unsupported' => 'Resending of messages is not yet supported',
+ 'unrecognized_dec_msg' => 'Unrecognized decrypted message received: ',
+ 'method_req_pq' => '',
+ 'method_req_pq_param_nonce' => '',
+ 'method_req_pq_multi' => '',
+ 'method_req_pq_multi_param_nonce' => '',
+ 'method_req_DH_params' => '',
+ 'method_req_DH_params_param_nonce' => '',
+ 'method_req_DH_params_param_server_nonce' => '',
+ 'method_req_DH_params_param_p' => '',
+ 'method_req_DH_params_param_q' => '',
+ 'method_req_DH_params_param_public_key_fingerprint' => '',
+ 'method_req_DH_params_param_encrypted_data' => '',
+ 'method_set_client_DH_params' => '',
+ 'method_set_client_DH_params_param_nonce' => '',
+ 'method_set_client_DH_params_param_server_nonce' => '',
+ 'method_set_client_DH_params_param_encrypted_data' => '',
+ 'method_rpc_drop_answer' => '',
+ 'method_rpc_drop_answer_param_req_msg_id' => '',
+ 'method_get_future_salts' => '',
+ 'method_get_future_salts_param_num' => '',
+ 'method_ping' => '',
+ 'method_ping_param_ping_id' => '',
+ 'method_ping_delay_disconnect' => '',
+ 'method_ping_delay_disconnect_param_ping_id' => '',
'method_ping_delay_disconnect_param_disconnect_delay' => '',
- 'method_destroy_session' => '',
- 'method_destroy_session_param_session_id' => '',
- 'method_http_wait' => '',
- 'method_http_wait_param_max_delay' => '',
- 'method_http_wait_param_wait_after' => '',
- 'method_http_wait_param_max_wait' => '',
-);
-}
\ No newline at end of file
+ 'method_destroy_session' => '',
+ 'method_destroy_session_param_session_id' => '',
+ 'method_http_wait' => '',
+ 'method_http_wait_param_max_delay' => '',
+ 'method_http_wait_param_wait_after' => '',
+ 'method_http_wait_param_max_wait' => '',
+];
+}
diff --git a/index.php b/index.php
index 3b2dbf4a..b8200e93 100644
--- a/index.php
+++ b/index.php
@@ -2,10 +2,9 @@
require 'vendor/autoload.php';
-$MadelineProto = new \danog\MadelineProto\API('session.madeline');//, ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']]);
+$MadelineProto = new \danog\MadelineProto\API('session.madeline'); //, ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e']]);
$me = $MadelineProto->start();
-
$me = $MadelineProto->get_self();
\danog\MadelineProto\Logger::log($me);
diff --git a/multiprocess_bot.php b/multiprocess_bot.php
index ec0aa5b0..b810f30f 100644
--- a/multiprocess_bot.php
+++ b/multiprocess_bot.php
@@ -12,7 +12,7 @@ If not, see .
*/
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
-/**
+/*
* Various ways to load MadelineProto
*/
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
@@ -31,6 +31,7 @@ class EventHandler extends \danog\MadelineProto\EventHandler
{
$this->onUpdateNewMessage($update);
}
+
public function onUpdateNewMessage($update)
{
if (isset($update['message']['out']) && $update['message']['out']) {
@@ -59,7 +60,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
}
}
-
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
try {
diff --git a/secret_bot.php b/secret_bot.php
index 5d1c2ecb..f018254d 100755
--- a/secret_bot.php
+++ b/secret_bot.php
@@ -12,7 +12,7 @@ If not, see .
*/
set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/MadelineProto/'));
-/**
+/*
* Various ways to load MadelineProto
*/
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
@@ -25,20 +25,23 @@ if (!file_exists(__DIR__.'/vendor/autoload.php')) {
require_once 'vendor/autoload.php';
}
-
class EventHandler extends \danog\MadelineProto\EventHandler
{
private $sent = [-440592694 => true];
- public function onUpdateNewEncryptedMessage($update) {
+
+ public function onUpdateNewEncryptedMessage($update)
+ {
try {
- if (isset($update['message']['decrypted_message']['media'])) \danog\MadelineProto\Logger::log($this->download_to_dir($update, '.'));
+ if (isset($update['message']['decrypted_message']['media'])) {
+ \danog\MadelineProto\Logger::log($this->download_to_dir($update, '.'));
+ }
if (isset($this->sent[$update['message']['chat_id']])) {
return;
}
$secret_media = [];
// Photo uploaded as document, secret chat
-
+
$inputEncryptedFile = $this->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic
$secret_media['document_photo'] = ['peer' => $update, 'file' => $inputEncryptedFile, 'message' => ['_' => 'decryptedMessage', 'ttl' => 0, 'message' => '', 'media' => ['_' => 'decryptedMessageMediaDocument', 'thumb' => file_get_contents('tests/faust.preview.jpg'), 'thumb_w' => 90, 'thumb_h' => 90, 'mime_type' => mime_content_type('tests/faust.jpg'), 'caption' => 'This file was uploaded using MadelineProto', 'key' => $inputEncryptedFile['key'], 'iv' => $inputEncryptedFile['iv'], 'file_name' => 'faust.jpg', 'size' => filesize('tests/faust.jpg'), 'attributes' => [['_' => 'documentAttributeImageSize', 'w' => 1280, 'h' => 914]]]]];
@@ -87,9 +90,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
}
}
-
-
-
if (file_exists('.env')) {
echo 'Loading .env...'.PHP_EOL;
$dotenv = new Dotenv\Dotenv(getcwd());
@@ -99,7 +99,6 @@ if (file_exists('.env')) {
echo 'Loading settings...'.PHP_EOL;
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
-
try {
$MadelineProto = new \danog\MadelineProto\API('s.madeline', $settings);
} catch (\danog\MadelineProto\Exception $e) {
@@ -109,4 +108,4 @@ try {
}
$MadelineProto->start();
$MadelineProto->setEventHandler('\EventHandler');
-$MadelineProto->loop();
\ No newline at end of file
+$MadelineProto->loop();
diff --git a/src/HttpProxy.php b/src/HttpProxy.php
index fe4073f9..459c3b31 100644
--- a/src/HttpProxy.php
+++ b/src/HttpProxy.php
@@ -10,7 +10,6 @@ You should have received a copy of the GNU General Public License along with Mad
If not, see .
*/
-
class HttpProxy implements \danog\MadelineProto\Proxy
{
private $domain;
@@ -18,7 +17,9 @@ class HttpProxy implements \danog\MadelineProto\Proxy
private $protocol;
private $extra;
private $sock;
- public function __construct($domain, $type, $protocol) {
+
+ public function __construct($domain, $type, $protocol)
+ {
if (!in_array($domain, [AF_INET, AF_INET6])) {
throw new \danog\MadelineProto\Exception('Wrong protocol family provided');
}
@@ -32,41 +33,53 @@ class HttpProxy implements \danog\MadelineProto\Proxy
$this->type = $type;
$this->protocol = $protocol;
}
- public function setExtra(array $extra = []) {
+
+ public function setExtra(array $extra = [])
+ {
$this->extra = $extra;
$name = $this->protocol === PHP_INT_MAX ? '\\FSocket' : '\\Socket';
$this->sock = new $name(strlen(@inet_pton($this->extra['address'])) !== 4 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, $this->protocol);
}
- public function setOption($level, $name, $value) {
+
+ public function setOption($level, $name, $value)
+ {
return $this->sock->setOption($level, $name, $value);
}
- public function getOption($level, $name) {
+ public function getOption($level, $name)
+ {
return $this->sock->getOption($level, $name);
}
- public function setBlocking($blocking) {
+ public function setBlocking($blocking)
+ {
return $this->sock->setBlocking($blocking);
}
- public function bind($address, $port = 0) {
+ public function bind($address, $port = 0)
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
- public function listen($backlog = 0) {
- throw new \danog\MadelineProto\Exception('Not Implemented');
- }
- public function accept() {
+ public function listen($backlog = 0)
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
-
- public function select(array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0) {
+ public function accept()
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
- public function connect($address, $port = 0) {
+
+ public function select(array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0)
+ {
+ throw new \danog\MadelineProto\Exception('Not Implemented');
+ }
+
+ public function connect($address, $port = 0)
+ {
$this->sock->connect($this->extra['address'], $this->extra['port']);
-
+
try {
if (strlen(inet_pton($address)) !== 4) {
$address = '['.$address.']';
@@ -77,12 +90,16 @@ class HttpProxy implements \danog\MadelineProto\Proxy
$response = $this->read_http_payload();
if ($response['code'] !== 200) {
\danog\MadelineProto\Logger::log(trim($response['body']));
+
throw new \danog\MadelineProto\Exception($response['description'], $response['code']);
}
\danog\MadelineProto\Logger::log('Connected to '.$address.':'.$port.' via http');
+
return true;
}
- private function http_read($length) {
+
+ private function http_read($length)
+ {
$packet = '';
while (strlen($packet) < $length) {
$packet .= $this->sock->read($length - strlen($packet));
@@ -90,8 +107,10 @@ class HttpProxy implements \danog\MadelineProto\Proxy
throw new \danog\MadelineProto\NothingInTheSocketException(\danog\MadelineProto\Lang::$current_lang['nothing_in_socket']);
}
}
+
return $packet;
}
+
public function read_http_line()
{
$line = '';
@@ -127,35 +146,43 @@ class HttpProxy implements \danog\MadelineProto\Proxy
return ['protocol' => $protocol, 'code' => $code, 'description' => $description, 'body' => $read, 'headers' => $headers];
}
-
- public function read($length, $flags = 0) {
+
+ public function read($length, $flags = 0)
+ {
$read = $this->sock->read($length, $flags);
if ($read === 0) {
throw new \danog\MadelineProto\Exception('pls reconnect');
}
+
return $read;
}
- public function write($buffer, $length = -1) {
+ public function write($buffer, $length = -1)
+ {
return $this->sock->write($buffer, $length);
}
- public function send($data, $length, $flags) {
+ public function send($data, $length, $flags)
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
- public function close() {
+ public function close()
+ {
$this->sock->close();
}
- public function getPeerName($port = true) {
+ public function getPeerName($port = true)
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
- public function getSockName($port = true) {
+ public function getSockName($port = true)
+ {
throw new \danog\MadelineProto\Exception('Not Implemented');
}
- public function getProxyHeaders() {
-
+
+ public function getProxyHeaders()
+ {
}
}
diff --git a/src/danog/MadelineProto/API.php b/src/danog/MadelineProto/API.php
index 549826f2..28a1a485 100644
--- a/src/danog/MadelineProto/API.php
+++ b/src/danog/MadelineProto/API.php
@@ -82,6 +82,7 @@ class API extends APIFactory
if (isset($unserialized->API)) {
$this->API = $unserialized->API;
$this->APIFactory();
+
return;
}
}
@@ -178,6 +179,7 @@ class API extends APIFactory
if (is_null($this->session)) {
return;
}
+
return Serialization::serialize($params, $this);
}
}
diff --git a/src/danog/MadelineProto/DocsBuilder.php b/src/danog/MadelineProto/DocsBuilder.php
index c3998c34..340c0341 100644
--- a/src/danog/MadelineProto/DocsBuilder.php
+++ b/src/danog/MadelineProto/DocsBuilder.php
@@ -572,6 +572,7 @@ Any json-encodable data.
');
\danog\MadelineProto\Logger::log('Done!', \danog\MadelineProto\Logger::NOTICE);
}
+
public $template = 'template, var_export(\danog\MadelineProto\Lang::$lang, true), var_export(\danog\MadelineProto\Lang::$lang['en'], true)));
}
-
}
}
diff --git a/src/danog/MadelineProto/DocsBuilder/Constructors.php b/src/danog/MadelineProto/DocsBuilder/Constructors.php
index 279d9bf2..25976b5d 100644
--- a/src/danog/MadelineProto/DocsBuilder/Constructors.php
+++ b/src/danog/MadelineProto/DocsBuilder/Constructors.php
@@ -130,22 +130,22 @@ trait Constructors
$ptype = 'Bool';
}
$human_ptype = $ptype;
- if (strpos($type, 'Input') === 0 && in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])&& !isset($this->settings['td'])) {
+ if (strpos($type, 'Input') === 0 && in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer']) && !isset($this->settings['td'])) {
$human_ptype = 'Username, chat ID, Update, Message or '.$ptype;
}
- if (strpos($type, 'Input') === 0 && in_array($ptype, ['InputMedia', 'InputDocument', 'InputPhoto'])&& !isset($this->settings['td'])) {
+ if (strpos($type, 'Input') === 0 && in_array($ptype, ['InputMedia', 'InputDocument', 'InputPhoto']) && !isset($this->settings['td'])) {
$human_ptype = 'MessageMedia, Message, Update or '.$ptype;
}
- if (in_array($ptype, ['InputMessage'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) {
$human_ptype = 'Message ID or '.$ptype;
}
- if (in_array($ptype, ['InputEncryptedChat'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) {
$human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype;
}
- if (in_array($ptype, ['InputFile'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) {
$human_ptype = 'File path or '.$ptype;
}
- if (in_array($ptype, ['InputEncryptedFile'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) {
$human_ptype = 'File path or '.$ptype;
}
$table .= '|'.str_replace('_', '\\_', $param['name']).'|'.(isset($param['subtype']) ? 'Array of ' : '').'['.str_replace('_', '\\_', $human_ptype).'](../'.$type_or_bare_type.'/'.$ptype.'.md) | '.(isset($param['pow']) || $this->constructors->find_by_predicate(lcfirst($param['type']).'Empty') || ($data['type'] === 'InputMedia' && $param['name'] === 'mime_type') || ($data['type'] === 'DocumentAttribute' && in_array($param['name'], ['w', 'h', 'duration'])) ? 'Optional' : 'Yes').'|';
diff --git a/src/danog/MadelineProto/DocsBuilder/Methods.php b/src/danog/MadelineProto/DocsBuilder/Methods.php
index 2ea3b30c..293cf008 100644
--- a/src/danog/MadelineProto/DocsBuilder/Methods.php
+++ b/src/danog/MadelineProto/DocsBuilder/Methods.php
@@ -73,7 +73,7 @@ trait Methods
';
if (!isset($this->td_descriptions['methods'][$data['method']])) {
$this->add_to_lang('method_'.$data['method']);
-
+
if (\danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']] !== '') {
$this->td_descriptions['methods'][$data['method']]['description'] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method']];
}
@@ -106,19 +106,19 @@ trait Methods
$ptype = 'Bool';
}
$human_ptype = 'CLICK ME '.$ptype;
- if (in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer']) && !isset($this->settings['td'])) {
$human_ptype = 'Username, chat ID, Update, Message or '.$ptype;
}
- if (in_array($ptype, ['InputMedia', 'InputPhoto', 'InputDocument'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputMedia', 'InputPhoto', 'InputDocument']) && !isset($this->settings['td'])) {
$human_ptype = 'MessageMedia, Update, Message or '.$ptype;
}
- if (in_array($ptype, ['InputMessage'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputMessage']) && !isset($this->settings['td'])) {
$human_ptype = 'Message ID or '.$ptype;
}
- if (in_array($ptype, ['InputEncryptedChat'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputEncryptedChat']) && !isset($this->settings['td'])) {
$human_ptype = 'Secret chat ID, Update, EncryptedMessage or '.$ptype;
}
- if (in_array($ptype, ['InputFile'])&& !isset($this->settings['td'])) {
+ if (in_array($ptype, ['InputFile']) && !isset($this->settings['td'])) {
$human_ptype = 'File path or '.$ptype;
}
if (in_array($ptype, ['InputEncryptedFile']) && !isset($this->settings['td'])) {
@@ -132,7 +132,7 @@ trait Methods
$this->td_descriptions['methods'][$data['method']]['params'][$param['name']] = \danog\MadelineProto\Lang::$lang['en']['method_'.$data['method'].'_param_'.$param['name'].'_type_'.$param['type']];
}
}
-
+
if (isset($this->td_descriptions['methods'][$data['method']])) {
$table .= $this->td_descriptions['methods'][$data['method']]['params'][$param['name']].'|';
}
diff --git a/src/danog/MadelineProto/EventHandler.php b/src/danog/MadelineProto/EventHandler.php
index 76ff5c2b..50b07cc0 100644
--- a/src/danog/MadelineProto/EventHandler.php
+++ b/src/danog/MadelineProto/EventHandler.php
@@ -15,12 +15,14 @@ namespace danog\MadelineProto;
class EventHandler extends APIFactory
{
- public function __construct($MadelineProto) {
+ public function __construct($MadelineProto)
+ {
$this->API = $MadelineProto;
foreach ($this->API->get_method_namespaces() as $namespace) {
$this->{$namespace} = new APIFactory($namespace, $this->API);
}
}
+
public function &__get($name)
{
if ($name === 'settings') {
diff --git a/src/danog/MadelineProto/FileCallback.php b/src/danog/MadelineProto/FileCallback.php
index a2b1e154..9d8f6fbe 100644
--- a/src/danog/MadelineProto/FileCallback.php
+++ b/src/danog/MadelineProto/FileCallback.php
@@ -17,14 +17,20 @@ class FileCallback implements FileCallbackInterface
{
private $file;
private $callback;
- public function __construct($file, $callback) {
+
+ public function __construct($file, $callback)
+ {
$this->file = $file;
$this->callback = $callback;
}
- public function getFile() {
+
+ public function getFile()
+ {
return $this->file;
}
- public function __invoke($percent) {
+
+ public function __invoke($percent)
+ {
$this->callback($percent);
}
}
diff --git a/src/danog/MadelineProto/FileCallbackInterface.php b/src/danog/MadelineProto/FileCallbackInterface.php
index 287a130f..c41dfe9e 100644
--- a/src/danog/MadelineProto/FileCallbackInterface.php
+++ b/src/danog/MadelineProto/FileCallbackInterface.php
@@ -16,5 +16,6 @@ namespace danog\MadelineProto;
interface FileCallbackInterface
{
public function getFile();
+
public function __invoke($percent);
}
diff --git a/src/danog/MadelineProto/Logger.php b/src/danog/MadelineProto/Logger.php
index 0eb0ec87..0a032a00 100644
--- a/src/danog/MadelineProto/Logger.php
+++ b/src/danog/MadelineProto/Logger.php
@@ -130,7 +130,11 @@ class Logger
}
if (!is_string($param)) {
$parame = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
- if ($parame == '') $param = var_export($param, true); else $param = $parame;
+ if ($parame == '') {
+ $param = var_export($param, true);
+ } else {
+ $param = $parame;
+ }
}
$param = str_pad(basename(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file'], '.php').$prefix.': ', 16 + strlen($prefix))."\t".$param;
/*if (self::$isatty) {
diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php
index 2b4a6a3b..d48a7235 100644
--- a/src/danog/MadelineProto/MTProto.php
+++ b/src/danog/MadelineProto/MTProto.php
@@ -60,7 +60,7 @@ class MTProto
const WAITING_SIGNUP = -1;
const WAITING_PASSWORD = 2;
const LOGGED_IN = 3;
- const DISALLOWED_METHODS = ['messages.receivedQueue' => 'You cannot use this method directly', 'messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'auth.importBotAuthorization' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.sendCode' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signIn' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)','auth.checkPassword' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signUp' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'users.getFullUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'channels.getFullChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.getFullChat' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'contacts.resolveUsername' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz for more info'];
+ const DISALLOWED_METHODS = ['messages.receivedQueue' => 'You cannot use this method directly', 'messages.getDhConfig' => 'You cannot use this method directly, instead use $MadelineProto->get_dh_config();', 'auth.bindTempAuthKey' => 'You cannot use this method directly, instead modify the PFS and default_temp_auth_key_expires_in settings, see https://docs.madelineproto.xyz/docs/SETTINGS.html for more info', 'auth.exportAuthorization' => 'You cannot use this method directly, use $MadelineProto->export_authorization() instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.importAuthorization' => 'You cannot use this method directly, use $MadelineProto->import_authorization($authorization) instead, see https://docs.madelineproto.xyz/docs/LOGIN.html', 'auth.logOut' => 'You cannot use this method directly, use the logout method instead (see https://docs.madelineproto.xyz for more info)', 'auth.importBotAuthorization' => 'You cannot use this method directly, use the bot_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.sendCode' => 'You cannot use this method directly, use the phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signIn' => 'You cannot use this method directly, use the complete_phone_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.checkPassword' => 'You cannot use this method directly, use the complete_2fa_login method instead (see https://docs.madelineproto.xyz for more info)', 'auth.signUp' => 'You cannot use this method directly, use the complete_signup method instead (see https://docs.madelineproto.xyz for more info)', 'users.getFullUser' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'channels.getFullChannel' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.getFullChat' => 'You cannot use this method directly, use the get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'contacts.resolveUsername' => 'You cannot use this method directly, use the resolve_username, get_pwr_chat, get_info, get_full_info methods instead (see https://docs.madelineproto.xyz for more info)', 'messages.acceptEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.discardEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'messages.requestEncryption' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling secret chats', 'phone.requestCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.acceptCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.confirmCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'phone.discardCall' => 'You cannot use this method directly, see https://docs.madelineproto.xyz#calls for more info on handling calls', 'updates.getChannelDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getDifference' => 'You cannot use this method directly, see https://docs.madelineproto.xyz for more info on handling updates', 'updates.getState' => 'You cannot use this method directly, see https://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz 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://docs.madelineproto.xyz for more info'];
const BAD_MSG_ERROR_CODES = [16 => 'msg_id too low (most likely, client time is wrong; it would be worthwhile to synchronize it using msg_id notifications and re-send the original message with the “correct†msg_id or wrap it in a container with a new msg_id if the original message had waited too long on the client to be transmitted)', 17 => 'msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id)', 18 => 'incorrect two lower order msg_id bits (the server expects client message msg_id to be divisible by 4)', 19 => 'container msg_id is the same as msg_id of a previously received message (this must never happen)', 20 => 'message too old, and it cannot be verified whether the server has received a message with this msg_id or not', 32 => 'msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno)', 33 => 'msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno)', 34 => 'an even msg_seqno expected (irrelevant message), but odd received', 35 => 'odd msg_seqno expected (relevant message), but even received', 48 => 'incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it)', 64 => 'invalid container.'];
const MSGS_INFO_FLAGS = [1 => 'nothing is known about the message (msg_id too low, the other party may have forgotten it)', 2 => 'message not received (msg_id falls within the range of stored identifiers; however, the other party has certainly not received a message like that)', 3 => 'message not received (msg_id too high; however, the other party has certainly not received it yet)', 4 => 'message received (note that this response is also at the same time a receipt acknowledgment)', 8 => ' and message already acknowledged', 16 => ' and message not requiring acknowledgment', 32 => ' and RPC query contained in message being processed or processing already complete', 64 => ' and content-related response to message already generated', 128 => ' and other party knows for a fact that message is already received'];
const REQUESTED = 0;
@@ -108,6 +108,7 @@ class MTProto
private $postpone_pwrchat = false;
private $pending_pwrchat = [];
private $altervista = false;
+
public function __magic_construct($settings = [])
{
// Parse settings
@@ -534,7 +535,7 @@ class MTProto
// Should I use threading, if it is enabled?
'handler_workers' => 10,
], 'upload' => [
- 'allow_automatic_upload' => true
+ 'allow_automatic_upload' => true,
], 'pwr' => [
'pwr' => false,
// Need info ?
@@ -575,7 +576,9 @@ class MTProto
break;
}
$this->settings = $settings;
- if (!$this->settings['updates']['handle_updates']) $this->updates = [];
+ if (!$this->settings['updates']['handle_updates']) {
+ $this->updates = [];
+ }
// Setup logger
$this->setup_logger();
}
@@ -713,6 +716,7 @@ class MTProto
$this->authorization = ['user' => $this->method_call('users.getUsers', ['id' => [['_' => 'inputUserSelf']]], ['datacenter' => $this->datacenter->curdc])[0]];
} catch (RPCErrorException $e) {
\danog\MadelineProto\Logger::log($e->getMessage());
+
return false;
}
diff --git a/src/danog/MadelineProto/MTProtoTools/CallHandler.php b/src/danog/MadelineProto/MTProtoTools/CallHandler.php
index 19a90290..7b6371a2 100644
--- a/src/danog/MadelineProto/MTProtoTools/CallHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/CallHandler.php
@@ -198,7 +198,9 @@ trait CallHandler
$only_updates = false;
if ($last_recv === $this->datacenter->sockets[$aargs['datacenter']]->last_recv) { // the socket is dead, resend request
$this->close_and_reopen($aargs['datacenter']);
- if ($this->altervista) continue 2;
+ if ($this->altervista) {
+ continue 2;
+ }
}
//if ($this->datacenter->sockets[$aargs['datacenter']]->last_recv < time() - 1 && $this->is_http($aargs['datacenter'])) {
// $this->close_and_reopen($aargs['datacenter']);
diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php
index b1ae43b9..12db2121 100644
--- a/src/danog/MadelineProto/MTProtoTools/Files.php
+++ b/src/danog/MadelineProto/MTProtoTools/Files.php
@@ -87,7 +87,9 @@ trait Files
{
return $this->upload($file, $file_name, $cb, true);
}
- public function gen_all_file($media) {
+
+ public function gen_all_file($media)
+ {
$res = [$this->constructors->find_by_predicate($media['_'])['type'] => $media];
switch ($media['_']) {
case 'messageMediaPhoto':
@@ -131,10 +133,12 @@ trait Files
default:
throw new \danog\MadelineProto\Exception('Could not convert media object');
}
- return $res;
+ return $res;
}
- public function get_file_info($constructor) {
+
+ public function get_file_info($constructor)
+ {
if (is_string($constructor)) {
$constructor = $this->unpack_file_id($constructor)['MessageMedia'];
}
@@ -146,8 +150,10 @@ trait Files
case 'message':
$constructor = $constructor['media'];
}
+
return $this->gen_all_file($constructor);
}
+
public function get_download_info($message_media)
{
if (is_string($message_media)) {
diff --git a/src/danog/MadelineProto/MTProtoTools/MessageHandler.php b/src/danog/MadelineProto/MTProtoTools/MessageHandler.php
index 24c71fcd..12c859da 100644
--- a/src/danog/MadelineProto/MTProtoTools/MessageHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/MessageHandler.php
@@ -41,7 +41,7 @@ trait MessageHandler
\danog\MadelineProto\Logger::log("Inside of msg_container, sending {$message['_']} as encrypted message to DC $datacenter", \danog\MadelineProto\Logger::ULTRA_VERBOSE);
$message['_'] = 'MTmessage';
$messages[] = $message;
- $this->datacenter->sockets[$datacenter]->outgoing_messages[$message['msg_id']] = ['seq_no' => $message['seqno'], 'response' => -1];//, 'content' => $this->deserialize($message['body'], ['type' => '', 'datacenter' => $datacenter])];
+ $this->datacenter->sockets[$datacenter]->outgoing_messages[$message['msg_id']] = ['seq_no' => $message['seqno'], 'response' => -1]; //, 'content' => $this->deserialize($message['body'], ['type' => '', 'datacenter' => $datacenter])];
}
$message_data = $this->serialize_object(['type' => ''], ['_' => 'msg_container', 'messages' => $messages], 'lol');
$message_id = $this->generate_message_id($datacenter);
diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
index c24ddf3b..4d5a249a 100644
--- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php
@@ -267,6 +267,7 @@ trait PeerHandler
if (!isset($this->secret_chats[$id])) {
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['sec_peer_not_in_db']);
}
+
return $this->secret_chats[$id];
case 'updateNewMessage':
case 'updateNewChannelMessage':
@@ -753,6 +754,7 @@ trait PeerHandler
if (strpos($e->rpc, 'FLOOD_WAIT_') === 0 || $e->rpc === 'AUTH_KEY_UNREGISTERED' || $e->rpc === 'USERNAME_INVALID') {
throw $e;
}
+
return false;
}
if ($res['_'] === 'contacts.resolvedPeer') {
diff --git a/src/danog/MadelineProto/MyTelegramOrgWrapper.php b/src/danog/MadelineProto/MyTelegramOrgWrapper.php
index 3a90932b..2c606a09 100644
--- a/src/danog/MadelineProto/MyTelegramOrgWrapper.php
+++ b/src/danog/MadelineProto/MyTelegramOrgWrapper.php
@@ -13,77 +13,85 @@ If not, see .
namespace danog\MadelineProto;
/**
- * Wrapper for my.telegram.org
+ * Wrapper for my.telegram.org.
*/
class MyTelegramOrgWrapper
{
private $logged = false;
- public function __construct($number) {
+
+ public function __construct($number)
+ {
if (!extension_loaded('curl')) {
throw new Exception(['extension', 'curl']);
}
$this->number = $number;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/auth/send_password");
+ curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/send_password');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["phone" => $number]));
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $number]));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
- $headers = array();
- $headers[] = "Origin: https://my.telegram.org";
- $headers[] = "Accept-Encoding: gzip, deflate, br";
- $headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
- $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
- $headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
- $headers[] = "Accept: application/json, text/javascript, */*; q=0.01";
- $headers[] = "Referer: https://my.telegram.org/auth";
- $headers[] = "X-Requested-With: XMLHttpRequest";
- $headers[] = "Connection: keep-alive";
- $headers[] = "Dnt: 1";
+ $headers = [];
+ $headers[] = 'Origin: https://my.telegram.org';
+ $headers[] = 'Accept-Encoding: gzip, deflate, br';
+ $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
+ $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
+ $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
+ $headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
+ $headers[] = 'Referer: https://my.telegram.org/auth';
+ $headers[] = 'X-Requested-With: XMLHttpRequest';
+ $headers[] = 'Connection: keep-alive';
+ $headers[] = 'Dnt: 1';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
- throw new Exception('Curl error: ' . curl_error($ch));
+ throw new Exception('Curl error: '.curl_error($ch));
}
- curl_close ($ch);
+ curl_close($ch);
$resulta = json_decode($result, true);
- if (!isset($resulta['random_hash'])) throw new Exception($result);
- $this->hash = $resulta["random_hash"];
+ if (!isset($resulta['random_hash'])) {
+ throw new Exception($result);
+ }
+ $this->hash = $resulta['random_hash'];
}
- public function complete_login($password) {
- if ($this->logged) throw new Exception('Already logged in!');
+
+ public function complete_login($password)
+ {
+ if ($this->logged) {
+ throw new Exception('Already logged in!');
+ }
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/auth/login");
+ curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/auth/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(["phone" => $this->number, "random_hash" => $this->hash, "password" => $password]));
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['phone' => $this->number, 'random_hash' => $this->hash, 'password' => $password]));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
- $headers = array();
- $headers[] = "Origin: https://my.telegram.org";
- $headers[] = "Accept-Encoding: gzip, deflate, br";
- $headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
- $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
- $headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
- $headers[] = "Accept: application/json, text/javascript, */*; q=0.01";
- $headers[] = "Referer: https://my.telegram.org/auth";
- $headers[] = "X-Requested-With: XMLHttpRequest";
- $headers[] = "Connection: keep-alive";
- $headers[] = "Dnt: 1";
+ $headers = [];
+ $headers[] = 'Origin: https://my.telegram.org';
+ $headers[] = 'Accept-Encoding: gzip, deflate, br';
+ $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
+ $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
+ $headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
+ $headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
+ $headers[] = 'Referer: https://my.telegram.org/auth';
+ $headers[] = 'X-Requested-With: XMLHttpRequest';
+ $headers[] = 'Connection: keep-alive';
+ $headers[] = 'Dnt: 1';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
+ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$result = curl_exec($ch);
if (curl_errno($ch)) {
- throw new Exception('Curl error: ' . curl_error($ch));
+ throw new Exception('Curl error: '.curl_error($ch));
}
- curl_close ($ch);
+ curl_close($ch);
list($response_headers, $response_content) = preg_split('/(\r\n){2}/', $result, 2);
switch ($response_content) {
@@ -93,146 +101,168 @@ class MyTelegramOrgWrapper
default:
throw new Exception($response_content);
}
- $this->token = explode(";", explode("stel_token=", $response_headers)[1])[0];
+ $this->token = explode(';', explode('stel_token=', $response_headers)[1])[0];
+
return $this->logged = true;
}
- public function logged_in() { return $this->logged; }
- public function has_app() {
- if (!$this->logged) throw new Exception('Not logged in!');
+
+ public function logged_in()
+ {
+ return $this->logged;
+ }
+
+ public function has_app()
+ {
+ if (!$this->logged) {
+ throw new Exception('Not logged in!');
+ }
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://my.telegram.org/apps");
+ curl_setopt($ch, CURLOPT_URL, 'https://my.telegram.org/apps');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
- $headers = array();
- $headers[] = "Dnt: 1";
- $headers[] = "Accept-Encoding: gzip, deflate, sdch, br";
- $headers[] = "Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4";
- $headers[] = "Upgrade-Insecure-Requests: 1";
- $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
- $headers[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- $headers[] = "Referer: https://my.telegram.org/";
- $headers[] = "Cookie: stel_token=".$this->token;
- $headers[] = "Connection: keep-alive";
- $headers[] = "Cache-Control: max-age=0";
+ $headers = [];
+ $headers[] = 'Dnt: 1';
+ $headers[] = 'Accept-Encoding: gzip, deflate, sdch, br';
+ $headers[] = 'Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4';
+ $headers[] = 'Upgrade-Insecure-Requests: 1';
+ $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36';
+ $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
+ $headers[] = 'Referer: https://my.telegram.org/';
+ $headers[] = 'Cookie: stel_token='.$this->token;
+ $headers[] = 'Connection: keep-alive';
+ $headers[] = 'Cache-Control: max-age=0';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
- throw new Exception('Curl error: ' . curl_error($ch));
+ throw new Exception('Curl error: '.curl_error($ch));
}
- curl_close ($ch);
+ curl_close($ch);
$title = explode('', explode('', $result)[1])[0];
switch ($title) {
case 'App configuration': return true;
- case 'Create new application': $this->creation_hash = explode('"/>', explode('', explode('App api_id: