New attempt to making sure echomails have origin and senders path/seenby details (rework of #45d7823)

This commit is contained in:
Deon George 2023-11-22 13:14:21 +11:00
parent e8f4bf93bd
commit f639e3ffab
3 changed files with 36 additions and 17 deletions

View File

@ -364,26 +364,10 @@ class MessageProcess implements ShouldQueue
if ($x=$this->msg->fboss_o) { if ($x=$this->msg->fboss_o) {
$o->fftn_id = $x->id; $o->fftn_id = $x->id;
/*
// Make sure our sender and packet source are in the path
if (! $this->msg->path->contains($x->ftn)) {
Log::alert(sprintf('%s:? Echomail adding sender to PATH [%s].',self::LOGKEY,$x->ftn));
$this->msg->path->push($x->ftn);
}
*/
} else { } else {
$o->fftn_id = NULL; // @todo This should be the node that originated the message - but since that node is not in the DB it would be null $o->fftn_id = NULL; // @todo This should be the node that originated the message - but since that node is not in the DB it would be null
} }
/*
if (! $this->msg->path->contains($this->pktsrc->id)) {
Log::alert(sprintf('%s:? Echomail adding pktsrc to PATH [%s].',self::LOGKEY,$x->ftn));
$this->msg->path->push($this->pktsrc->id);
}
*/
$o->echoarea_id = $ea->id; $o->echoarea_id = $ea->id;
$o->msgid = $this->msg->msgid; $o->msgid = $this->msg->msgid;
$o->replyid = $this->msg->replyid; $o->replyid = $this->msg->replyid;
@ -395,6 +379,7 @@ class MessageProcess implements ShouldQueue
$o->set_path = $this->msg->path; $o->set_path = $this->msg->path;
$o->set_seenby = $this->msg->seenby; $o->set_seenby = $this->msg->seenby;
$o->set_recvtime = $this->recvtime; $o->set_recvtime = $this->recvtime;
$o->set_sender = $this->pktsrc->id;
// Record receiving packet and sender // Record receiving packet and sender
$o->set_pkt = $this->packet; $o->set_pkt = $this->packet;

View File

@ -24,6 +24,7 @@ final class Echomail extends Model implements Packet
private Collection $set_path; private Collection $set_path;
private Carbon $set_recvtime; private Carbon $set_recvtime;
private string $set_pkt; private string $set_pkt;
private string $set_sender;
private bool $no_export = FALSE; private bool $no_export = FALSE;
protected $casts = [ protected $casts = [
@ -52,6 +53,7 @@ final class Echomail extends Model implements Packet
case 'no_export': case 'no_export':
case 'set_path': case 'set_path':
case 'set_pkt': case 'set_pkt':
case 'set_sender':
case 'set_recvtime': case 'set_recvtime':
case 'set_seenby': case 'set_seenby':
$this->{$key} = $value; $this->{$key} = $value;
@ -69,13 +71,25 @@ final class Echomail extends Model implements Packet
// @todo if the message is updated with new SEEN-BY's from another route, we'll delete the pending export for systems (if there is one) // @todo if the message is updated with new SEEN-BY's from another route, we'll delete the pending export for systems (if there is one)
static::created(function($model) { static::created(function($model) {
$rogue = collect(); $rogue = collect();
$seenby = NULL; $seenby = collect();
$path = collect(); $path = collect();
// Parse PATH // Parse PATH
if ($model->set_path->count()) if ($model->set_path->count())
$path = self::parseAddresses('path',$model->set_path,$model->fftn->zone,$rogue); $path = self::parseAddresses('path',$model->set_path,$model->fftn->zone,$rogue);
// Make sure our sender is first in the path
if (! $path->contains($model->fftn_id)) {
Log::alert(sprintf('%s:? Echomail adding sender to start of PATH [%s].',self::LOGKEY,$model->fftn_id));
$path->prepend($model->fftn_id);
}
// Make sure our pktsrc is last in the path
if (isset($model->set_sender) && (! $path->contains($model->set_sender))) {
Log::alert(sprintf('%s:? Echomail adding pktsrc to end of PATH [%s].',self::LOGKEY,$model->set_sender));
$path->push($model->set_sender);
}
// Save the Path // Save the Path
$ppoid = NULL; $ppoid = NULL;
foreach ($path as $aoid) { foreach ($path as $aoid) {
@ -94,6 +108,18 @@ final class Echomail extends Model implements Packet
if ($model->set_seenby->count()) if ($model->set_seenby->count())
$seenby = self::parseAddresses('seenby',$model->set_seenby,$model->fftn->zone,$rogue); $seenby = self::parseAddresses('seenby',$model->set_seenby,$model->fftn->zone,$rogue);
// Make sure our sender is first in the seenby
if (! $seenby->contains($model->fftn_id)) {
Log::alert(sprintf('%s:? Echomail adding sender to SEENBY [%s].',self::LOGKEY,$model->fftn_id));
$seenby->push($model->fftn_id);
}
// Make sure our pktsrc is last in the seenby
if (isset($model->set_sender) && (! $seenby->contains($model->set_sender))) {
Log::alert(sprintf('%s:? Echomail adding pktsrc to SEENBY [%s].',self::LOGKEY,$model->set_sender));
$seenby->push($model->set_sender);
}
if (count($rogue)) { if (count($rogue)) {
$model->rogue_seenby = $rogue; $model->rogue_seenby = $rogue;
$model->save(); $model->save();

View File

@ -44,6 +44,10 @@ use App\Classes\FTN\Message;
<div class="col-8"> <div class="col-8">
SEENBY: <br><strong class="highlight">{!! optimize_path($msg->seenby->pluck('ftn2d'))->join('</strong>, <strong class="highlight">') !!}</strong> SEENBY: <br><strong class="highlight">{!! optimize_path($msg->seenby->pluck('ftn2d'))->join('</strong>, <strong class="highlight">') !!}</strong>
</div> </div>
@if ($msg->rogue_seenby->count())
<br><small>[<strong>NOTE</strong>: Some seen-by values couldnt be identified - ({{ $msg->rogue_seenby->join(',') }})]</small>
@endif
</div> </div>
@endif @endif
@ -59,6 +63,10 @@ use App\Classes\FTN\Message;
<div class="row pb-2"> <div class="row pb-2">
<div class="col-8"> <div class="col-8">
PATH: <br><strong class="highlight">{!! optimize_path($msg->pathorder())->join('</strong> -> <strong class="highlight">') !!}</strong> PATH: <br><strong class="highlight">{!! optimize_path($msg->pathorder())->join('</strong> -> <strong class="highlight">') !!}</strong>
@if ($msg->rogue_path->count())
<br><small>[<strong>NOTE</strong>: Some path values couldnt be identified - ({{ $msg->rogue_path->join(',') }})]</small>
@endif
</div> </div>
</div> </div>