Added %SCAN command, to send unsent mail from an area
This commit is contained in:
@@ -53,8 +53,6 @@ class Help extends Netmails
|
||||
$msg->addText("$command\r");
|
||||
}
|
||||
|
||||
$msg->addText("\r");
|
||||
|
||||
$o->msg = $msg->render();
|
||||
$o->set_tagline = 'Why did the robot cross the road? The chicken programmed it.';
|
||||
|
||||
|
68
app/Notifications/Netmails/Areafix/Scan.php
Normal file
68
app/Notifications/Netmails/Areafix/Scan.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Netmails\Areafix;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Notifications\Netmails;
|
||||
use App\Models\Netmail;
|
||||
use App\Traits\{MessagePath,PageTemplate};
|
||||
|
||||
class Scan extends Netmails
|
||||
{
|
||||
use MessagePath,PageTemplate;
|
||||
|
||||
private const LOGKEY = 'ACS';
|
||||
|
||||
/**
|
||||
* Reply to a areafix, commands unknown.
|
||||
*
|
||||
* @param Collection $result
|
||||
*/
|
||||
public function __construct(private Collection $result)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return Netmail
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toNetmail(object $notifiable): Netmail
|
||||
{
|
||||
$o = $this->setupNetmail($notifiable);
|
||||
$ao = $notifiable->routeNotificationFor(static::via);
|
||||
|
||||
Log::info(sprintf('%s:+ Responding to areafix for a node [%s] scan processed',self::LOGKEY,$ao->ftn));
|
||||
|
||||
$o->subject = 'Areafix - Scan Results';
|
||||
|
||||
// Message
|
||||
$msg = $this->page(FALSE,'Areafix');
|
||||
|
||||
$msg->addText("An areafix (re)Scan has completed:\r\r");
|
||||
|
||||
$msg->addText(sprintf("Area: %s, Queued: %d, Skipped: %d\r\r",
|
||||
$this->result->get('area'),
|
||||
$this->result->get('queued'),
|
||||
$this->result->get('skipped'),
|
||||
));
|
||||
|
||||
if ($x=$this->result->get('earliest'))
|
||||
$msg->addText(sprintf("The earliest message being sent: %s.\r",$x));
|
||||
|
||||
if (($x=$this->result->get('latest')) && ($this->result->get('earliest') !== $x))
|
||||
$msg->addText(sprintf("The latest message being sent: %s.\r",$x));
|
||||
|
||||
$o->msg = $msg->render();
|
||||
$o->set_tagline = 'Why did the robot cross the road? The chicken programmed it.';
|
||||
|
||||
$o->save();
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user