diff --git a/app/Classes/File/Receive.php b/app/Classes/File/Receive.php index 84f64db..33b525d 100644 --- a/app/Classes/File/Receive.php +++ b/app/Classes/File/Receive.php @@ -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()) { diff --git a/app/Console/Commands/ProcessPacket.php b/app/Console/Commands/PacketProcess.php similarity index 73% rename from app/Console/Commands/ProcessPacket.php rename to app/Console/Commands/PacketProcess.php index 362ee9c..05c347d 100644 --- a/app/Console/Commands/ProcessPacket.php +++ b/app/Console/Commands/PacketProcess.php @@ -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. diff --git a/app/Jobs/ProcessPacket.php b/app/Jobs/PacketProcess.php similarity index 98% rename from app/Jobs/ProcessPacket.php rename to app/Jobs/PacketProcess.php index 2589f4c..a4a22f5 100644 --- a/app/Jobs/ProcessPacket.php +++ b/app/Jobs/PacketProcess.php @@ -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() {