Applied fixes from StyleCI
This commit is contained in:
parent
66e73e20a2
commit
10d7b3b40b
@ -22,11 +22,11 @@ class CallHandler extends AuthKeyHandler
|
||||
$response = null;
|
||||
$count = 0;
|
||||
while ($response == null && $count++ < $this->settings['max_tries']['response']) {
|
||||
$this->log->log("Getting response....");
|
||||
$this->log->log('Getting response....');
|
||||
$deserialized = $this->recv_message();
|
||||
end($this->incoming_messages);
|
||||
$tempres = $this->handle_message($deserialized, $last_sent, key($this->incoming_messages));
|
||||
var_dump($this->incoming_messages);
|
||||
var_dump($this->incoming_messages);
|
||||
if (isset($this->outgoing_messages[$last_sent]['response']) && isset($this->incoming_messages[$this->outgoing_messages[$last_sent]['response']]['content'])) {
|
||||
$response = $this->incoming_messages[$this->outgoing_messages[$last_sent]['response']]['content'];
|
||||
}
|
||||
@ -49,7 +49,7 @@ var_dump($this->incoming_messages);
|
||||
foreach (range(1, $this->settings['max_tries']['query']) as $i) {
|
||||
try {
|
||||
$int_message_id = $this->send_message($this->tl->serialize_method($method, $args), $this->tl->content_related($method));
|
||||
$this->outgoing_messages[$int_message_id]['content'] = ['method' => $method, 'args' => $args ];
|
||||
$this->outgoing_messages[$int_message_id]['content'] = ['method' => $method, 'args' => $args];
|
||||
$server_answer = $this->wait_for_response($int_message_id);
|
||||
} catch (Exception $e) {
|
||||
$this->log->log('An error occurred while calling method '.$method.': '.$e->getMessage().' in '.$e->getFile().':'.$e->getLine().'. Recreating connection and retrying to call method...');
|
||||
@ -71,7 +71,7 @@ var_dump($this->incoming_messages);
|
||||
foreach (range(1, $this->settings['max_tries']['query']) as $i) {
|
||||
try {
|
||||
$int_message_id = $this->send_message($this->tl->serialize_obj($object, $args), $this->tl->content_related($object));
|
||||
$this->outgoing_messages[$int_message_id]['content'] = ['object' => $object, 'args' => $args ];
|
||||
$this->outgoing_messages[$int_message_id]['content'] = ['object' => $object, 'args' => $args];
|
||||
// $server_answer = $this->wait_for_response($int_message_id);
|
||||
} catch (Exception $e) {
|
||||
$this->log->log('An error occurred while calling object '.$object.': '.$e->getMessage().' in '.$e->getFile().':'.$e->getLine().'. Recreating connection and retrying to call object...');
|
||||
|
@ -106,6 +106,7 @@ class MessageHandler extends Crypt
|
||||
}
|
||||
$deserialized = $this->tl->deserialize(\danog\MadelineProto\Tools::fopen_and_write('php://memory', 'rw+b', $message_data));
|
||||
$this->incoming_messages[$message_id]['content'] = $deserialized;
|
||||
|
||||
return $deserialized;
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,9 @@ class ResponseHandler extends MsgIdHandler
|
||||
return end($responses);
|
||||
break;
|
||||
default:
|
||||
$this->log->log("Received multiple responses, returning last one");
|
||||
$this->log->log('Received multiple responses, returning last one');
|
||||
$this->log->log($responses);
|
||||
|
||||
return end($responses);
|
||||
break;
|
||||
}
|
||||
@ -96,6 +97,7 @@ class ResponseHandler extends MsgIdHandler
|
||||
$this->ack_incoming_message_id($response['orig_message']['msg_id']); // Acknowledge that I received the server's response
|
||||
} else {
|
||||
$this->check_message_id($message['orig_message']['msg_id'], false);
|
||||
|
||||
return $this->handle_message($response['orig_message']);
|
||||
}
|
||||
break;
|
||||
|
@ -20,12 +20,14 @@ class SaltHandler extends ResponseHandler
|
||||
public function add_salts($salts)
|
||||
{
|
||||
foreach ($salts as $salt) {
|
||||
$this->addsalt($salt["valid_since"], $salt["valid_until"], $salt["salt"]);
|
||||
$this->addsalt($salt['valid_since'], $salt['valid_until'], $salt['salt']);
|
||||
}
|
||||
}
|
||||
public function addsalt($valid_since, $valid_until, $salt) {
|
||||
if (!isset($this->settings["authorization"]["temp_auth_key"]["salts"][$salt])) {
|
||||
$settings["authorization"]["temp_auth_key"]["salts"][$salt] = [ "valid_since" => $valid_since, "valid_until" => $valid_until ];
|
||||
|
||||
public function addsalt($valid_since, $valid_until, $salt)
|
||||
{
|
||||
if (!isset($this->settings['authorization']['temp_auth_key']['salts'][$salt])) {
|
||||
$settings['authorization']['temp_auth_key']['salts'][$salt] = ['valid_since' => $valid_since, 'valid_until' => $valid_until];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user