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

@@ -50,7 +50,12 @@ class PacketAddress extends Command
exit(1);
}
echo hex_dump($ao->system->packet($ao)->generate($o->where('id',$this->argument('dbid'))->get()));
echo hex_dump($ao
->system
->packet($ao)
->mail($o->where('id',$this->argument('dbid'))->get())
->generate()
);
return Command::SUCCESS;
}

View File

@@ -99,8 +99,8 @@ class PacketInfo extends Command
foreach ($pkt->errors as $msg) {
$this->error(sprintf('- Date: %s',$msg->date));
$this->error(sprintf(' - FLAGS: %s',$msg->flags()->filter()->keys()->join(', ')));
$this->error(sprintf(' - From: %s (%s)',$msg->user_from,$msg->fftn));
$this->error(sprintf(' - To: %s (%s)',$msg->user_to,$msg->tftn));
$this->error(sprintf(' - From: %s (%s)',$msg->from,$msg->fftn));
$this->error(sprintf(' - To: %s (%s)',$msg->to,$msg->tftn));
$this->error(sprintf(' - Subject: %s',$msg->subject));
foreach ($msg->errors->errors()->all() as $error)

View File

@@ -10,6 +10,33 @@ use App\Classes\FTN\Packet;
use App\Jobs\PacketProcess as Job;
use App\Models\Address;
/**
* Things to test
* + Packet
* - Sender doesnt exist (try and send a bounce message in the same session)
* - Sender defined in DB by not ours
* - Sender has wrong password
* - Packet too old
*
* + Echomail
* - Area doesnt exist (to uplink)
* - Sender not subscribed (to uplink)
* - Sender cannot post (to uplink)
* - Sender has wrong address for echorea domain (to uplink)
* - Test message in echoarea
* - Echomail from address doesnt match packet envelope (to uplink)
* - Echomail too old (to uplink)
* - Rescanned dont generate notifications
* - Rescanned dont trigger bots
* - Some Notifications to an uplink should go to the admin instead?
*
* + Netmail
* - To hub, and user not defined (reject)
* - To hub, but user redirect (redirected)
* - To areafix (processed)
* - To ping (respond)
* - With trace turned on (respond)
*/
class PacketProcess extends Command
{
/**
@@ -38,25 +65,25 @@ class PacketProcess extends Command
*/
public function handle()
{
$fs = Storage::disk(config('fido.local_disk'));
//$fs = Storage::disk(config('fido.local_disk'));
$rel_name = sprintf('%s/%s',config('fido.dir'),$this->argument('file'));
$f = new File($fs->path($rel_name));
//$f = new File($fs->path($rel_name));
$m = [];
if ($this->argument('ftn')) {
$a = Address::findFTN($this->argument('ftn'));
$ao = Address::findFTN($this->argument('ftn'));
} elseif (preg_match(sprintf('/^%s\.(.{3})$/',Packet::regex),$this->argument('file'),$m)) {
$a = Address::findOrFail(hexdec($m[1]));
$ao = Address::findOrFail(hexdec($m[1]));
} else {
$this->error('Unable to determine sender FTN address');
exit(1);
}
$x = Job::dispatchSync($rel_name,$a->zone->domain,$this->option('dontqueue'));
Job::dispatchSync($rel_name,$ao->zone->domain,$this->option('dontqueue'));
dd(['job completed'=>$x]);
return Command::SUCCESS;
}
}

View File

@@ -4,7 +4,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\System;
use App\Models\Address;
class PacketSystem extends Command
{
@@ -14,7 +14,7 @@ class PacketSystem extends Command
* @var string
*/
protected $signature = 'packet:system'
.' {sid : System ID}';
.' {ftn : System address}';
/**
* The console command description.
@@ -31,15 +31,15 @@ class PacketSystem extends Command
*/
public function handle()
{
$so = System::findOrFail($this->argument('sid'));
$ao = Address::findFTN($this->argument('ftn'));
foreach ($so->addresses as $ao) {
$pkt = $ao->getEchomail(FALSE);
foreach ($ao->system->addresses as $o) {
$pkt = $o->getEchomail();
$this->info(sprintf('System address [%s] has [%d] messages.',$ao->ftn,$pkt?->count()));
if ($pkt) {
foreach ($pkt as $msg)
$this->warn(sprintf('- %s',$msg->msgid));
$this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id));
}
}
}