Fixes to update handler and calls
This commit is contained in:
parent
980a7fef27
commit
7e7409e549
@ -37,7 +37,6 @@ if (getenv('TEST_SECRET_CHAT') == '') {
|
|||||||
echo 'Loading settings...'.PHP_EOL;
|
echo 'Loading settings...'.PHP_EOL;
|
||||||
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
||||||
|
|
||||||
var_dump($settings);
|
|
||||||
if ($MadelineProto === false) {
|
if ($MadelineProto === false) {
|
||||||
echo 'Loading MadelineProto...'.PHP_EOL;
|
echo 'Loading MadelineProto...'.PHP_EOL;
|
||||||
$MadelineProto = new \danog\MadelineProto\API($settings);
|
$MadelineProto = new \danog\MadelineProto\API($settings);
|
||||||
|
@ -575,7 +575,7 @@ trait UpdateHandler
|
|||||||
$update['message']['out'] = true;
|
$update['message']['out'] = true;
|
||||||
}
|
}
|
||||||
\danog\MadelineProto\Logger::log(['Saving an update of type '.$update['_'].'...'], \danog\MadelineProto\Logger::VERBOSE);
|
\danog\MadelineProto\Logger::log(['Saving an update of type '.$update['_'].'...'], \danog\MadelineProto\Logger::VERBOSE);
|
||||||
if (isset($this->settings['pwr']['strict']) && $this->settings['pwr']['strict']) {
|
if (isset($this->settings['pwr']['strict']) && $this->settings['pwr']['strict'] && isset($this->settings['pwr']['update_handler'])) {
|
||||||
$this->pwr_update_handler($update);
|
$this->pwr_update_handler($update);
|
||||||
} else {
|
} else {
|
||||||
in_array($this->settings['updates']['callback'], [['danog\MadelineProto\API', 'get_updates_update_handler'], 'get_updates_update_handler']) ? $this->get_updates_update_handler($update) : $this->settings['updates']['callback']($update);
|
in_array($this->settings['updates']['callback'], [['danog\MadelineProto\API', 'get_updates_update_handler'], 'get_updates_update_handler']) ? $this->get_updates_update_handler($update) : $this->settings['updates']['callback']($update);
|
||||||
|
@ -89,7 +89,7 @@ trait AuthKeyHandler
|
|||||||
}
|
}
|
||||||
if ($e->rpc === 'CALL_ALREADY_DECLINED') {
|
if ($e->rpc === 'CALL_ALREADY_DECLINED') {
|
||||||
\danog\MadelineProto\Logger::log(['Call '.$call['id'].' already declined']);
|
\danog\MadelineProto\Logger::log(['Call '.$call['id'].' already declined']);
|
||||||
$this->discard_cal($call['id']);
|
$this->discard_call($call['id']);
|
||||||
//$this->calls[$call['id']]->discard();
|
//$this->calls[$call['id']]->discard();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -263,7 +263,7 @@ trait AuthKeyHandler
|
|||||||
try {
|
try {
|
||||||
$res = $this->method_call('phone.discardCall', ['peer' => $call, 'duration' => time() - $this->calls[$call['id']]->whenCreated(), 'connection_id' => $this->calls[$call['id']]->getPreferredRelayID(), 'reason' => $reason], ['datacenter' => $this->datacenter->curdc]);
|
$res = $this->method_call('phone.discardCall', ['peer' => $call, 'duration' => time() - $this->calls[$call['id']]->whenCreated(), 'connection_id' => $this->calls[$call['id']]->getPreferredRelayID(), 'reason' => $reason], ['datacenter' => $this->datacenter->curdc]);
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
if ($e->rpc !== 'CALL_ALREADY_DECLINED') {
|
if (!in_array($e->rpc, ['CALL_ALREADY_DECLINED', 'CALL_ALREADY_ACCEPTED'])) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user