Added %SCAN command, to send unsent mail from an area
This commit is contained in:
@@ -56,6 +56,7 @@ class Area extends Base
|
||||
// Drop the area from the arguments, the rest are options
|
||||
array_shift($this->arguments);
|
||||
|
||||
// Area exists
|
||||
if ($ea=$this->mo->fftn->domain->echoareas->where('name',$area)->pop()) {
|
||||
// If already subscribed
|
||||
if ($nea=$this->mo->fftn->echoareas->where('name',$area)->pop()) {
|
||||
|
@@ -30,11 +30,15 @@ class Help extends Base
|
||||
$result = collect();
|
||||
|
||||
foreach (preg_grep('/^([^.])/',scandir(self::areafix_classes)) as $file) {
|
||||
if ($file === 'Base.php')
|
||||
if (($file === 'Base.php') || (! str_ends_with(strtolower($file),'.php')))
|
||||
continue;
|
||||
|
||||
$class = Areafix::areafix_commands.preg_replace('/\.php$/','',$file);
|
||||
$result = $result->merge($class::help());
|
||||
if ($result->count())
|
||||
$result->push('');
|
||||
|
||||
$result = $result
|
||||
->merge($class::help());
|
||||
}
|
||||
|
||||
Notification::route('netmail',$this->mo->fftn)->notify(new HelpNotification($this->mo,$result));
|
||||
|
60
app/Classes/FTN/Process/Netmail/Robot/Areafix/Scan.php
Normal file
60
app/Classes/FTN/Process/Netmail/Robot/Areafix/Scan.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Jobs\AreafixRescan;
|
||||
|
||||
// SCAN - Send unsent echomail
|
||||
class Scan extends Base
|
||||
{
|
||||
private const LOGKEY = 'AFS';
|
||||
private const command = '%SCAN';
|
||||
|
||||
public static function help(): array
|
||||
{
|
||||
return [
|
||||
self::command.' [-|+]<ECHOAREA> [<DAYS>]',
|
||||
' Use the scan command to resend mail that you havent received yet from an',
|
||||
' echoarea. This is useful if you are rejoining an echoarea, and only want',
|
||||
' to get mail that you dont already have.',
|
||||
' Arguments:',
|
||||
' - ECHOAREA (required) name of area to subscribe or unsubscribe',
|
||||
' - DAYS (optional) number of days to resend mail from this area that you',
|
||||
' If DAYS is omitted, the default is 30',
|
||||
];
|
||||
}
|
||||
|
||||
public function process(): string
|
||||
{
|
||||
Log::debug(sprintf('%s:- Areafix [%s] for [%s] for [%s]',self::LOGKEY,self::command,$this->mo->fftn->ftn,join('|',$this->arguments)));
|
||||
|
||||
$command = self::command.' '.join(' ',$this->arguments);
|
||||
|
||||
if (! is_numeric($this->arguments[1]))
|
||||
return sprintf('%-25s <-- INVALID, DAYS [%s] NOT NUMERIC',$command,$this->arguments[1]);
|
||||
|
||||
// Area exists
|
||||
if ($ea=$this->mo->fftn->domain->echoareas->where('name',$this->arguments[0])->pop()) {
|
||||
// If already subscribed
|
||||
if ($this->mo->fftn->echoareas->pluck('name')->contains($this->arguments[0])) {
|
||||
AreafixRescan::dispatch($this->mo->fftn,$ea,$this->arguments[1])
|
||||
->onQueue('mail');
|
||||
|
||||
return sprintf('%-25s <-- SCAN [%d] DAYS queued',$command,$this->arguments[1]);
|
||||
|
||||
// If not subscribed
|
||||
} else {
|
||||
Log::debug(sprintf('%s:- FTN [%s] is NOT subscribed to [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0]));
|
||||
|
||||
return sprintf('%-25s <-- NOT subscribed, NO ACTION taken',$command);
|
||||
}
|
||||
|
||||
} else {
|
||||
Log::debug(sprintf('%s:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$this->arguments[0]));
|
||||
|
||||
return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$command);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user