From b23e8d36642b005340b443f78c33d4d65d284781 Mon Sep 17 00:00:00 2001 From: Alex Morbo Date: Sun, 7 May 2017 16:00:52 +0300 Subject: [PATCH 1/2] pwr requests (#108) * on/off switcher for pwrtelegram peer info requests * Fix PWRTelgram requets if we have no info about peer --- src/danog/MadelineProto/MTProto.php | 7 ++++++- src/danog/MadelineProto/MTProtoTools/PeerHandler.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 05eb010d..7047271b 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -357,7 +357,12 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB 'allow_threading' => false, // Should I use threading, if it is enabled? 'handler_workers' => 10, // How many workers should every message handler pool of each socket reader have ], - 'pwr' => ['pwr' => false, 'db_token' => false, 'strict' => false, 'requests' => true], + 'pwr' => [ + 'pwr' => false, // Need info ? + 'db_token' => false, // Need info ? + 'strict' => false, // Need info ? + 'requests' => true, // Should I get info about unknown peers from PWRTelegram? + ], ]; $settings = $this->array_replace_recursive($default_settings, $settings); if (!isset($settings['app_info']['api_id'])) { diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php index a27672f0..aef30225 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php @@ -211,7 +211,7 @@ trait PeerHandler return $this->gen_all($this->chats[$id]); } } - if (!isset($this->settings['pwr']['request']) || $this->settings['pwr']['requests'] === true) { + if (!isset($this->settings['pwr']['requests']) || $this->settings['pwr']['requests'] === true) { $dbres = json_decode(file_get_contents('https://id.pwrtelegram.xyz/db/getusername?id='.$id, false, stream_context_create(['http'=> [ 'timeout' => 2, ], From ee7260fc2fe0416540e2de55ebe200a4992ebea7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 7 May 2017 13:00:58 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- src/danog/MadelineProto/MTProto.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 7047271b..eab60f14 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -358,9 +358,9 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB 'handler_workers' => 10, // How many workers should every message handler pool of each socket reader have ], 'pwr' => [ - 'pwr' => false, // Need info ? + 'pwr' => false, // Need info ? 'db_token' => false, // Need info ? - 'strict' => false, // Need info ? + 'strict' => false, // Need info ? 'requests' => true, // Should I get info about unknown peers from PWRTelegram? ], ];