Now an exception won't be thrown if the ack methods can't find the message id.

This commit is contained in:
danogentili 2016-12-19 21:07:11 +03:00
parent 865af04288
commit cb7a07f2b0

View File

@ -21,7 +21,7 @@ trait AckHandler
{ {
// The server acknowledges that it received my message // The server acknowledges that it received my message
if (!isset($this->datacenter->outgoing_messages[$message_id])) { if (!isset($this->datacenter->outgoing_messages[$message_id])) {
\danog\MadelineProto\Logger::log("Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?'); \danog\MadelineProto\Logger::log("WARNING: Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?');
return false; return false;
} }
@ -33,7 +33,8 @@ trait AckHandler
{ {
// I let the server know that I received its message // I let the server know that I received its message
if (!isset($this->datacenter->incoming_messages[$message_id])) { if (!isset($this->datacenter->incoming_messages[$message_id])) {
throw new \danog\MadelineProto\Exception("Couldn't find message id ".$message_id.' in the array of incoming message ids. Maybe try to increase its size?'); \danog\MadelineProto\Logger::log("WARNING: Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?');
//throw new \danog\MadelineProto\Exception("Couldn't find message id ".$message_id.' in the array of incoming message ids. Maybe try to increase its size?');
} }
if ($this->datacenter->temp_auth_key['id'] === null || $this->datacenter->temp_auth_key['id'] == $this->string2bin('\x00\x00\x00\x00\x00\x00\x00\x00') || (isset($this->datacenter->incoming_messages[$message_id]['ack']) && $this->datacenter->incoming_messages[$message_id]['ack'])) { if ($this->datacenter->temp_auth_key['id'] === null || $this->datacenter->temp_auth_key['id'] == $this->string2bin('\x00\x00\x00\x00\x00\x00\x00\x00') || (isset($this->datacenter->incoming_messages[$message_id]['ack']) && $this->datacenter->incoming_messages[$message_id]['ack'])) {
return; return;