Skip to content

Commit

Permalink
Reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 4, 2023
1 parent cedf5ce commit d69ecf9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/MTProtoSession/CallHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ public function methodCallAsyncWrite(string $method, array $args): WrappedFuture
}
$args = $this->API->botAPIToMTProto($args);

$response = new DeferredFuture;
$this->methodAbstractions($method, $args);
if (\in_array($method, ['messages.sendEncrypted', 'messages.sendEncryptedFile', 'messages.sendEncryptedService'], true)) {
$args['method'] = $method;
$args = $this->API->getSecretChatController($args['peer'])->encryptSecretMessage($args, $response->getFuture());
}

$methodInfo = $this->API->getTL()->getMethods()->findByMethod($method);
if (!$methodInfo) {
throw new Exception("Could not find method $method!");
Expand All @@ -147,12 +154,6 @@ public function methodCallAsyncWrite(string $method, array $args): WrappedFuture
if (!$encrypted && $this->shared->hasTempAuthKey()) {
$encrypted = true;
}
$response = new DeferredFuture;
$this->methodAbstractions($method, $args);
if (\in_array($method, ['messages.sendEncrypted', 'messages.sendEncryptedFile', 'messages.sendEncryptedService'], true)) {
$args['method'] = $method;
$args = $this->API->getSecretChatController($args['peer'])->encryptSecretMessage($args, $response->getFuture());
}
$message = new MTProtoOutgoingMessage(
body: $args,
constructor: $method,
Expand Down

0 comments on commit d69ecf9

Please sign in to comment.