diff --git a/app/Classes/FTN/Process/Netmail/Areafix.php b/app/Classes/FTN/Process/Netmail/Areafix.php new file mode 100644 index 0000000..82356b1 --- /dev/null +++ b/app/Classes/FTN/Process/Netmail/Areafix.php @@ -0,0 +1,36 @@ +user_to) !== 'areafix') + return FALSE; + + Log::info(sprintf('%s:- Processing AREAFIX message from (%s) [%s]',self::LOGKEY,$msg->user_from,$msg->fftn)); + + // If this is not a node we manage, then respond with a sorry can help you + if ($msg->fftn_o->system->sessions->count()) + Notification::route('netmail',$msg->fftn_o)->notify(new AreafixNotification($msg)); + else + Notification::route('netmail',$msg->fftn_o)->notify(new AreafixNotConfiguredHereNotification($msg)); + + return TRUE; + } +} \ No newline at end of file diff --git a/app/Notifications/Netmails/Areafix.php b/app/Notifications/Netmails/Areafix.php new file mode 100644 index 0000000..07115ef --- /dev/null +++ b/app/Notifications/Netmails/Areafix.php @@ -0,0 +1,66 @@ +mo = $mo; + } + + /** + * Get the mail representation of the notification. + * + * @param System $so + * @param mixed $notifiable + * @return Netmail + * @throws \Exception + */ + public function toNetmail(System $so,object $notifiable): Netmail + { + $o = $this->setupNetmail($so,$notifiable); + $ao = $notifiable->routeNotificationFor(static::via); + + Log::info(sprintf('%s:+ Responding to areafix with netmail to [%s]',self::LOGKEY,$ao->ftn)); + + $o->to = $this->mo->user_from; + $o->replyid = $this->mo->msgid; + $o->subject = 'Ping Reply'; + + // Message + $msg = $this->page(FALSE,'Areafix'); + + $msg->addText("Your areafix request has been received, but unfortunately I do not know how to handle areafix messages yet.\r\r"); + $msg->addText(sprintf("Until then, you may be able to achieve what you want via the web UI. Head over to %s. Feel free to netmail if you need help.\r\r",config('app.url'))); + + $msg->addText($this->message_path($this->mo)); + + $o->msg = $msg->render(); + $o->tagline = 'Why did the robot cross the road? The chicken programmed it.'; + + $o->save(); + + return $o; + } +} \ No newline at end of file diff --git a/app/Notifications/Netmails/Areafix/NotConfiguredHere.php b/app/Notifications/Netmails/Areafix/NotConfiguredHere.php new file mode 100644 index 0000000..5e7c96e --- /dev/null +++ b/app/Notifications/Netmails/Areafix/NotConfiguredHere.php @@ -0,0 +1,66 @@ +mo = $mo; + } + + /** + * Get the mail representation of the notification. + * + * @param System $so + * @param mixed $notifiable + * @return Netmail + * @throws \Exception + */ + public function toNetmail(System $so,object $notifiable): Netmail + { + $o = $this->setupNetmail($so,$notifiable); + $ao = $notifiable->routeNotificationFor(static::via); + + Log::info(sprintf('%s:+ Responding to areafix for a node [%s] not configured here',self::LOGKEY,$ao->ftn)); + + $o->to = $this->mo->user_from; + $o->replyid = $this->mo->msgid; + $o->subject = 'Ping Reply'; + + // Message + $msg = $this->page(FALSE,'Areafix'); + + $msg->addText("Your areafix request has been received, but unfortunately you are not configured here.\r\r"); + $msg->addText(sprintf("If you want to receive mail from this system, please register/link your BBS via the web UI. Head over to %s. Feel free to netmail if you need help.\r\r",config('app.url'))); + + $msg->addText($this->message_path($this->mo)); + + $o->msg = $msg->render(); + $o->tagline = 'Why did the robot cross the road? The chicken programmed it.'; + + $o->save(); + + return $o; + } +} \ No newline at end of file diff --git a/app/Traits/MessagePath.php b/app/Traits/MessagePath.php index 212d46b..c56625c 100644 --- a/app/Traits/MessagePath.php +++ b/app/Traits/MessagePath.php @@ -42,7 +42,7 @@ trait MessagePath $reply .= "No path information? This would be normal if this message came directly to the hub\r"; } - $reply .= "+--[ END MESSAGE ]------------------------------------+\r"; + $reply .= "+--[ END MESSAGE ]------------------------------------+\r\r"; return $reply; } diff --git a/config/process.php b/config/process.php index 37a16a7..00a0e96 100644 --- a/config/process.php +++ b/config/process.php @@ -9,5 +9,6 @@ return [ // Netmail 'robots' => [ \App\Classes\FTN\Process\Netmail\Ping::class, + \App\Classes\FTN\Process\Netmail\Areafix::class, ], ]; \ No newline at end of file