Jaklis = Silkaj

This commit is contained in:
Boris 2022-11-15 20:01:37 +01:00
parent 04d951a129
commit ab14667900
2 changed files with 30 additions and 5 deletions

View File

@ -32,11 +32,17 @@ class Jaklis {
if ($this->mode = 'local') {
return [
try {
$this->getInboundMessages(),
$this->getOutboundMessages()
];
$msg_in = $this->getInboundMessages();
$msg_out = $this->getOutboundMessages();
} catch (Exception $errMsg) {
throw Exception($errMsg);
}
return [$msg_in, $msg_out];
} else {
@ -57,6 +63,11 @@ class Jaklis {
$result_code=null;
exec($cmd, $output, $result_code);
if (empty($output)) {
throw Exception('Jaklis marche pô pour les messages entrants.');
}
$json = implode("\n", $output);
// echo '<p>' . $cmd . '</p>';
@ -83,6 +94,11 @@ class Jaklis {
$result_code=null;
exec($cmd, $output, $result_code);
if (empty($output)) {
throw Exception('Jaklis marche pô pour les messages sortants.');
}
$json = implode("\n", $output);
// echo '<p>' . $cmd . '</p>';

View File

@ -5,6 +5,7 @@ require_once('lib/Fred.class.php');
require_once('lib/Messenger.class.php');
require_once('lib/Gchange.class.php');
require_once('lib/Jaklis.class.php');
require_once('lib/ErrorsHandler.php');
$gchange = new Gchange();
$messenger = new Messenger($gchange);
@ -24,7 +25,15 @@ if (isset($_POST['message'], $_POST['to'])) {
}
// $msgIn = $jaklis->getInboundMessages('QP1VkfaFUMdHZmHgPMi7q5wJJHaQhZcEqs5A86NigKr');
list($msgIn, $msgOut) = $jaklis->getMessages();
try {
list($msgIn, $msgOut) = $jaklis->getMessages();
} catch (Exception $errMsg) {
ErrorsHandler::kaput($errMsg);
}
// list($msgIn, $msgOut) = $fred->donneMoiSesPutainDeMessagesGchange($_SESSION['salt'], $_SESSION['pepper']);
// echo '<pre>'; var_dump($msgIn); echo '</pre>';