Multiple enhancements to interactive messages, moved messages to Notifications, send netmail back when invalid packet password

This commit is contained in:
2023-07-23 17:27:52 +10:00
parent 9f0fa0a8ec
commit 17fe7e910d
28 changed files with 837 additions and 475 deletions

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Notifications;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Netmail,Setup,System};
abstract class Netmails extends Notification //implements ShouldQueue
{
use Queueable;
protected const via = 'netmail';
private const LOGKEY = 'NN-';
/**
* Create a new notification instance.
*/
public function __construct()
{
$this->queue = 'netmail';
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [ self::via ];
}
/**
* Get the mail representation of the notification.
*
* @param System $so
* @param mixed $notifiable
* @return Netmail
* @throws \Exception
*/
abstract public function toNetmail(System $so,object $notifiable): Netmail;
protected function setupNetmail(System $so,object $notifiable): Netmail
{
$ao = $notifiable->routeNotificationFor(static::via);
$o = new Netmail;
$o->to = $ao->system->sysop;
$o->from = Setup::PRODUCT_NAME;
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->fftn_id = $so->match($ao->zone)->first()->id;
$o->tftn_id = $ao->id;
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE);
$o->cost = 0;
$o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID);
return $o;
}
}