Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-11-10 15:35:57 +00:00 committed by StyleCI Bot
parent 5d7e36b168
commit 270463679a
5 changed files with 25 additions and 18 deletions

View File

@ -237,7 +237,6 @@ class MTProto
$this->twoe2047 = new \phpseclib\Math\BigInteger('16158503035655503650357438344334975980222051334857742016065172713762327569433945446598600705761456731844358980460949009747059779575245460547544076193224141560315438683650498045875098875194826053398028819192033784138396109321309878080919047169238085235290822926018152521443787945770532904303776199561965192760957166694834171210342487393282284747428088017663161029038902829665513096354230157075129296432088558362971801859230928678799175576150822952201848806616643615613562842355410104862578550863465661734839271290328348967522998634176499319107762583194718667771801067716614802322659239302476074096777926805529798115328');
$this->twoe2048 = new \phpseclib\Math\BigInteger('32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230656');
$this->connect_to_all_dcs();
$this->datacenter->curdc = 2;
@ -521,17 +520,17 @@ class MTProto
'call_queue' => 200,
],
'peer' => [
'full_info_cache_time' => 3600, // Full peer info cache validity
'full_fetch' => false, // Should madeline fetch the full member list of every group it meets?
'full_info_cache_time' => 3600, // Full peer info cache validity
'full_fetch' => false, // Should madeline fetch the full member list of every group it meets?
'cache_all_peers_on_startup' => false, // Should madeline fetch the full chat list on startup?
],
'requests' => [
'gzip_encode_if_gt' => 500, // Should I try using gzip encoding for requests bigger than N bytes? Set to -1 to disable.
],
'updates' => [
'handle_updates' => true, // Should I handle updates?
'handle_updates' => true, // Should I handle updates?
'handle_old_updates' => true, // Should I handle old updates on startup?
'callback' => 'get_updates_update_handler', // A callable function that will be called every time an update is received, must accept an array (for the update) as the only parameter
'callback' => 'get_updates_update_handler', // A callable function that will be called every time an update is received, must accept an array (for the update) as the only parameter
],
'secret_chats' => [
'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats

View File

@ -125,20 +125,20 @@ trait CallHandler
$this->datacenter->sockets[$aargs['datacenter']]->incoming_messages[$this->datacenter->sockets[$aargs['datacenter']]->outgoing_messages[$message_id]['response']]['content'] = '';
break;
}
if (($error = $this->recv_message($aargs['datacenter'])) !== true) {
if ($error === -404) {
if ($this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key !== null) {
\danog\MadelineProto\Logger::log(['WARNING: Resetting auth key...'], \danog\MadelineProto\Logger::WARNING);
$this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key = null;
$this->init_authorization();
if (($error = $this->recv_message($aargs['datacenter'])) !== true) {
if ($error === -404) {
if ($this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key !== null) {
\danog\MadelineProto\Logger::log(['WARNING: Resetting auth key...'], \danog\MadelineProto\Logger::WARNING);
$this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key = null;
$this->init_authorization();
throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key');
}
throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key');
}
throw new \danog\MadelineProto\RPCErrorException($error, $error);
}
$only_updates = $this->handle_messages($aargs['datacenter']); // This method receives data from the socket, and parses stuff
throw new \danog\MadelineProto\RPCErrorException($error, $error);
}
$only_updates = $this->handle_messages($aargs['datacenter']); // This method receives data from the socket, and parses stuff
} catch (\danog\MadelineProto\Exception $e) {
if ($e->getMessage() === 'I had to recreate the temporary authorization key') {
continue 2;

View File

@ -30,6 +30,7 @@ trait PeerHandler
case 'user':
if (!isset($this->chats[$user['id']]) || $this->chats[$user['id']] !== $user) {
$this->chats[$user['id']] = $user;
try {
$this->get_pwr_chat($user['id'], false, true);
} catch (\danog\MadelineProto\Exception $e) {
@ -522,7 +523,9 @@ trait PeerHandler
}
$res['participants'] = array_values($res['participants']);
}
if (!$fullfetch) unset($res['participants']);
if (!$fullfetch) {
unset($res['participants']);
}
if ($fullfetch || $send) {
$this->store_db($res);
}

View File

@ -115,6 +115,7 @@ trait UpdateHandler
$updates[] = ['update_id' => $key, 'update' => $value];
}
}
return $updates;
}

View File

@ -16,15 +16,19 @@ class RPCErrorException extends \Exception
{
use TL\PrettyException;
private $fetched = false;
public function getMess() {
public function getMess()
{
if ($this->fetched === false) {
$res = json_decode(@file_get_contents('https://rpc.pwrtelegram.xyz/?method='.$additional[0].'&code='.$code.'&error='.$this->rpc), true);
if (isset($res['ok']) && $res['ok']) {
$this->message = $res['result'];
}
}
return $this->message;
}
public function __toString()
{
return sprintf(\danog\MadelineProto\Lang::$current_lang['rpc_tg_error'], $this->getMess(), $this->rpc, $this->file, $this->line.PHP_EOL.PHP_EOL).PHP_EOL.$this->getTLTrace().PHP_EOL;