Implemented filefix %SCAN/%RESCAN, and some cosmetic cleanup

This commit is contained in:
2024-11-28 22:07:39 +11:00
parent 0e1086c99f
commit ce19985c2d
13 changed files with 216 additions and 55 deletions

View File

@@ -25,7 +25,7 @@ final class Areafix extends Robot
if ((strtolower($mo->to) !== 'areafix') || (! ($mo instanceof Netmail)))
return FALSE;
Log::info(sprintf('%s:- Processing AREAFIX [%s] message from (%s) [%s]', self::LOGKEY, $mo->to, $mo->from, $mo->fftn->ftn));
Log::info(sprintf('%s:- Processing AREAFIX [%s] message from (%s) [%s]',self::LOGKEY,$mo->to,$mo->from,$mo->fftn->ftn));
return parent::handle($mo);
}
@@ -36,21 +36,32 @@ final class Areafix extends Robot
$result->push('--> BEGIN <--');
foreach ($mo->body_lines as $command) {
Log::debug(sprintf('%s:* Processing command [%s]',self::LOGKEY,$command));
// Skip empty lines
if (! $command)
if (! $command || preg_match('/^\s+$/',$command))
continue;
$command = explode(' ',strtoupper(trim($command)));
$command = explode(' ',strtoupper(rtrim($command)));
Log::debug(sprintf('%s:* Processing command',self::LOGKEY),['command'=>$command]);
// If command starts with '...' or '---', its a tear/tag line, and we have reached the end
if (str_starts_with($command[0],'...') || str_starts_with($command[0],'---')) {
Log::debug(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
Log::info(sprintf('%s:= We got a tearline/tagline, end of processing',self::LOGKEY));
$result->push('--> END OF PROCESSING <--');
$result->push('--> END OF PROCESSING - TEARLINE/TAGLINE <--');
break;
// If command doesnt start with %, its an area
// Lines starting with a space, we'll abort
} elseif (! $command[0]) {
Log::info(sprintf('%s:= Got a new line with a space, end of processing',self::LOGKEY));
$result->push('--> END OF PROCESSING - SPACE DETECTED <--');
break;
// 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]));