From 5b60992ecbb9271f3db13088d2e09c14ba9a15ba Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 4 May 2018 10:21:33 +0000 Subject: [PATCH] Update magnaluna --- docs | 2 +- magna.php | 33 ++++++++++++++++++++++++++++++++ src/danog/MadelineProto/Lang.php | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 3be94398..4462f6f0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3be943981f47b1e140c271fef2bc49a99b40f93e +Subproject commit 4462f6f0c4391a3a1c6ce4f2b5cb02081a635a88 diff --git a/magna.php b/magna.php index 98d63a1f..27f6a61b 100755 --- a/magna.php +++ b/magna.php @@ -66,6 +66,9 @@ class EventHandler extends \danog\MadelineProto\EventHandler //'audio_bitrate_step_decr' => 0, //'audio_bitrate_step_incr' => 2000, ]; + $call->configuration["log_file_path"] = "/tmp/logs".$call->getCallID()['id'].".log"; // Default is /dev/null + //$call->configuration["stats_dump_file_path"] = "/tmp/stats".$call->getCallID()['id'].".txt"; // Default is /dev/null + $call->parseConfig(); $call->playOnHold($songs); } @@ -248,6 +251,36 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p \danog\MadelineProto\Logger::log(count($this->calls).' calls running!'); foreach ($this->calls as $key => $call) { if ($call->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { + try { + if (isset($this->times[$call->getOtherID()][1])) { + /*$this->messages->sendMedia([ + 'reply_to_msg_id' => $this->times[$call->getOtherID()][1], + 'peer' => $call->getOtherID(), 'message' => 'Call statistics by @magnaluna', + 'media' => [ + '_' => 'inputMediaUploadedDocument', + 'file' => "/tmp/stats".$call->getCallID()['id'].".txt", + 'attributes' => [ + ['_' => 'documentAttributeFilename', 'file_name' => "stats".$call->getCallID()['id'].".txt"] + ] + ], + ]);*/ + $this->messages->sendMedia([ + 'reply_to_msg_id' => $this->times[$call->getOtherID()][1], + 'peer' => $call->getOtherID(), 'message' => 'Debug info by @magnaluna', + 'media' => [ + '_' => 'inputMediaUploadedDocument', + 'file' => "/tmp/logs".$call->getCallID()['id'].".log", + 'attributes' => [ + ['_' => 'documentAttributeFilename', 'file_name' => "logs".$call->getCallID()['id'].".log"] + ] + ], + ]); + } + } catch (\danog\MadelineProto\RPCErrorException $e) { + echo $e; + } + @unlink("/tmp/logs".$call->getCallID()['id'].".log"); + @unlink("/tmp/stats".$call->getCallID()['id'].".txt"); unset($this->calls[$key]); } elseif (isset($this->times[$call->getOtherID()]) && $this->times[$call->getOtherID()][0] < time()) { $this->times[$call->getOtherID()][0] += 30 + count($this->calls); diff --git a/src/danog/MadelineProto/Lang.php b/src/danog/MadelineProto/Lang.php index ff0262fe..319d9f28 100644 --- a/src/danog/MadelineProto/Lang.php +++ b/src/danog/MadelineProto/Lang.php @@ -536,7 +536,7 @@ class Lang 'method_messages.search_param_filter_type_MessagesFilter' => 'Message filter', 'method_messages.search_param_min_date_type_int' => 'Minumum date of results to fetch', 'method_messages.search_param_max_date_type_int' => 'Maximum date of results to fetch', - 'method_messages.search_param_offset_id_type_int' => 'Offset ', + 'method_messages.search_param_offset_id_type_int' => 'Message ID offset', 'method_messages.search_param_add_offset_type_int' => 'Additional offset, can be 0', 'method_messages.search_param_limit_type_int' => 'Number of results to return', 'method_messages.search_param_max_id_type_int' => 'Maximum message id to return',