2023-09-21 05:25:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Classes\FTN\Process\Netmail;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
use App\Classes\FTN\Process;
|
|
|
|
use App\Models\{Echomail,Netmail};
|
2023-09-21 05:25:18 +00:00
|
|
|
use App\Notifications\Netmails\Areafix as AreafixNotification;
|
|
|
|
use App\Notifications\Netmails\Areafix\NotConfiguredHere as AreafixNotConfiguredHereNotification;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Process messages to Ping
|
|
|
|
*
|
|
|
|
* @package App\Classes\FTN\Process
|
|
|
|
*/
|
|
|
|
final class Areafix extends Process
|
|
|
|
{
|
|
|
|
private const LOGKEY = 'RP-';
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
public static function handle(Echomail|Netmail $mo): bool
|
2023-09-21 05:25:18 +00:00
|
|
|
{
|
2024-05-19 13:28:45 +00:00
|
|
|
if (strtolower($mo->to) !== 'areafix')
|
2023-09-21 05:25:18 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2024-05-19 13:28:45 +00:00
|
|
|
Log::info(sprintf('%s:- Processing AREAFIX message from (%s) [%s]',self::LOGKEY,$mo->from,$mo->fftn));
|
2023-09-21 05:25:18 +00:00
|
|
|
|
|
|
|
// If this is not a node we manage, then respond with a sorry can help you
|
2024-05-19 13:28:45 +00:00
|
|
|
if ($mo->fftn->system->sessions->count())
|
|
|
|
Notification::route('netmail',$mo->fftn)->notify(new AreafixNotification($mo));
|
2023-09-21 05:25:18 +00:00
|
|
|
else
|
2024-05-19 13:28:45 +00:00
|
|
|
Notification::route('netmail',$mo->fftn)->notify(new AreafixNotConfiguredHereNotification($mo));
|
2023-09-21 05:25:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|