From 5e3b59ea7cf3528f266b9ae3cb40167e88801a92 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 25 Aug 2021 00:15:09 +1000 Subject: [PATCH] Add subject to encoding, some packet fixes missed in previous commit --- app/Classes/FTN/Message.php | 1 + app/Console/Commands/PacketInfo.php | 7 ++++--- app/Console/Commands/ProcessPacket.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index f63338c..7cb2b22 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -27,6 +27,7 @@ class Message extends FTNBase use EncodeUTF8; private const cast_utf8 = [ + 'subject', 'message', 'message_src', ]; diff --git a/app/Console/Commands/PacketInfo.php b/app/Console/Commands/PacketInfo.php index e15bae3..6dffaff 100644 --- a/app/Console/Commands/PacketInfo.php +++ b/app/Console/Commands/PacketInfo.php @@ -47,15 +47,16 @@ class PacketInfo extends Command $this->info(sprintf('Capabilities: %x',$pkt->capability)); $this->info(sprintf('Has Errors: %s',$pkt->errors->count() ? 'YES' : 'No')); - foreach ($pkt->messages as $msg) { + foreach ($pkt as $msg) { $this->warn(sprintf('- Date: %s',$msg->date)); $this->warn(sprintf(' - FLAGS: %s',$msg->flags()->filter()->keys()->join(', '))); $this->warn(sprintf(' - From: %s (%s)',$msg->user_from,$msg->fftn)); $this->warn(sprintf(' - To: %s (%s)',$msg->user_to,$msg->tftn)); $this->warn(sprintf(' - Subject: %s',$msg->subject)); - foreach ($msg->errors->errors()->all() as $error) - $this->line(' - '.$error); + if ($msg->errors) + foreach ($msg->errors->errors()->all() as $error) + $this->line(' - '.$error); } foreach ($pkt->errors as $msg) { diff --git a/app/Console/Commands/ProcessPacket.php b/app/Console/Commands/ProcessPacket.php index 57dfccd..9b21ab8 100644 --- a/app/Console/Commands/ProcessPacket.php +++ b/app/Console/Commands/ProcessPacket.php @@ -36,12 +36,12 @@ class ProcessPacket extends Command $f = new File($this->argument('pkt')); $d = Domain::where('name',$this->argument('domain'))->singleOrFail(); - foreach (Packet::open($f,$d)->messages as $msg) { + foreach (Packet::open($f,$d) 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); + Job::dispatch($msg); } } }