mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-19 09:42:07 +01:00
Bugfixes
This commit is contained in:
parent
64f1db2521
commit
d4405566ea
@ -28,7 +28,7 @@ description: chat attributes, type and example
|
||||
|phone\_calls\_available|[Bool](API_docs/types/Bool.md) | Optional|Are phone calls available for that user?|
|
||||
|phone\_calls\_private|[Bool](API_docs/types/Bool.md) | Optional||
|
||||
|common\_chats\_count|[int](API_docs/types/int.md) | Optional|Number of chats in common with that user|
|
||||
|photo|[string](API_docs/types/string.md) | Optional|bot API file id of the profile picture|
|
||||
|photo|[string](API_docs/types/string.md) | Optional|bot API file object the profile picture|
|
||||
|title|[string](API_docs/types/string.md) | Optional|Chat title|
|
||||
|participants\_count|[int](API_docs/types/int.md) | Optional|Number of participants in the chat.|
|
||||
|kicked\_count|[int](API_docs/types/int.md) | Optional|Number of users kicked from the chat.|
|
||||
|
@ -47,7 +47,7 @@ class MTProto
|
||||
/*
|
||||
const V = 71;
|
||||
*/
|
||||
const V = 92;
|
||||
const V = 93;
|
||||
const NOT_LOGGED_IN = 0;
|
||||
const WAITING_CODE = 1;
|
||||
const WAITING_SIGNUP = -1;
|
||||
|
@ -177,7 +177,7 @@ trait CallHandler
|
||||
// This method receives data from the socket, and parses stuff
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
$last_error = $e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine();
|
||||
if (in_array($e->getMessage(), ['I had to recreate the temporary authorization key', 'Got bad message notification']) || $e->getCode() === 404) {
|
||||
if (in_array($e->getMessage(), ['Resend query', 'I had to recreate the temporary authorization key', 'Got bad message notification']) || $e->getCode() === 404) {
|
||||
continue 2;
|
||||
}
|
||||
\danog\MadelineProto\Logger::log('An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...', \danog\MadelineProto\Logger::WARNING);
|
||||
|
@ -87,6 +87,8 @@ trait MessageHandler
|
||||
$this->method_call('http_wait', ['max_wait' => 500, 'wait_after' => 150, 'max_delay' => 500], ['datacenter' => $datacenter]);
|
||||
} elseif (isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) {
|
||||
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
||||
} else {
|
||||
throw new \danog\MadelineProto\Exception('Resend query');
|
||||
}
|
||||
}
|
||||
$payload = $this->datacenter->sockets[$datacenter]->read_message();
|
||||
|
@ -233,7 +233,6 @@ trait PeerHandler
|
||||
$id = $matches[2];
|
||||
} else {
|
||||
$invite = $this->method_call('messages.checkChatInvite', ['hash' => $matches[2]], ['datacenter' => $this->datacenter->curdc]);
|
||||
var_dump($invite);
|
||||
if (isset($invite['chat'])) {
|
||||
return $this->get_info($invite['chat']);
|
||||
} else {
|
||||
@ -466,12 +465,12 @@ trait PeerHandler
|
||||
if (!isset($res['participants']) && isset($res['can_view_participants']) && $res['can_view_participants'] && $fullfetch) {
|
||||
$res['participants'] = [];
|
||||
$limit = 200;
|
||||
$filters = ['channelParticipantsRecent', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsBanned'];
|
||||
$filters = ['channelParticipantsRecent', 'channelParticipantsSearch', 'channelParticipantsAdmins', 'channelParticipantsKicked', 'channelParticipantsBots', 'channelParticipantsBanned'];
|
||||
foreach ($filters as $filter) {
|
||||
$offset = -$limit;
|
||||
$offset = 0;
|
||||
|
||||
try {
|
||||
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit, 'hash' => 0], ['datacenter' => $this->datacenter->curdc]);
|
||||
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset, 'limit' => $limit, 'hash' => $this->gen_participants_hash(array_keys($res['participants']))], ['datacenter' => $this->datacenter->curdc]);
|
||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||
if ($e->rpc === 'CHAT_ADMIN_REQUIRED') {
|
||||
continue;
|
||||
@ -479,7 +478,10 @@ trait PeerHandler
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$count = $gres['count'];
|
||||
|
||||
while ($offset <= $count) {
|
||||
foreach ($gres['participants'] as $participant) {
|
||||
$newres = [];
|
||||
@ -521,7 +523,8 @@ trait PeerHandler
|
||||
}
|
||||
$res['participants'][$participant['user_id']] = $newres;
|
||||
}
|
||||
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit, 'hash' => 0], ['datacenter' => $this->datacenter->curdc]);
|
||||
//$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += $limit, 'limit' => $limit, 'hash' => $this->gen_participants_hash(array_keys($res['participants']))], ['datacenter' => $this->datacenter->curdc]);
|
||||
$gres = $this->method_call('channels.getParticipants', ['channel' => $full['InputChannel'], 'filter' => ['_' => $filter, 'q' => ''], 'offset' => $offset += count($gres['participants']), 'limit' => $limit, 'hash' => $this->gen_participants_hash(array_keys($res['participants']))], ['datacenter' => $this->datacenter->curdc]);
|
||||
if (empty($gres['participants'])) {
|
||||
break;
|
||||
}
|
||||
@ -538,7 +541,13 @@ trait PeerHandler
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function gen_participants_hash($ids) {
|
||||
$hash = 0;
|
||||
foreach ($ids as $userID) {
|
||||
$hash = (($hash * 20261) + 0x80000000 + $userID) % 0x80000000;
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
public function store_db($res, $force = false)
|
||||
{
|
||||
$settings = isset($this->settings['connection_settings'][$this->datacenter->curdc]) ? $this->settings['connection_settings'][$this->datacenter->curdc] : $this->settings['connection_settings']['all'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user