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

Remove useless aargs

This commit is contained in:
Daniil Gentili 2023-09-17 19:16:38 +02:00
parent f17ca784e9
commit 7a5e8da7cf
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 7 additions and 6 deletions

View File

@ -35,5 +35,5 @@ steps:
- TAG=${CI_COMMIT_TAG} - TAG=${CI_COMMIT_TAG}
commands: commands:
- apk add bash - apk add bash
- tests/test.sh
- php tests/handshake.php - php tests/handshake.php
- tests/test.sh

View File

@ -115,7 +115,8 @@ trait CallHandler
$aargs['datacenter'] = $args['id']['dc_id']; $aargs['datacenter'] = $args['id']['dc_id'];
return $this->API->methodCallAsyncWrite($method, $args, $aargs); return $this->API->methodCallAsyncWrite($method, $args, $aargs);
} }
if (($aargs['file'] ?? false) && !$this->isMedia() && $this->API->datacenter->has(-$this->datacenter)) { $file = \in_array($method, ['upload.saveFilePart', 'upload.saveBigFilePart', 'upload.getFile', 'upload.getCdnFile'], true);
if ($file && !$this->isMedia() && $this->API->datacenter->has(-$this->datacenter)) {
$this->logger->logger('Using media DC'); $this->logger->logger('Using media DC');
$aargs['datacenter'] = -$this->datacenter; $aargs['datacenter'] = -$this->datacenter;
return $this->API->methodCallAsyncWrite($method, $args, $aargs); return $this->API->methodCallAsyncWrite($method, $args, $aargs);
@ -181,7 +182,7 @@ trait CallHandler
if (isset($aargs['msg_id'])) { if (isset($aargs['msg_id'])) {
$message->setMsgId($aargs['msg_id']); $message->setMsgId($aargs['msg_id']);
} }
if ($aargs['file'] ?? false) { if ($file) {
$message->setFileRelated(true); $message->setFileRelated(true);
} }
if ($aargs['botAPI'] ?? false) { if ($aargs['botAPI'] ?? false) {

View File

@ -291,7 +291,7 @@ trait Files
$this->methodCallAsyncWrite(...), $this->methodCallAsyncWrite(...),
$method, $method,
fn () => $callable($part_num), fn () => $callable($part_num),
['heavy' => true, 'file' => true, 'datacenter' => &$datacenter] ['heavy' => true, 'datacenter' => &$datacenter]
); );
if (!$seekable) { if (!$seekable) {
try { try {
@ -1133,7 +1133,7 @@ trait Files
$res = $this->methodCallAsyncRead( $res = $this->methodCallAsyncRead(
$cdn ? 'upload.getCdnFile' : 'upload.getFile', $cdn ? 'upload.getCdnFile' : 'upload.getFile',
$basic_param + $offset, $basic_param + $offset,
['heavy' => true, 'file' => true, 'FloodWaitLimit' => 0, 'datacenter' => &$datacenter, 'postpone' => $postpone] ['heavy' => true, 'FloodWaitLimit' => 0, 'datacenter' => &$datacenter, 'postpone' => $postpone]
); );
break; break;
} catch (FloodWaitError $e) { } catch (FloodWaitError $e) {
@ -1186,7 +1186,7 @@ trait Files
$datacenter = 0; $datacenter = 0;
} }
while ($cdn === false && $res['type']['_'] === 'storage.fileUnknown' && $res['bytes'] === '' && $this->datacenter->has(++$datacenter)) { while ($cdn === false && $res['type']['_'] === 'storage.fileUnknown' && $res['bytes'] === '' && $this->datacenter->has(++$datacenter)) {
$res = $this->methodCallAsyncRead('upload.getFile', $basic_param + $offset, ['heavy' => true, 'file' => true, 'FloodWaitLimit' => 0, 'datacenter' => $datacenter]); $res = $this->methodCallAsyncRead('upload.getFile', $basic_param + $offset, ['heavy' => true, 'FloodWaitLimit' => 0, 'datacenter' => $datacenter]);
} }
$res['bytes'] = (string) $res['bytes']; $res['bytes'] = (string) $res['bytes'];
if ($res['bytes'] === '') { if ($res['bytes'] === '') {