Add packet name for incoming netmails, dont send back messages to sender for areafix messages

This commit is contained in:
Deon George
2023-01-24 22:37:41 +11:00
parent bc19f9aa82
commit 63e3397aee
5 changed files with 70 additions and 17 deletions

View File

@@ -21,12 +21,14 @@ class MessageProcess implements ShouldQueue
private Message $msg;
private bool $skipbot;
private string $packet;
public function __construct(Message $msg,bool $skipbot=FALSE)
public function __construct(Message $msg,string $packet,bool $skipbot=FALSE)
{
// Some checks
$this->msg = $msg;
$this->skipbot = $skipbot;
$this->packet = $packet;
}
/**
@@ -43,6 +45,9 @@ class MessageProcess implements ShouldQueue
// @todo Enable checks to reject duplicate
// @todo Enable checks to see if this is a file request or file send
$o = $this->create_netmail($this->msg);
$o->recv_pkt = $this->packet;
// Determine if the message is to this system, or in transit
if ($ftns->search(function($item) { return $this->msg->tftn == $item->ftn; }) !== FALSE) {
// @todo Check if it is a duplicate message
@@ -60,13 +65,17 @@ class MessageProcess implements ShouldQueue
// We'll ignore messages from *fix users
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 = $this->create_netmail($this->msg);
$o->local = TRUE;
$o->save();
Log::info(sprintf('%s:Ignoring Netmail [%d-%s] to the Hub from (%s) [%s] - its from a bot.',
self::LOGKEY,
$o->id,
$this->msg->msgid,
$this->msg->user_from,
$this->msg->fftn)
);
$processed = TRUE;
}
@@ -122,19 +131,19 @@ class MessageProcess implements ShouldQueue
// If in transit, store for collection
} else {
Log::info(sprintf('%s:Netmail [%s] in transit to (%s) [%s] from (%s) [%s].',
self::LOGKEY,
$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
$o = $this->create_netmail($this->msg);
$o->save();
Log::info(sprintf('%s:Netmail [%d-%s] in transit to (%s) [%s] from (%s) [%s].',
self::LOGKEY,
$o->id,
$this->msg->msgid,
$this->msg->user_to,$this->msg->tftn,
$this->msg->user_from,$this->msg->fftn,
));
}
// Else we are echomail
@@ -185,6 +194,7 @@ class MessageProcess implements ShouldQueue
// @todo This duplicate message may have gone via a different path, be nice to record it.
//$o->path()->sync($o->path->pluck('id')->merge($this->msg->pathaddress)->toArray());
// @todo if we have an export for any of the seenby addresses, remove it
// @todo add received packet details
$o->seenby()->sync($o->seenby->pluck('id')->merge($this->msg->seenaddress)->filter()->toArray());
return;