Show only validated addresses with packets for packet:system

This commit is contained in:
Deon George 2024-05-23 16:27:24 +10:00
parent 5fc69067fb
commit 710adad634

View File

@ -26,21 +26,31 @@ class PacketSystem extends Command
/** /**
* Execute the console command. * Execute the console command.
* *
* @return mixed * @return int
* @throws \App\Exceptions\InvalidPacketException * @throws \Exception
*/ */
public function handle() public function handle()
{ {
$ao = Address::findFTN($this->argument('ftn')); $ao = Address::findFTN($this->argument('ftn'));
foreach ($ao->system->addresses as $o) { foreach ($ao->system->addresses->where('validated',TRUE) as $o) {
$pkt = $o->getEchomail(); $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) { if ($pkt) {
foreach ($pkt as $msg) foreach ($pkt as $msg)
$this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id)); $this->warn(sprintf('- %s (%s)',$msg->msgid,$msg->id));
} }
} }
return self::SUCCESS;
} }
} }