Rename PacketProcess, fix Packet::open now using Zone not Domain
This commit is contained in:
parent
ea6c0aab91
commit
01d54794a8
@ -10,7 +10,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
|||||||
|
|
||||||
use App\Classes\FTN\InvalidPacketException;
|
use App\Classes\FTN\InvalidPacketException;
|
||||||
use App\Classes\FTN\Packet;
|
use App\Classes\FTN\Packet;
|
||||||
use App\Jobs\ProcessPacket;
|
use App\Jobs\PacketProcess;
|
||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +112,7 @@ final class Receive extends Item
|
|||||||
Log::info(sprintf('%s: - Processing mail packet [%s]',self::LOGKEY,$this->file));
|
Log::info(sprintf('%s: - Processing mail packet [%s]',self::LOGKEY,$this->file));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$po = Packet::open(new File($this->file),$this->ao->zone->domain);
|
$po = Packet::open(new File($this->file),$this->ao->zone);
|
||||||
|
|
||||||
} catch (InvalidPacketException $e) {
|
} catch (InvalidPacketException $e) {
|
||||||
Log::error(sprintf('%s: - Not deleting packet [%s], as it generated an exception',self::LOGKEY,$this->file));
|
Log::error(sprintf('%s: - Not deleting packet [%s], as it generated an exception',self::LOGKEY,$this->file));
|
||||||
@ -145,9 +145,9 @@ final class Receive extends Item
|
|||||||
|
|
||||||
// Dispatch job.
|
// Dispatch job.
|
||||||
if ($queue)
|
if ($queue)
|
||||||
ProcessPacket::dispatch($msg);
|
PacketProcess::dispatch($msg);
|
||||||
else
|
else
|
||||||
ProcessPacket::dispatchSync($msg);
|
PacketProcess::dispatchSync($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($po->errors->count()) {
|
if ($po->errors->count()) {
|
||||||
|
@ -6,17 +6,17 @@ use Illuminate\Console\Command;
|
|||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
|
|
||||||
use App\Classes\FTN\Packet;
|
use App\Classes\FTN\Packet;
|
||||||
use App\Jobs\ProcessPacket as Job;
|
use App\Jobs\PacketProcess as Job;
|
||||||
use App\Models\Domain;
|
use App\Models\Zone;
|
||||||
|
|
||||||
class ProcessPacket extends Command
|
class PacketProcess extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'packet:process {pkt : Packet to process} {domain? : Domain the packet is from}';
|
protected $signature = 'packet:process {pkt : Packet to process} {zone? : Zone the packet is from}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -34,9 +34,9 @@ class ProcessPacket extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$f = new File($this->argument('pkt'));
|
$f = new File($this->argument('pkt'));
|
||||||
$d = $this->argument('domain') ? Domain::where('name',$this->argument('domain'))->singleOrFail() : NULL;
|
$z = $this->argument('zone') ? Zone::where('zone_id',$this->argument('zone'))->singleOrFail() : NULL;
|
||||||
|
|
||||||
foreach (Packet::open($f,$d) as $msg) {
|
foreach (Packet::open($f,$z) as $msg) {
|
||||||
// @todo Quick check that the packet should be processed by us.
|
// @todo Quick check that the packet should be processed by us.
|
||||||
// @todo validate that the packet's zone is in the domain.
|
// @todo validate that the packet's zone is in the domain.
|
||||||
|
|
@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use App\Classes\FTN\{Message,Process};
|
use App\Classes\FTN\{Message,Process};
|
||||||
use App\Models\{Echoarea,Echomail,Netmail,Setup};
|
use App\Models\{Echoarea,Echomail,Netmail,Setup};
|
||||||
|
|
||||||
class ProcessPacket implements ShouldQueue
|
class PacketProcess implements ShouldQueue
|
||||||
{
|
{
|
||||||
private const LOGKEY = 'PP-';
|
private const LOGKEY = 'PP-';
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class ProcessPacket implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When calling ProcessPacket - we assume that the packet is from a valid source
|
* When calling PacketProcess - we assume that the packet is from a valid source
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
Loading…
Reference in New Issue
Block a user