From d2351f9862ef0e20a91212ecbd9336d302b7f75f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 24 Sep 2023 19:04:06 +0200 Subject: [PATCH] Fixes --- examples/secret_bot.php | 2 +- src/SecretChats/SecretChatController.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/secret_bot.php b/examples/secret_bot.php index 95437443a..a951744a9 100755 --- a/examples/secret_bot.php +++ b/examples/secret_bot.php @@ -302,7 +302,7 @@ class SecretHandler extends EventHandler foreach ($secret_media as $type => $smessage) { $promises []= async($this->messages->sendEncryptedFile(...), $smessage); } - await($promises); + var_dump(await($promises)); $i = 0; while ($i < 10) { diff --git a/src/SecretChats/SecretChatController.php b/src/SecretChats/SecretChatController.php index e43716893..45bc2ec57 100644 --- a/src/SecretChats/SecretChatController.php +++ b/src/SecretChats/SecretChatController.php @@ -354,7 +354,7 @@ final class SecretChatController implements Stringable private function encryptSecretMessageInner(array &$body): void { $message = $body['message']; - $message['random_id'] = Tools::randomInt(); + $randomId = $message['random_id'] = Tools::randomInt(); Assert::true($this->remoteLayer > 8); $message = ['_' => 'decryptedMessageLayer', 'layer' => $this->remoteLayer, 'in_seq_no' => $this->generateSecretInSeqNo(), 'out_seq_no' => $this->generateSecretOutSeqNo(), 'message' => $message]; $seq = $this->out_seq_no++; @@ -378,7 +378,7 @@ final class SecretChatController implements Stringable } $body['data'] = $this->key['fingerprint'].$message_key.Crypt::igeEncrypt($message, $aes_key, $aes_iv); $this->outgoing[$seq] = $body; - $this->randomIdMap[$message['random_id']] = [$seq, true]; + $this->randomIdMap[$randomId] = [$seq, true]; } private function handleDecryptedUpdate(array $update): void @@ -519,7 +519,7 @@ final class SecretChatController implements Stringable } $message['message']['decrypted_message'] = $message['message']['decrypted_message']['message']; $this->incoming[$seq = $this->in_seq_no++] = $message; - $this->randomIdMap[$message['random_id']] = [$seq, false]; + $this->randomIdMap[$message['message']['decrypted_message']['random_id']] = [$seq, false]; $this->handleDecryptedUpdate($message); } } else {