Rename PacketProcess, fix Packet::open now using Zone not Domain

This commit is contained in:
Deon George 2021-08-30 00:24:40 +10:00
parent ea6c0aab91
commit 01d54794a8
3 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileException;
use App\Classes\FTN\InvalidPacketException;
use App\Classes\FTN\Packet;
use App\Jobs\ProcessPacket;
use App\Jobs\PacketProcess;
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));
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) {
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.
if ($queue)
ProcessPacket::dispatch($msg);
PacketProcess::dispatch($msg);
else
ProcessPacket::dispatchSync($msg);
PacketProcess::dispatchSync($msg);
}
if ($po->errors->count()) {

View File

@ -6,17 +6,17 @@ 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;
use App\Jobs\PacketProcess as Job;
use App\Models\Zone;
class ProcessPacket extends Command
class PacketProcess 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}';
protected $signature = 'packet:process {pkt : Packet to process} {zone? : Zone the packet is from}';
/**
* The console command description.
@ -34,9 +34,9 @@ class ProcessPacket extends Command
public function handle()
{
$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 validate that the packet's zone is in the domain.

View File

@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Process};
use App\Models\{Echoarea,Echomail,Netmail,Setup};
class ProcessPacket implements ShouldQueue
class PacketProcess implements ShouldQueue
{
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()
{