clrghouz/app/Notifications/Echomails/Test.php
Deon George 35d9e5a5d5
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 39s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m41s
Create Docker Image / Final Docker Image Manifest (push) Successful in 12s
Automatically mark idle nodes HOLD/DOWN/DE-LIST. Automatically validate presented addresses.
2024-05-25 22:25:57 +10:00

83 lines
2.0 KiB
PHP

<?php
namespace App\Notifications\Echomails;
use Carbon\Carbon;
use Carbon\CarbonInterface;
use Illuminate\Support\Facades\Log;
use App\Classes\{Fonts\Thick,Fonts\Thin,Page};
use App\Models\{Echomail,Setup};
use App\Notifications\Echomails;
use App\Traits\MessagePath;
class Test extends Echomails
{
use MessagePath;
private const LOGKEY = 'NNP';
private Echomail $mo;
/**
* Reply to a netmail ping request.
*
* @param Echomail $mo
*/
public function __construct(Echomail $mo)
{
parent::__construct();
$this->mo = $mo;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return Echomail
* @throws \Exception
*/
public function toEchomail(object $notifiable): Echomail
{
$echoarea = $notifiable->routeNotificationFor(static::via);
$o = $this->setupEchomail($echoarea);
Log::info(sprintf('%s:+ Creating TEST echomail in [%s]',self::LOGKEY,$echoarea->name));
$o->to = $this->mo->from;
$o->fftn_id = ($x=our_address($this->mo->fftn))->id;
$o->replyid = $this->mo->msgid;
$o->subject = 'Test Reply';
$o->kludges->put('CHRS:',$this->mo->kludges->get('chrs') ?: 'CP437 2');
$o->origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$x->ftn4d);
// Message
$msg = new Page;
$header = new Thick;
$header->addText('Clearing Houz');
$msg->addHeader($header,'FTN Mailer and Tosser',TRUE,0xc4);
$lbc = new Thin;
$lbc->addText('Test');
$msg->addLeftBoxContent($lbc,TRUE);
$msg->addText(
sprintf("Your test was received here on %s and it looks like you sent it on %s. If that is correct, then it took %s to get here.\r\r",
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
$this->mo->date->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
)
);
$msg->addText($this->message_path($this->mo));
$o->msg = $msg->render();
$o->tagline = 'I ate a clock yesterday, it was very time-consuming.';
$o->save();
return $o;
}
}