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

Add 'video' boolean to phone call storage (#1077)

* Update UpdateHandler.php

Instead passing empty array as reason pass `['_' => 'phoneCallDiscardReasonDisconnect']` in case the reason is not present

By according documentation the reason is optional:
https://core.telegram.org/constructor/phoneCallDiscarded

* Update UpdateHandler.php

* Add 'video' boolean to phone call storage

Event handler should detect is incoming call video or voice

* remove coment
This commit is contained in:
Lukas Pierce 2021-12-13 22:14:29 +06:00 committed by GitHub
parent cbb2819d6d
commit a6a9aeb60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,6 +316,7 @@ trait UpdateHandler
$controller = new \danog\MadelineProto\VoIP(false, $update['phone_call']['admin_id'], $this, \danog\MadelineProto\VoIP::CALL_STATE_INCOMING);
$controller->setCall($update['phone_call']);
$controller->storage = ['g_a_hash' => $update['phone_call']['g_a_hash']];
$controller->storage['video'] = $update['phone_call']['video'] ?? false;
$update['phone_call'] = $this->calls[$update['phone_call']['id']] = $controller;
break;
case 'phoneCallAccepted':
@ -334,7 +335,7 @@ trait UpdateHandler
if (!isset($this->calls[$update['phone_call']['id']])) {
return;
}
return $this->calls[$update['phone_call']['id']]->discard($update['phone_call']['reason'] ?? [], [], $update['phone_call']['need_debug'] ?? false);
return $this->calls[$update['phone_call']['id']]->discard($update['phone_call']['reason'] ?? ['_' => 'phoneCallDiscardReasonDisconnect'], [], $update['phone_call']['need_debug'] ?? false);
}
}
if ($update['_'] === 'updateNewEncryptedMessage' && !isset($update['message']['decrypted_message'])) {