From 2cc8fcc1e29c649799e673b24bf66fdf4c36f9f4 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 20 Jul 2017 23:29:39 +0100 Subject: [PATCH] Just in case --- main.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/main.cpp b/main.cpp index c7a9f87..956cb44 100644 --- a/main.cpp +++ b/main.cpp @@ -94,21 +94,23 @@ void VoIP::deinitVoIPController() { void VoIP::discard(Php::Parameters ¶ms) { Php::Value self(this); - Php::Array reason; - Php::Array rating; - Php::Value debug; - if (params.size() > 0) { - reason = params[0]; - } else { - reason["_"] = "phoneCallDiscardReasonDisconnect"; + if (self["internalStorage"]["madeline"].value().instanceOf("danog\\MadelineProto\\MTProto")) { + Php::Array reason; + Php::Array rating; + Php::Value debug; + if (params.size() > 0) { + reason = params[0]; + } else { + reason["_"] = "phoneCallDiscardReasonDisconnect"; + } + if (params.size() > 1) { + rating = params[1]; + } + if (params.size() > 2) { + debug = params[2]; + } else debug = true; + self["internalStorage"]["madeline"].value().call("discard_call", self["internalStorage"]["callID"]["id"].value(), reason, rating, debug); } - if (params.size() > 1) { - rating = params[1]; - } - if (params.size() > 2) { - debug = params[2]; - } else debug = true; - self["internalStorage"]["madeline"].value().call("discard_call", self["internalStorage"]["callID"]["id"].value(), reason, rating, debug); deinitVoIPController(); }