From f06e459e5d6899be5421b004abe79aa17eceec81 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 30 Jul 2017 21:16:34 +0000 Subject: [PATCH 1/2] Apply fixes from StyleCI --- src/danog/MadelineProto/TL/TLConstructor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/danog/MadelineProto/TL/TLConstructor.php b/src/danog/MadelineProto/TL/TLConstructor.php index b5c8d39d0..075752419 100644 --- a/src/danog/MadelineProto/TL/TLConstructor.php +++ b/src/danog/MadelineProto/TL/TLConstructor.php @@ -68,7 +68,7 @@ class TLConstructor extends \Volatile if (isset($this->by_predicate_and_layer[$predicate.$alayer])) { $chosenid = $this->by_predicate_and_layer[$predicate.$alayer]; } - } else if (!isset($chosenid)) { + } elseif (!isset($chosenid)) { $chosenid = $this->by_predicate_and_layer[$predicate.$alayer]; } } From 2931e969793d9688f4c4c2d61c05dcc01b226a83 Mon Sep 17 00:00:00 2001 From: giuseppeM99 Date: Mon, 31 Jul 2017 15:32:33 +0200 Subject: [PATCH 2/2] Update get_dialogs (#162) --- src/danog/MadelineProto/Wrappers/DialogHandler.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/danog/MadelineProto/Wrappers/DialogHandler.php b/src/danog/MadelineProto/Wrappers/DialogHandler.php index ecbe41dc0..c687dc323 100644 --- a/src/danog/MadelineProto/Wrappers/DialogHandler.php +++ b/src/danog/MadelineProto/Wrappers/DialogHandler.php @@ -22,9 +22,15 @@ trait DialogHandler $this->updates_state['sync_loading'] = true; $res = ['dialogs' => [0], 'count' => 1]; $datacenter = $this->datacenter->curdc; + $peers = []; while ($this->dialog_params['count'] < $res['count']) { \danog\MadelineProto\Logger::log(['Getting dialogs...']); $res = $this->method_call('messages.getDialogs', $this->dialog_params, ['datacenter' => $datacenter, 'FloodWaitLimit' => 100]); + foreach ($res['dialogs'] as $dialog) { + if (!in_array($dialog['peer'], $peers)) { + $peers[] = $dialog['peer']; + } + } $this->dialog_params['count'] += count($res['dialogs']); $this->dialog_params['offset_date'] = end($res['messages'])['date']; $this->dialog_params['offset_peer'] = end($res['dialogs'])['peer']; @@ -35,5 +41,7 @@ trait DialogHandler } $this->updates_state['sync_loading'] = false; + + return $peers; } }