Added filefix %LIST

This commit is contained in:
2024-11-26 12:44:21 +11:00
parent b67ae28b98
commit a161b8fc5e
4 changed files with 146 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ final class Filefix extends Robot
break;
// If command doesnt start with %, its an area
// If command doesnt start with %, its an area
} elseif (! str_starts_with($command[0],'%')) {
Log::info(sprintf('%s:= Assuming command [%s] is an AREA command',self::LOGKEY,$command[0]));
@@ -60,7 +60,7 @@ final class Filefix extends Robot
// Some commands are reserved words
switch ($x=strtolower(substr($command[0],1))) {
case 'list':
$class = self::commands.'FileList';
$class = self::commands.'AreaList';
break;
default:

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Classes\FTN\Process\Netmail\Robot\Filefix;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Notification;
use App\Classes\FTN\Process\Netmail\Robot\Areafix\Base;
use App\Notifications\Netmails\Filefix\AreaList as AreaListNotification;
// LIST - List echoareas in a domain
class AreaList extends Base
{
private const LOGKEY = 'AFS';
private const command = '%LIST';
public static function help(): array
{
return [
self::command,
' List the available fileareas in this network',
];
}
public function process(): string
{
Log::debug(sprintf('%s:- Filefix [%s] for [%s] for [%s]',self::LOGKEY,self::command,$this->mo->fftn->ftn,join('|',$this->arguments)));
if (count($this->arguments) > 1)
return sprintf('%-25s <-- INVALID COMMAND',self::command);
else {
Notification::route('netmail',$this->mo->fftn)
->notify(new AreaListNotification($this->mo));
return sprintf('%-25s <-- COMMAND PROCESSED',self::command);
}
}
}