Improvements to peer management

This commit is contained in:
Daniil Gentili 2018-03-12 00:29:51 +00:00
parent 40086f7da1
commit 0d2ed128ac
3 changed files with 10 additions and 2 deletions

View File

@ -159,7 +159,7 @@ class MTProto
public function __sleep()
{
return ['encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'twoe1984', 'twoe2047', 'twoe2048', 'zero', 'one', 'two', 'three', 'four', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'emojis', 'authorized_dc', 'channel_participants', 'twozerotwosixone', 'zeroeight'];
return ['encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'twoe1984', 'twoe2047', 'twoe2048', 'zero', 'one', 'two', 'three', 'four', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'emojis', 'authorized_dc', 'twozerotwosixone', 'zeroeight'];
}
public function __wakeup()

View File

@ -181,6 +181,7 @@ trait CallHandler
continue 2;
}
\danog\MadelineProto\Logger::log('An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...', \danog\MadelineProto\Logger::WARNING);
\danog\MadelineProto\Logger::log('Full trace '.$e, \danog\MadelineProto\Logger::WARNING);
continue;
} catch (\danog\MadelineProto\NothingInTheSocketException $e) {
$last_error = 'Nothing in the socket';

View File

@ -92,7 +92,13 @@ trait PeerHandler
$bot_api_id = $this->to_supergroup($chat['id']);
if (!isset($chat['access_hash'])) {
if (isset($chat['username']) && !isset($this->chats[$bot_api_id])) {
$this->get_pwr_chat($chat['username'], $this->settings['peer']['full_fetch'], true);
try {
$this->get_pwr_chat($chat['username'], $this->settings['peer']['full_fetch'], true);
} catch (\danog\MadelineProto\Exception $e) {
\danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);
} catch (\danog\MadelineProto\RPCErrorException $e) {
\danog\MadelineProto\Logger::log($e->getMessage(), \danog\MadelineProto\Logger::WARNING);
}
}
continue;
}
@ -604,6 +610,7 @@ trait PeerHandler
public function store_participants_cache($gres, $channel, $filter, $q, $offset, $limit)
{
return;
unset($gres['users']);
if (\danog\MadelineProto\Logger::$bigint) {
$hash = new \phpseclib\Math\BigInteger(0);