This commit is contained in:
Daniil Gentili 2019-10-29 22:51:14 +01:00
parent 92717a2d05
commit 9c258ef406
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
12 changed files with 27 additions and 27 deletions

View File

@ -238,8 +238,8 @@ class CombinedAPI
if ($instance->API->authorized !== MTProto::LOGGED_IN) {
continue;
}
if (!$instance->API->settings['updates']['handleUpdates']) {
$instance->API->settings['updates']['handleUpdates'] = true;
if (!$instance->API->settings['updates']['handle_updates']) {
$instance->API->settings['updates']['handle_updates'] = true;
$instance->API->startUpdateSystem();
}
$instance->setCallback(function ($update) use ($path) {

View File

@ -50,11 +50,11 @@ class FeedLoop extends ResumableSignalLoop
$API = $this->API;
$this->updater = $API->updaters[$this->channelId];
if (!$this->API->settings['updates']['handleUpdates']) {
if (!$this->API->settings['updates']['handle_updates']) {
return false;
}
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
return;
}
@ -62,7 +62,7 @@ class FeedLoop extends ResumableSignalLoop
$this->state = $this->channelId === false ? (yield $API->loadUpdateState()) : $API->loadChannelState($this->channelId);
while (true) {
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
return;
}
@ -70,7 +70,7 @@ class FeedLoop extends ResumableSignalLoop
if (yield $this->waitSignal($this->pause())) {
return;
}
if (!$this->API->settings['updates']['handleUpdates']) {
if (!$this->API->settings['updates']['handle_updates']) {
return;
}
$API->logger->logger("Resumed $this");

View File

@ -42,11 +42,11 @@ class SeqLoop extends ResumableSignalLoop
$API = $this->API;
$this->feeder = $API->feeders[false];
if (!$this->API->settings['updates']['handleUpdates']) {
if (!$this->API->settings['updates']['handle_updates']) {
return false;
}
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
return;
}
@ -54,7 +54,7 @@ class SeqLoop extends ResumableSignalLoop
$this->state = yield $API->loadUpdateState();
while (true) {
while (!$this->API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$this->API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
return;
}
@ -62,7 +62,7 @@ class SeqLoop extends ResumableSignalLoop
if (yield $this->waitSignal($this->pause())) {
return;
}
if (!$this->API->settings['updates']['handleUpdates']) {
if (!$this->API->settings['updates']['handle_updates']) {
return;
}
while ($this->incomingUpdates) {

View File

@ -47,7 +47,7 @@ class UpdateLoop extends ResumableSignalLoop
$API = $this->API;
$feeder = $this->feeder = $API->feeders[$this->channelId];
while (!$API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
$API->logger->logger("Exiting $this due to signal");
@ -59,7 +59,7 @@ class UpdateLoop extends ResumableSignalLoop
$timeout = $API->settings['updates']['getdifference_interval'];
$first = true;
while (true) {
while (!$API->settings['updates']['handleUpdates'] || !$API->hasAllAuth()) {
while (!$API->settings['updates']['handle_updates'] || !$API->hasAllAuth()) {
if (yield $this->waitSignal($this->pause())) {
$API->logger->logger("Exiting $this due to signal");

View File

@ -32,7 +32,7 @@ class Lua
throw new Exception(\danog\MadelineProto\Lang::$current_lang['script_not_exist']);
}
$this->MadelineProto = $MadelineProto;
$this->MadelineProto->settings['updates']['handleUpdates'] = true;
$this->MadelineProto->settings['updates']['handle_updates'] = true;
$this->MadelineProto->API->datacenter->sockets[$this->MadelineProto->settings['connection_settings']['default_dc']]->startUpdateLoop();
$this->script = $script;

View File

@ -816,7 +816,7 @@ class MTProto extends AsyncConstruct implements TLCallback
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) {
yield $this->getDialogs($force);
}
if ($this->authorized === self::LOGGED_IN && $this->settings['updates']['handleUpdates']) {
if ($this->authorized === self::LOGGED_IN && $this->settings['updates']['handle_updates']) {
$this->logger->logger(\danog\MadelineProto\Lang::$current_lang['getupdates_deserialization'], Logger::NOTICE);
yield $this->updaters[false]->resume();
}
@ -1113,7 +1113,7 @@ class MTProto extends AsyncConstruct implements TLCallback
// Should madeline fetch the full member list of every group it meets?
'cache_all_peers_on_startup' => false,
], 'requests' => ['gzip_encode_if_gt' => 1024 * 1024], 'updates' => [
'handleUpdates' => false,
'handle_updates' => false,
// Should I handle updates?
'handle_old_updates' => true,
// Should I handle old updates on startup?
@ -1182,7 +1182,7 @@ class MTProto extends AsyncConstruct implements TLCallback
throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['api_not_set'], 0, null, 'MadelineProto', 1);
}
$this->settings = $settings;
if (!$this->settings['updates']['handleUpdates']) {
if (!$this->settings['updates']['handle_updates']) {
$this->updates = [];
}
// Setup logger

View File

@ -48,7 +48,7 @@ trait UpdateHandler
public function getUpdatesUpdateHandler($update)
{
if (!$this->settings['updates']['handleUpdates']) {
if (!$this->settings['updates']['handle_updates']) {
return;
}
$this->updates[$this->updates_key++] = $update;
@ -56,8 +56,8 @@ trait UpdateHandler
public function getUpdates($params = [])
{
if (!$this->settings['updates']['handleUpdates']) {
$this->settings['updates']['handleUpdates'] = true;
if (!$this->settings['updates']['handle_updates']) {
$this->settings['updates']['handle_updates'] = true;
$this->startUpdateSystem();
}
if (!$this->settings['updates']['run_callback']) {
@ -173,7 +173,7 @@ trait UpdateHandler
public function handleUpdates($updates, $actual_updates = null)
{
if (!$this->settings['updates']['handleUpdates']) {
if (!$this->settings['updates']['handle_updates']) {
return;
}
if ($actual_updates) {
@ -365,7 +365,7 @@ trait UpdateHandler
//if ($update['_'] === 'updateServiceNotification' && strpos($update['type'], 'AUTH_KEY_DROP_') === 0) {
//}
if (!$this->settings['updates']['handleUpdates']) {
if (!$this->settings['updates']['handle_updates']) {
return;
}
if (isset($update['message']['_']) && $update['message']['_'] === 'messageEmpty') {

View File

@ -28,7 +28,7 @@ trait Callback
{
$this->settings['updates']['callback'] = $callback;
$this->settings['updates']['run_callback'] = true;
$this->settings['updates']['handleUpdates'] = true;
$this->settings['updates']['handle_updates'] = true;
$this->startUpdateSystem();
}
}

View File

@ -59,7 +59,7 @@ trait Events
}
$this->settings['updates']['callback'] = [$this, 'eventUpdateHandler'];
$this->settings['updates']['handleUpdates'] = true;
$this->settings['updates']['handle_updates'] = true;
$this->settings['updates']['run_callback'] = true;
if (!$this->asyncInitPromise) {
$this->startUpdateSystem();

View File

@ -140,8 +140,8 @@ trait Loop
$this->closeConnection('Bot was started');
}
if (!$this->settings['updates']['handleUpdates']) {
$this->settings['updates']['handleUpdates'] = true;
if (!$this->settings['updates']['handle_updates']) {
$this->settings['updates']['handle_updates'] = true;
}
if (!$this->settings['updates']['run_callback']) {
$this->settings['updates']['run_callback'] = true;

View File

@ -25,7 +25,7 @@ trait Noop
{
$this->settings['updates']['callback'] = [$this, 'noop'];
$this->settings['updates']['run_callback'] = false;
$this->settings['updates']['handleUpdates'] = true;
$this->settings['updates']['handle_updates'] = true;
$this->startUpdateSystem();
}

View File

@ -30,7 +30,7 @@ trait Webhook
$this->hook_url = $hook_url;
$this->settings['updates']['callback'] = [$this, 'pwrWebhook'];
$this->settings['updates']['run_callback'] = true;
$this->settings['updates']['handleUpdates'] = true;
$this->settings['updates']['handle_updates'] = true;
$this->startUpdateSystem();
}
}