diff --git a/app/Classes/FTN/Process/Test.php b/app/Classes/FTN/Process/Echomail/Test.php similarity index 98% rename from app/Classes/FTN/Process/Test.php rename to app/Classes/FTN/Process/Echomail/Test.php index e98caae..078f590 100644 --- a/app/Classes/FTN/Process/Test.php +++ b/app/Classes/FTN/Process/Echomail/Test.php @@ -1,6 +1,6 @@ msg->user_from),['filefix','areafix'])) { Log::info(sprintf('Ignoring Netmail to the Hub from (%s) [%s] - its from a bot.',$this->msg->user_from,$this->msg->fftn)); - $o = new Netmail; - $o->to = $this->msg->user_to; - $o->from = $this->msg->user_from; - $o->subject = $this->msg->subject; - $o->datetime = $this->msg->date; - $o->tzoffset = $this->msg->date->utcOffset(); - - $o->flags = $this->msg->flags; - $o->cost = $this->msg->cost; - $o->msgid = $this->msg->msgid; - - $o->fftn_id = ($x=$this->msg->fftn_o) ? $x->id : NULL; - $o->tftn_id = ($x=$this->msg->tftn_o) ? $x->id : NULL; - $o->msg = $this->msg->message_src; + $o = $this->create_netmail($this->msg); $o->local = TRUE; $o->save(); @@ -144,21 +131,7 @@ class MessageProcess implements ShouldQueue // @todo In transit loop checking // @todo In transit TRACE response - $o = new Netmail; - $o->to = $this->msg->user_to; - $o->from = $this->msg->user_from; - $o->subject = $this->msg->subject; - $o->datetime = $this->msg->date; - $o->tzoffset = $this->msg->date->utcOffset(); - - $o->flags = $this->msg->flags; - $o->cost = $this->msg->cost; - $o->msgid = $this->msg->msgid; - - $o->fftn_id = ($x=$this->msg->fftn_o) ? $x->id : NULL; - $o->tftn_id = ($x=$this->msg->tftn_o) ? $x->id : NULL; - $o->msg = $this->msg->message_src; - + $o = $this->create_netmail($this->msg); $o->save(); } @@ -229,4 +202,26 @@ class MessageProcess implements ShouldQueue } } } + + private function create_netmail(Message $msg): Netmail + { + $o = new Netmail; + $o->to = $msg->user_to; + $o->from = $msg->user_from; + + $o->fftn_id = ($x=$msg->fftn_o) ? $x->id : NULL; + $o->tftn_id = ($x=$msg->tftn_o) ? $x->id : NULL; + + $o->datetime = $msg->date; + $o->tzoffset = $msg->date->utcOffset(); + + $o->flags = $msg->flags; + $o->cost = $msg->cost; + $o->msgid = $msg->msgid; + + $o->subject = $msg->subject; + $o->msg = $msg->message_src; + + return $o; + } } \ No newline at end of file diff --git a/config/process.php b/config/process.php index 059804b..e8ac22f 100644 --- a/config/process.php +++ b/config/process.php @@ -3,11 +3,11 @@ return [ // Echmail 'echomail' => [ - \App\Classes\FTN\Process\Test::class, + \App\Classes\FTN\Process\Echomail\Test::class, ], // Netmail 'robots' => [ - \App\Classes\FTN\Process\Ping::class, + \App\Classes\FTN\Process\Netmail\Ping::class, ], ]; \ No newline at end of file