More complete rework of packet parsing and packet generation with 29710c

This commit is contained in:
2024-05-19 23:28:45 +10:00
parent 46f52dd56d
commit f279d85b08
43 changed files with 412 additions and 291 deletions

View File

@@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Echoarea, Echomail, Setup, System};
use App\Models\{Echoarea,Echomail,Setup};
abstract class Echomails extends Notification //implements ShouldQueue
{
@@ -46,26 +46,24 @@ abstract class Echomails extends Notification //implements ShouldQueue
*/
abstract public function toEchomail(object $notifiable): Echomail;
protected function setupEchomail(Message $mo,object $notifiable): Echomail
protected function setupEchomail(Echomail $mo,object $notifiable): Echomail
{
$echoarea = $notifiable->routeNotificationFor(static::via);
$eo = Echoarea::where('name',$echoarea)->singleOrFail();
$o = new Echomail;
$o->init();
$o->from = Setup::PRODUCT_NAME;
$o->replyid = $mo->msgid;
$o->echoarea_id = $eo->id;
$o->echoarea_id = $echoarea->id;
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->fftn_id = ($x=our_address($mo->fboss_o))->id;
$o->fftn_id = ($x=our_address($mo->fftn))->id;
$o->flags = (Message::FLAG_LOCAL);
$o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID);
$o->origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$x->ftn4d);
$o->kludges = collect(['chrs'=>$mo->kludge->get('chrs') ?: 'CP437 2']);
$o->kludges->put('CHRS:',$mo->kludges->get('chrs') ?: 'CP437 2');
return $o;
}