Fixes and new get_dialogs

This commit is contained in:
Daniil Gentili 2019-06-04 13:27:21 +02:00
parent e80d67037c
commit 61114c6a92
3 changed files with 11 additions and 1 deletions

View File

@ -45,8 +45,10 @@ Powered by [amphp](https://amphp.org), MadelineProto wraps the AMPHP APIs to pro
* custom HTTP client with DoH * custom HTTP client with DoH
* no more php 5 * no more php 5
* reset PTS to 0 * reset PTS to 0
* arrayaccess on args
Things to expect in the next releases: Things to expect in the next releases:
docs for get mime funcs
docs for update_2fa docs for update_2fa
docs for ResponseException docs for ResponseException
docs for PTSException docs for PTSException
@ -67,3 +69,4 @@ no error setting, madelineproto does that for you
do not use manual do not use manual
tell about madeline.php loading in the same dire tell about madeline.php loading in the same dire
arrayaccess on promises

View File

@ -118,7 +118,7 @@ trait ResponseHandler
$this->ack_incoming_message_id($current_msg_id, $datacenter); $this->ack_incoming_message_id($current_msg_id, $datacenter);
// Acknowledge that I received the server's response // Acknowledge that I received the server's response
if ($this->authorized === self::LOGGED_IN && !$this->initing_authorization && $this->datacenter->sockets[$this->datacenter->curdc]->temp_auth_key !== null) { if ($this->authorized === self::LOGGED_IN && !$this->initing_authorization && $this->datacenter->sockets[$this->datacenter->curdc]->temp_auth_key !== null && isset($this->updaters[false])) {
$this->updaters[false]->resumeDefer(); $this->updaters[false]->resumeDefer();
} }

View File

@ -23,6 +23,13 @@ trait DialogHandler
{ {
public function get_dialogs_async($force = true) public function get_dialogs_async($force = true)
{ {
if ($this->authorization['user']['bot']) {
$res = [];
foreach ($this->chats as $chat) {
$res []= $this->gen_all($chat)['Peer'];
}
return $res;
}
$res = []; $res = [];
foreach (yield $this->get_full_dialogs_async($force) as $dialog) { foreach (yield $this->get_full_dialogs_async($force) as $dialog) {
$res []= $dialog['peer']; $res []= $dialog['peer'];