1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 06:59:01 +01:00

Change response type of sendEncrypted* to updateNewOutgoingEncryptedMessage

This commit is contained in:
Daniil Gentili 2023-09-25 09:10:47 +02:00
parent 29a6e5e87e
commit 5fe3467b19
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 4 additions and 3 deletions

View File

@ -257,7 +257,7 @@ trait ResponseHandler
} elseif ($responseType === 'messages.SentEncryptedMessage') {
$body = $request->getBodyOrEmpty();
try {
$this->API->getSecretChatController($body['peer'])->handleSent($body, $response);
$response = $this->API->getSecretChatController($body['peer'])->handleSent($body, $response);
} catch (SecretPeerNotInDbException) {
}
}

View File

@ -392,7 +392,7 @@ final class SecretChatController implements Stringable
$this->randomIdMap[$randomId] = [$seq, true];
}
public function handleSent(array $request, array $response): void
public function handleSent(array $request, array $response): array
{
$lock = $this->sentMutex->acquire((string) $request['seq']);
try {
@ -401,11 +401,12 @@ final class SecretChatController implements Stringable
$msg['message']['date'] = $response['date'];
if (isset($response['file'])) {
$msg['message']['file'] = $response['file'];
$update['message']['decrypted_message']['media']['file'] = $response['file'];
$msg['message']['decrypted_message']['media']['file'] = $response['file'];
}
$this->outgoing[$request['seq']] = $msg;
EventLoop::queue($this->API->saveUpdate(...), $msg);
}
return $msg;
} finally {
EventLoop::queue($lock->release(...));
}