Process packet seenby/path/via lines when saving echomail/netmail

This commit is contained in:
2023-09-20 20:29:23 +10:00
parent 7fedf88d8c
commit 612efda945
11 changed files with 337 additions and 230 deletions

View File

@@ -6,7 +6,7 @@ use Illuminate\Console\Command;
use App\Classes\File;
use App\Classes\FTN\Packet;
use App\Models\System;
use App\Models\Address;
class PacketInfo extends Command
{
@@ -17,7 +17,7 @@ class PacketInfo extends Command
*/
protected $signature = 'packet:info'
.' {file : Packet to process}'
.' {system? : System the packet is from}';
.' {ftn? : FTN the packet is from}';
/**
* The console command description.
@@ -35,10 +35,10 @@ class PacketInfo extends Command
public function handle()
{
$f = new File($this->argument('file'));
$s = $this->argument('system') ? System::where('name',$this->argument('system'))->singleOrFail() : NULL;
$a = $this->argument('ftn') ? Address::findFTN($this->argument('ftn')) : NULL;
foreach ($f as $packet) {
$pkt = Packet::process($packet,$x=$f->itemName(),$f->itemSize(),$s);
$pkt = Packet::process($packet,$x=$f->itemName(),$f->itemSize(),$a->zone->domain);
$this->alert(sprintf('File Name: %s',$x));

View File

@@ -34,6 +34,7 @@ class PacketProcess extends Command
*
* @return mixed
* @throws \App\Classes\FTN\InvalidPacketException
* @todo Should this just call PacketProcess instead?
*/
public function handle()
{
@@ -41,14 +42,12 @@ class PacketProcess extends Command
$a = Address::findFTN($this->argument('ftn'));
foreach ($f as $packet) {
foreach (Packet::process($packet,$f->itemName(),$f->itemSize(),$a->system) as $msg) {
foreach ($pkt = Packet::process($packet,$f->itemName(),$f->itemSize(),$a->zone->domain) as $msg) {
// @todo Quick check that the packet should be processed by us.
// @todo validate that the packet's zone is in the domain.
$this->info(sprintf('Processing message from [%s] with msgid [%s] in (%s)',$msg->fboss,$msg->msgid,$f->pktName()));
// Dispatch job.
Job::dispatchSync($msg,$f->pktName(),$a,$a,Carbon::now(),$this->option('nobot'));
Job::dispatchSync($msg,$f->pktName(),$a,$pkt->fftn_o,Carbon::now(),$this->option('nobot'));
}
}
}