From 38cfcc8c3e660e1e00a518f22b7643be75109496 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 26 Nov 2024 22:24:19 +1100 Subject: [PATCH] Respond to filefix commands with Filefix/CommandsProcessed --- .../FTN/Process/Netmail/Robot/Filefix.php | 2 +- .../Netmails/Areafix/CommandsProcessed.php | 2 +- .../Netmails/Filefix/CommandsProcessed.php | 67 +++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 app/Notifications/Netmails/Filefix/CommandsProcessed.php diff --git a/app/Classes/FTN/Process/Netmail/Robot/Filefix.php b/app/Classes/FTN/Process/Netmail/Robot/Filefix.php index ead72de..13ba18b 100644 --- a/app/Classes/FTN/Process/Netmail/Robot/Filefix.php +++ b/app/Classes/FTN/Process/Netmail/Robot/Filefix.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Log; use App\Classes\FTN\Process\Netmail\Robot; use App\Models\{Echomail,Netmail}; -use App\Notifications\Netmails\Areafix\CommandsProcessed; +use App\Notifications\Netmails\Filefix\CommandsProcessed; /** * Process messages to Ping diff --git a/app/Notifications/Netmails/Areafix/CommandsProcessed.php b/app/Notifications/Netmails/Areafix/CommandsProcessed.php index b832d13..4a128ae 100644 --- a/app/Notifications/Netmails/Areafix/CommandsProcessed.php +++ b/app/Notifications/Netmails/Areafix/CommandsProcessed.php @@ -16,7 +16,7 @@ class CommandsProcessed extends Netmails private const LOGKEY = 'ACU'; /** - * Reply to a areafix, commands unknown. + * Reply to a areafix commands. * * @param Netmail $mo * @param Collection $commands diff --git a/app/Notifications/Netmails/Filefix/CommandsProcessed.php b/app/Notifications/Netmails/Filefix/CommandsProcessed.php new file mode 100644 index 0000000..baab0de --- /dev/null +++ b/app/Notifications/Netmails/Filefix/CommandsProcessed.php @@ -0,0 +1,67 @@ +setupNetmail($notifiable); + $ao = $notifiable->routeNotificationFor(static::via); + + Log::info(sprintf('%s:+ Responding to filefix for a node [%s] COMMANDS PROCESSED',self::LOGKEY,$ao->ftn)); + + $o->to = $this->mo->from; + $o->replyid = $this->mo->msgid; + $o->subject = 'Filefix - Result'; + + // Message + $msg = $this->page(FALSE,'Filefix'); + + $msg->addText("Your filefix request has been received, here is the result:\r\r"); + + foreach ($this->commands as $command) { + $msg->addText("$command\r"); + } + + $msg->addText("\r"); + + $msg->addText($this->message_path($this->mo)); + + $o->msg = $msg->render(); + $o->set_tagline = 'Why did the robot cross the road? The chicken programmed it.'; + + $o->save(); + + return $o; + } +} \ No newline at end of file