Move process functions to Netmail/Echomail folders, optimize Netmail creation when processing messages
This commit is contained in:
parent
f91778b515
commit
5e8b590f17
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\FTN\Process;
|
||||
namespace App\Classes\FTN\Process\Echomail;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterface;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\FTN\Process;
|
||||
namespace App\Classes\FTN\Process\Netmail;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterface;
|
@ -61,20 +61,7 @@ class MessageProcess implements ShouldQueue
|
||||
if (in_array(strtolower($this->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;
|
||||
}
|
||||
}
|
@ -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,
|
||||
],
|
||||
];
|
Loading…
Reference in New Issue
Block a user