1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-23 10:31:13 +01:00
This commit is contained in:
Daniil Gentili 2023-09-23 21:38:09 +02:00
parent fbc20f9521
commit 48abbd5838
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
7 changed files with 8 additions and 10 deletions

2
docs

@ -1 +1 @@
Subproject commit 9182152e87f4c2cc797840bc236041ecf2fe7573
Subproject commit fc9602448c03c249276623c701d37834f2e3f001

View File

@ -359,10 +359,10 @@ final class Connection
} else {
$arguments['channel'] = $content;
}
} elseif ($method === 'messages.sendMessage' &&
} elseif ($method === 'messages.sendMessage' &&
(
(isset($arguments['peer']['_']) && \in_array($arguments['peer']['_'], ['inputEncryptedChat', 'updateEncryption', 'updateEncryptedChatTyping', 'updateEncryptedMessagesRead', 'updateNewEncryptedMessage', 'encryptedMessage', 'encryptedMessageService'], true))
|| (is_int($arguments['peer']) && DialogId::isSecretChat($arguments['peer']))
|| (\is_int($arguments['peer']) && DialogId::isSecretChat($arguments['peer']))
)
) {
$method = 'messages.sendEncrypted';

View File

@ -45,7 +45,7 @@ trait Methods
{
static $bots;
if (!$bots) {
$bots = \json_decode(\file_get_contents('https://rpc.madelineproto.xyz/bot.json'), true)['result'];
$bots = \json_decode(\file_get_contents('https://raw.githubusercontent.com/danog/rpc-db/master/bot.json'), true)['result'];
}
static $errors;
if (!$errors) {

View File

@ -25,7 +25,6 @@ use danog\MadelineProto\Loop\InternalLoop;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\SecretChats\SecretChatController;
use danog\MadelineProto\SecurityException;
use Revolt\EventLoop;
/**
* Secret feed loop.
@ -56,7 +55,7 @@ final class SecretFeedLoop extends Loop
{
return ['API', 'secretChat', 'incomingUpdates'];
}
public function __wakeup()
public function __wakeup(): void
{
if (!isset($this->API->logger)) {
$this->API->setupLogger();

View File

@ -162,7 +162,7 @@ trait CallHandler
}
$response = new DeferredFuture;
// Closures only used for upload.saveFilePart
if (is_array($args)) {
if (\is_array($args)) {
$this->methodAbstractions($method, $args);
if (\in_array($method, ['messages.sendEncrypted', 'messages.sendEncryptedFile', 'messages.sendEncryptedService'], true)) {
$args = $this->API->getSecretChatController($args['peer'])->encryptSecretMessage($args, $response->getFuture());

View File

@ -1020,7 +1020,7 @@ trait UpdateHandler
}
}
if ($update['_'] === 'updateNewEncryptedMessage' && !isset($update['message']['decrypted_message'])) {
EventLoop::queue(function () use ($update) {
EventLoop::queue(function () use ($update): void {
if (isset($update['qts'])) {
$cur_state = ($this->loadUpdateState());
if ($cur_state->qts() === -1) {
@ -1047,7 +1047,7 @@ trait UpdateHandler
return;
}
if ($update['_'] === 'updateEncryption') {
EventLoop::queue(function () use ($update) {
EventLoop::queue(function () use ($update): void {
switch ($update['chat']['_']) {
case 'encryptedChatRequested':
if (!$this->settings->getSecretChats()->canAccept($update['chat']['admin_id'])) {

View File

@ -28,7 +28,6 @@ use danog\MadelineProto\Logger;
use danog\MadelineProto\Loop\Secret\SecretFeedLoop;
use danog\MadelineProto\Loop\Update\UpdateLoop;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\MTProto\MTProtoOutgoingMessage;
use danog\MadelineProto\MTProtoTools\Crypt;
use danog\MadelineProto\MTProtoTools\DialogId;
use danog\MadelineProto\ResponseException;