list = $list; $this->since = $since; } /** * Get the mail representation of the notification. */ public function toNetmail(object $notifiable): Netmail { $o = $this->setupNetmail($notifiable); $ao = $notifiable->routeNotificationFor(static::via); Log::info(sprintf('%s:+ Sending a NEW NODE LIST to [%s] at address [%s]',self::LOGKEY,$ao->system->sysop,$ao->ftn)); $o->subject = sprintf('Here is a list of new nodes on clrghouz since %s',$x=$this->since->format('Y-m-d')); $o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH); // Message $msg = $this->page(FALSE,'new nodes'); $msg->addText(sprintf("Hi %s,\r\r",$ao->system->sysop)) ->addText(sprintf("The following new system have been defined on clrghouz since %s.\r\r",$x)); $this->list->loadMissing(['system']); $space = str_repeat(' ',$this->list->pluck('ftn4d')->max(fn($item)=>strlen($item))+2); $c = 0; foreach ($this->list as $oo) { if ($c++) $msg->addText("\r"); $msg->addText(sprintf("* %s - %s (%s) from %s.\r",$oo->ftn4D,$oo->system->sysop,$oo->system->name,$oo->system->location)); $msg->addText(sprintf("%s Address registered: %s\r\r",$space,$oo->created_at->format('Y-m-d'))); if ($oo->system->method) { switch ($oo->system->method) { case 23: $msg->addText(sprintf("%s - BBS is available TELNET [%s:%d]\r",$space,$oo->system->address,$oo->system->port)); break; case 22: $msg->addText(sprintf("%s - BBS is available SSH [%s:%d]\r",$space,$oo->system->address,$oo->system->port)); break; case 519: $msg->addText(sprintf("%s - BBS is available RLOGIN [%s:%d]\r",$space,$oo->system->address,$oo->system->port)); break; default: $msg->addText(sprintf("%s - No Details available for connecting to BBS\r",$space)); } } if ($oo->system->mailers->count()) { $msg->addText("\r"); $msg->addText(sprintf("%s - Mail can be sent using:\r",$space)); foreach ($oo->system->mailers as $mo) { $msg->addText(sprintf("%s * %s [%s:%d]\r",$space,$mo->name,$oo->system->address,$mo->pivot->port)); } } else { $msg->addText(sprintf("%s - No mailer information provided, so will be PRIVATE\r",$space)); } } $o->msg = $msg->render(); $o->set_tagline = 'All aboard!'; $o->save(); return $o; } }