From 79e613a811a3ec07f666d17607f6e1425f6a14c5 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 12 Sep 2021 23:06:17 +1000 Subject: [PATCH] Allow for origin/tagline/tearline can have UTF8 chars, show # messages in packets --- app/Classes/FTN/Message.php | 7 +++++-- app/Classes/FTN/Packet.php | 2 +- app/Classes/File/Receive.php | 4 +++- app/Console/Commands/PacketInfo.php | 1 + app/Console/Commands/PacketProcess.php | 4 +++- app/Models/Echomail.php | 3 +++ app/Models/Netmail.php | 3 +++ 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index f499efd..e8d5ab9 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -22,14 +22,17 @@ use App\Traits\EncodeUTF8; */ class Message extends FTNBase { - private const LOGKEY = 'FM-'; - use EncodeUTF8; + private const LOGKEY = 'FM-'; + private const cast_utf8 = [ 'subject', 'message', 'message_src', + 'origin', + 'tearline', + 'tagline', ]; // Single value kludge items diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 8515a43..d63b2a4 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -445,7 +445,7 @@ class Packet extends FTNBase implements \Iterator, \Countable // This shouldnt happen if ($e || $ao->exists) { - Log::error(sprintf('%s:! Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss)); + Log::error(sprintf('%s:! Unexpected error attempting to create address [%s]',self::LOGKEY,$msg->fboss)); $this->errors->push($msg); return; } diff --git a/app/Classes/File/Receive.php b/app/Classes/File/Receive.php index 123c05e..c6c366c 100644 --- a/app/Classes/File/Receive.php +++ b/app/Classes/File/Receive.php @@ -133,8 +133,10 @@ final class Receive extends Item break; } + Log::info(sprintf('%s: - Packet has [%d] messages',self::LOGKEY,$po->count())); + // Queue messages if there are too many in the packet. - if ($queue = ($po->count() > config('app.queue_msgs'))) + $queue = ($po->count() > config('app.queue_msgs')); Log::info(sprintf('%s: - Messages will be sent to the queue for processing',self::LOGKEY)); foreach ($po as $msg) { diff --git a/app/Console/Commands/PacketInfo.php b/app/Console/Commands/PacketInfo.php index febbf22..ca291a6 100644 --- a/app/Console/Commands/PacketInfo.php +++ b/app/Console/Commands/PacketInfo.php @@ -45,6 +45,7 @@ class PacketInfo extends Command $this->info(sprintf('Tosser %d (%s) version %s',$pkt->software->code,$pkt->software->name,$pkt->software_ver)); $this->info(sprintf('Capabilities: %x',$pkt->capability)); $this->info(sprintf('Has Errors: %s',$pkt->errors->count() ? 'YES' : 'No')); + $this->info(sprintf('Messages: %d',$pkt->count())); foreach ($pkt as $msg) { $this->warn(sprintf('- Date: %s',$msg->date)); diff --git a/app/Console/Commands/PacketProcess.php b/app/Console/Commands/PacketProcess.php index e57eeb4..f76c1e9 100644 --- a/app/Console/Commands/PacketProcess.php +++ b/app/Console/Commands/PacketProcess.php @@ -43,8 +43,10 @@ class PacketProcess extends Command // @todo Quick check that the packet should be processed by us. // @todo validate that the packet's zone is in the domain. + $this->info(sprintf('Processing message from [%s] with msgid [%s]',$msg->fboss,$msg->msgid)); + // Dispatch job. - Job::dispatchSync($msg,$this->option('nobot')); + Job::dispatch($msg,$this->option('nobot')); } } } diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index f9e17ec..cd0e16d 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -24,6 +24,9 @@ final class Echomail extends Model implements Packet private const cast_utf8 = [ 'subject', 'msg', + 'origin', + 'tearline', + 'tagline', ]; protected $dates = ['datetime']; diff --git a/app/Models/Netmail.php b/app/Models/Netmail.php index c67f379..9ebfaf2 100644 --- a/app/Models/Netmail.php +++ b/app/Models/Netmail.php @@ -20,6 +20,9 @@ final class Netmail extends Model implements Packet private const cast_utf8 = [ 'subject', 'msg', + 'origin', + 'tearline', + 'tagline', ]; protected $dates = ['datetime','sent_at'];