New algorithm for calculating packet name, EMSI/BINKP inbound processing tested, Netmail rejection and intransit processing
This commit is contained in:
@@ -7,9 +7,10 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Models\Setup;
|
||||
use App\Classes\FTN\{Message,Process};
|
||||
use App\Models\{Netmail,Setup};
|
||||
|
||||
class ProcessPacket implements ShouldQueue
|
||||
{
|
||||
@@ -34,6 +35,8 @@ class ProcessPacket implements ShouldQueue
|
||||
// If we are a netmail
|
||||
if ($this->msg->isNetmail()) {
|
||||
// @todo Enable checks to reject old messages
|
||||
// @todo Enable checks to reject duplicate
|
||||
// @todo Enable checks to see if this is a file request or file send
|
||||
|
||||
// Determine if the message is to this system, or in transit
|
||||
if ($ftns->search(function($item) { return $this->msg->tftn == $item->ftn; }) !== FALSE) {
|
||||
@@ -51,16 +54,74 @@ class ProcessPacket implements ShouldQueue
|
||||
|
||||
// If not processed, no users here!
|
||||
if (! $processed) {
|
||||
dump('message not processed, no users here');
|
||||
$reject = [
|
||||
'ÚÄ¿ÚÄ¿ ÂÚÄ¿ÚĿڿ',
|
||||
'³ ³ÄÙ ³³ÄÙ³ ³ ',
|
||||
'Á ÀÄÙÀÄÙÀÄÙÀÄÙ Á '
|
||||
];
|
||||
|
||||
Log::info(sprintf('Netmail to the Hub from (%s) [%s] but no users here.',$this->msg->user_from,$this->msg->fftn));
|
||||
|
||||
$reply = "Your Netmail was not processed by the hub and cannot be delivered to anybody (as there are no users here).\r";
|
||||
|
||||
$reply .= "\r";
|
||||
$reply .= "\r";
|
||||
$reply .= "This is your original message:\r";
|
||||
$reply .= "------------------------------ BEING MESSAGE ------------------------------\r";
|
||||
$reply .= sprintf("TO: %s\r",$this->msg->user_to);
|
||||
$reply .= sprintf("SUBJECT: %s\r",$this->msg->subject);
|
||||
$reply .= $this->msg->message;
|
||||
$reply .= "------------------------------ CONTROL LINES ------------------------------\r";
|
||||
$reply .= sprintf("DATE: %s\r",$this->msg->date->format('Y-m-d H:i:s'));
|
||||
$reply .= sprintf("MSGID: %s\r",$this->msg->msgid);
|
||||
|
||||
foreach ($this->msg->kludge as $k=>$v)
|
||||
$reply .= sprintf("@%s: %s\n",strtoupper($k),$v);
|
||||
foreach ($this->msg->via as $via)
|
||||
$reply .= sprintf("VIA: %s\n",$via);
|
||||
|
||||
$reply .= "------------------------------ END MESSAGE ------------------------------\r";
|
||||
|
||||
$o = new Netmail();
|
||||
$o->to = $this->msg->user_from;
|
||||
$o->from = Setup::PRODUCT_NAME;
|
||||
$o->subject = 'Message Undeliverable - '.$this->msg->msgid;
|
||||
$o->fftn_id = ($x=$this->msg->tftn_o) ? $x->id : NULL;
|
||||
$o->tftn_id = ($x=$this->msg->fftn_o) ? $x->id : NULL;
|
||||
$o->msg = Process::format_msg($reply,$reject);
|
||||
$o->reply = $this->msg->msgid;
|
||||
|
||||
$o->tagline = 'Do you think it was fate which brought us together? Nah, bad luck :(';
|
||||
$o->tearline = sprintf('--- %s (%s)',Setup::PRODUCT_NAME,(new Setup)->version);
|
||||
$o->save();
|
||||
}
|
||||
|
||||
// If in transit, store for collection
|
||||
} else {
|
||||
Log::info(sprintf('Netmail [%s] in transit to (%s) [%s] from (%s) [%s].',
|
||||
$this->msg->msgid,
|
||||
$this->msg->user_to,$this->msg->tftn,
|
||||
$this->msg->user_from,$this->msg->fftn,
|
||||
));
|
||||
|
||||
// @todo Check if the message is to a system we know about
|
||||
// @todo In transit loop checking
|
||||
// @todo In transit TRACE response
|
||||
|
||||
dump('netmail in transit');
|
||||
$o = new Netmail();
|
||||
$o->to = $this->msg->user_to;
|
||||
$o->from = $this->msg->user_from;
|
||||
$o->subject = $this->msg->subject;
|
||||
$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;
|
||||
$o->tearline = $this->msg->tearline;
|
||||
$o->origin = $this->msg->origin;
|
||||
$o->kluge = json_encode($this->msg->kludge);
|
||||
$o->flags = $this->msg->flags;
|
||||
$o->cost = $this->msg->cost;
|
||||
|
||||
$o->save();
|
||||
}
|
||||
|
||||
// Else we are echomail
|
||||
|
Reference in New Issue
Block a user