This commit is contained in:
Daniil Gentili 2017-07-31 14:42:33 +00:00
commit 13edc2e289
2 changed files with 9 additions and 1 deletions

View File

@ -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];
}
}

View File

@ -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;
}
}