final bugfixes

This commit is contained in:
Daniil Gentili 2019-09-14 16:04:40 +02:00
parent 03287a586d
commit cf9a30521a
2 changed files with 12 additions and 10 deletions

View File

@ -138,6 +138,7 @@ class MinDatabase implements TLCallback
public function addPeer(array $location)
{
if (!$this->cache) {
return;
$this->API->logger->logger('Trying to add peer out of context, report the following message to @danogentili!', \danog\MadelineProto\Logger::ERROR);
$frames = [];
$previous = '';

View File

@ -80,16 +80,13 @@ trait PeerHandler
if (($user['min'] ?? false) && isset($this->chats[$user['id']]) && !($this->chats[$user['id']]['min'] ?? false)) {
$this->logger->logger("{$user['id']} is min, filling missing fields", \danog\MadelineProto\Logger::ULTRA_VERBOSE);
$newuser = $this->chats[$user['id']];
foreach (['title', 'username', 'photo', 'banned_rights', 'megagroup', 'verified'] as $field) {
if (isset($user[$field])) {
$newuser[$field] = $user[$field];
}
if (isset($this->chats[$user['id']]['access_hash'])) {
$user['min'] = false;
$user['access_hash'] = $this->chats[$user['id']]['access_hash'];
}
$user = $newuser;
}
$this->users[$user['id']] = $user;
$this->chats[$user['id']] = $user;
$this->cache_pwr_chat($user['id'], false, true);
}
break;
@ -140,10 +137,13 @@ trait PeerHandler
if (($chat['min'] ?? false) && isset($this->chats[$bot_api_id]) && !($this->chats[$bot_api_id]['min'] ?? false)) {
$this->logger->logger("$bot_api_id is min, filling missing fields", \danog\MadelineProto\Logger::ULTRA_VERBOSE);
if (isset($this->chats[$bot_api_id]['access_hash'])) {
$chat['min'] = false;
$chat['access_hash'] = $this->chats[$bot_api_id]['access_hash'];
$newchat = $this->chats[$bot_api_id];
foreach (['title', 'username', 'photo', 'banned_rights', 'megagroup', 'verified'] as $field) {
if (isset($chat[$field])) {
$newchat[$field] = $chat[$field];
}
}
$chat = $newchat;
}
$this->chats[$bot_api_id] = $chat;
@ -409,6 +409,7 @@ trait PeerHandler
if (\is_numeric($id)) {
if (!isset($this->chats[$id])) {
try {
$this->logger->logger("Try fetching $id with access hash 0");
$this->caching_simple[$id] = true;
if ($id < 0) {
if ($this->is_supergroup($id)) {