From 710adad63465f69a992506805ba1b16cf52e19ec Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 23 May 2024 16:27:24 +1000 Subject: [PATCH] Show only validated addresses with packets for packet:system --- app/Console/Commands/PacketSystem.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/PacketSystem.php b/app/Console/Commands/PacketSystem.php index e2b7d29..24637ba 100644 --- a/app/Console/Commands/PacketSystem.php +++ b/app/Console/Commands/PacketSystem.php @@ -26,21 +26,31 @@ class PacketSystem extends Command /** * Execute the console command. * - * @return mixed - * @throws \App\Exceptions\InvalidPacketException + * @return int + * @throws \Exception */ public function handle() { $ao = Address::findFTN($this->argument('ftn')); - foreach ($ao->system->addresses as $o) { + foreach ($ao->system->addresses->where('validated',TRUE) as $o) { $pkt = $o->getEchomail(); - $this->info(sprintf('System address [%s] has [%d] messages.',$ao->ftn,$pkt?->count())); + $this->info(sprintf('System address [%s] has [%d] echomail messages.',$o->ftn,$pkt?->count())); + + if ($pkt) { + foreach ($pkt as $msg) + $this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id)); + } + + $pkt = $o->getNetmail(); + $this->info(sprintf('System address [%s] has [%d] netmail messages.',$o->ftn,$pkt?->count())); if ($pkt) { foreach ($pkt as $msg) $this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id)); } } + + return self::SUCCESS; } } \ No newline at end of file