1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 08:34:41 +01:00
This commit is contained in:
Daniil Gentili 2020-11-26 22:50:55 +01:00
parent 66f79c066e
commit e54965592f
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
8 changed files with 13 additions and 13 deletions

2
docs

@ -1 +1 @@
Subproject commit e83c3ea026fc2142b6558378d0c9636c8c29f248
Subproject commit e0c0aaabf361a88523da0767d7342a2cfd56e8e4

View File

@ -130,7 +130,7 @@ class PostgresArray extends SqlArray
$this->setCache($index, $value);
$request = $this->execute(
$this->set,
self::STATEMENT_SET,
[
'index' => $index,
'value' => new ByteA(\serialize($value)),

View File

@ -5280,8 +5280,9 @@ class InternalDoc extends APIFactory
/**
* Get info about peer, returns an Info object.
*
* @param mixed $id Peer
* @param boolean $recursive Internal
* @param mixed $id Peer
* @param MTProto::INFO_TYPE_* $type Whether to generate an Input*, an InputPeer or the full set of constructors
* @param boolean $recursive Internal
*
* @see https://docs.madelineproto.xyz/Info.html
*
@ -5307,11 +5308,11 @@ class InternalDoc extends APIFactory
* InputUser?: array{_: string, user_id?: int, access_hash?: mixed, min?: bool},
* InputChannel?: array{_: string, channel_id: int, access_hash: mixed, min: bool},
* type: string
* }>
* }>|int|array{_: string, user_id?: mixed, access_hash?: mixed, min?: mixed, chat_id?: mixed, channel_id?: mixed}|array{_: string, user_id?: int, access_hash?: mixed, min?: bool}|array{_: string, channel_id: int, access_hash: mixed, min: bool}
*/
public function getInfo($id, $recursive = true, array $extra = [])
public function getInfo($id, int $type = \danog\MadelineProto\MTProto::INFO_TYPE_ALL, $recursive = true, array $extra = [])
{
return $this->__call(__FUNCTION__, [$id, $recursive, $extra]);
return $this->__call(__FUNCTION__, [$id, $type, $recursive, $extra]);
}
/**
* Get logger.

View File

@ -1062,7 +1062,7 @@ class MTProto extends AsyncConstruct implements TLCallback
}
yield $this->chats->offsetSet(0, []);
$this->logger("Cleaned up peer database!");
} else if (yield $this->chats->isset(0)) {
} elseif (yield $this->chats->isset(0)) {
$this->chats->offsetUnset(0);
}
}

View File

@ -658,7 +658,7 @@ trait Files
if (\is_array($messageMedia) && ($messageMedia['min'] ?? false) && isset($messageMedia['access_hash'])) {
// bot API file ID
$messageMedia['min'] = false;
$peer = $this->genAll($messageMedia, MTProto::INFO_TYPE_PEER);
$peer = $this->genAll($messageMedia, null, MTProto::INFO_TYPE_PEER);
} else {
$peer = yield from $this->getInfo($messageMedia, MTProto::INFO_TYPE_PEER);
}

View File

@ -55,7 +55,7 @@ class MinDatabase implements TLCallback
private $API;
/**
* Whether we cleaned up old database information
* Whether we cleaned up old database information.
*
* @var boolean
*/

View File

@ -228,7 +228,7 @@ trait PeerHandler
}
yield $this->chats->offsetSet($bot_api_id, $chat);
$fullChat = yield $this->full_chats[$bot_api_id];
if ($this->getSettings()->getPeer()->getFullFetch() && $this->getSetings()->getDb()->getEnableFullPeerDb() && (!$fullChat || $fullChat['full']['participants_count'] !== (yield from $this->getFullInfo($bot_api_id))['full']['participants_count'])) {
if ($this->getSettings()->getPeer()->getFullFetch() && $this->getSettings()->getDb()->getEnableFullPeerDb() && (!$fullChat || $fullChat['full']['participants_count'] !== (yield from $this->getFullInfo($bot_api_id))['full']['participants_count'])) {
$this->cachePwrChat($bot_api_id, $this->getSettings()->getPeer()->getFullFetch(), true);
}
}

View File

@ -19,7 +19,6 @@
namespace danog\MadelineProto\MTProtoTools;
use Amp\Promise;
use danog\MadelineProto\Db\DbArray;
use danog\MadelineProto\Db\DbPropertiesTrait;
use danog\MadelineProto\Exception;
@ -302,6 +301,7 @@ class ReferenceDatabase implements TLCallback
if ($key === -1) {
throw new \danog\MadelineProto\Exception('Trying to add origin with no origin context set');
}
$constructor = $data->getConstructor();
$originType = \array_pop($this->cacheContexts);
if (!isset($this->cache[$key])) {
$this->API->logger->logger("Removing origin context {$originType} for {$constructor}, nothing in the reference cache!", \danog\MadelineProto\Logger::ULTRA_VERBOSE);
@ -310,7 +310,6 @@ class ReferenceDatabase implements TLCallback
$cache = $this->cache[$key];
unset($this->cache[$key]);
$origin = [];
$constructor = $data->getConstructor();
$body = $data->getBodyOrEmpty();
switch ($body ?? '') {
case 'photos.updateProfilePhoto':