Show %AREA in area commands back to user

This commit is contained in:
Deon George 2024-11-01 08:15:32 +11:00
parent 1128bddcee
commit 247d30505e

View File

@ -35,6 +35,8 @@ class Area extends Base
public function process(): string public function process(): string
{ {
$command = self::command.' '.join(' ',$this->arguments);
// If command starts with '-', its to unsubscribe // If command starts with '-', its to unsubscribe
if (str_starts_with($this->arguments[0],'-')) { if (str_starts_with($this->arguments[0],'-')) {
$sub = FALSE; $sub = FALSE;
@ -61,7 +63,7 @@ class Area extends Base
if ($sub) { if ($sub) {
Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed->format('Y-m-d H:i'))); Log::debug(sprintf('%s:- FTN [%s] ALREADY subscribed to [%s] since [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$nea->pivot->subscribed->format('Y-m-d H:i')));
return sprintf('%-25s <-- ALREADY subscribed since %s',$area,$nea->pivot->subscribed->format('Y-m-d H:i')); return sprintf('%-25s <-- ALREADY subscribed since %s',$command,$nea->pivot->subscribed->format('Y-m-d H:i'));
// requesting to unsubscribe // requesting to unsubscribe
} else { } else {
@ -80,7 +82,7 @@ class Area extends Base
Log::debug(sprintf('%s:- FTN [%s] UNSUBSCRIBED from [%s] clearing [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$x)); Log::debug(sprintf('%s:- FTN [%s] UNSUBSCRIBED from [%s] clearing [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area,$x));
return sprintf('%-25s <-- UNSUBSCRIBED, CLEARED [%d] MSGS from queue',$area,$x); return sprintf('%-25s <-- UNSUBSCRIBED, CLEARED [%d] MSGS from queue',$command,$x);
} }
// If not subscribed // If not subscribed
@ -99,42 +101,42 @@ class Area extends Base
AreafixRescan::dispatch($this->mo->fftn,$ea,$m[2]) AreafixRescan::dispatch($this->mo->fftn,$ea,$m[2])
->onQueue('mail'); ->onQueue('mail');
return sprintf('%-25s <-- AREA SUBSCRIBED, RESCAN [%d] DAYS queued',$area,$m[2]); return sprintf('%-25s <-- SUBSCRIBED, RESCAN [%d] DAYS queued',$command,$m[2]);
// Scan // Scan
case 'R': case 'R':
AreafixRescan::dispatch($this->mo->fftn,$ea,$m[2],TRUE) AreafixRescan::dispatch($this->mo->fftn,$ea,$m[2],TRUE)
->onQueue('mail'); ->onQueue('mail');
return sprintf('%-25s <-- AREA SUBSCRIBED, FORCE RESCAN [%d] DAYS queued',$area,$m[2]); return sprintf('%-25s <-- SUBSCRIBED, FORCE RESCAN [%d] DAYS queued',$command,$m[2]);
} }
} }
return sprintf('%-25s <-- AREA SUBSCRIBED, INVALID OPTIONS',$area); return sprintf('%-25s <-- SUBSCRIBED, INVALID OPTIONS',$command);
} elseif (count($this->arguments) > 1) { } elseif (count($this->arguments) > 1) {
Log::debug(sprintf('%s:- FTN [%s] subscribed to [%s], extra commands [%s] ignored',self::LOGKEY,$this->mo->fftn->ftn,$area,implode('|',$this->arguments))); Log::debug(sprintf('%s:- FTN [%s] subscribed to [%s], extra commands [%s] ignored',self::LOGKEY,$this->mo->fftn->ftn,$area,join('|',$this->arguments)));
return sprintf('%-25s <-- AREA SUBSCRIBED, OPTIONS IGNORED',$area); return sprintf('%-25s <-- SUBSCRIBED, OPTIONS IGNORED',$command);
} else { } else {
Log::debug(sprintf('%s:- FTN [%s] subscribed to [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area)); Log::debug(sprintf('%s:- FTN [%s] subscribed to [%s]',self::LOGKEY,$this->mo->fftn->ftn,$area));
return sprintf('%-25s <-- AREA SUBSCRIBED',$area); return sprintf('%-25s <-- SUBSCRIBED',$command);
} }
// If not subscribed, "you arent subscribed, arguments ignored" // If not subscribed, "you arent subscribed, arguments ignored"
} else { } else {
Log::debug(sprintf('%s:- FTN [%s] is NOT subscribed to [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area)); Log::debug(sprintf('%s:- FTN [%s] is NOT subscribed to [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
return sprintf('%-25s <-- NOT subscribed, NO ACTION taken',$area); return sprintf('%-25s <-- NOT subscribed, NO ACTION taken',$command);
} }
} }
} else { } else {
Log::debug(sprintf('%s:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area)); Log::debug(sprintf('%s:- FTN [%s] area UNKNOWN [%s], NO ACTION taken',self::LOGKEY,$this->mo->fftn->ftn,$area));
return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$area); return sprintf('%-25s <-- AREA UNKNOWN, NO ACTION TAKEN',$command);
} }
} }
} }