Start of processing packets - implemented PING Responce to Netmail
This commit is contained in:
@@ -4,13 +4,13 @@ namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Traits\{GetNode,ParseNodes};
|
||||
use App\Traits\ParseNodes;
|
||||
use App\Classes\FTNPacket;
|
||||
use App\Models\{Echomail,Netmail,Zone};
|
||||
|
||||
class ImportPacket extends Command
|
||||
{
|
||||
use GetNode,ParseNodes;
|
||||
use ParseNodes;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
|
47
app/Console/Commands/ProcessPacket.php
Normal file
47
app/Console/Commands/ProcessPacket.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
use App\Classes\FTN\Packet;
|
||||
use App\Jobs\ProcessPacket as Job;
|
||||
use App\Models\Domain;
|
||||
|
||||
class ProcessPacket extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'packet:process {pkt : Packet to process} {domain : Domain the packet is from}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Process Packet';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \App\Classes\FTN\InvalidPacketException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$f = new File($this->argument('pkt'));
|
||||
$d = Domain::where('name',$this->argument('domain'))->singleOrFail();
|
||||
|
||||
foreach ((Packet::open($f,$d))->messages as $msg) {
|
||||
// @todo Quick check that the packet should be processed by us.
|
||||
// @todo validate that the packet's zone is in the domain.
|
||||
|
||||
// Dispatch job.
|
||||
Job::dispatchSync($msg);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user