More work to decommission rogue_path
This commit is contained in:
@@ -12,7 +12,7 @@ use Illuminate\Validation\Validator as ValidatorResult;
|
||||
|
||||
use App\Classes\FTN as FTNBase;
|
||||
use App\Http\Controllers\DomainController;
|
||||
use App\Models\{Address,Domain,Zone};
|
||||
use App\Models\{Address,Domain,System,Zone};
|
||||
use App\Rules\{TwoByteInteger,TwoByteIntegerWithZero};
|
||||
use App\Traits\EncodeUTF8;
|
||||
|
||||
@@ -139,10 +139,9 @@ class Message extends FTNBase
|
||||
private Collection $rescanned; // Message was created as a result of a rescan
|
||||
private Collection $path; // FTS-0004.001 The message PATH lines
|
||||
private Collection $pathaddress; // Collection of Addresses after parsing seenby
|
||||
private Collection $rogue_path; // Collection of FTNs in the Seen-by that are not defined
|
||||
private Collection $rogue_seenby; // Collection of FTNs in the Seen-by that are not defined
|
||||
private Collection $seenby; // FTS-0004.001 The message SEEN-BY lines
|
||||
private Collection $seenaddress; // Collection of Addresses after parsing seenby
|
||||
private Collection $rogue_seenby; // Collection of FTNs in the Seen-by that are not defined
|
||||
private Collection $via; // The path the message has gone using Via lines (Netmail)
|
||||
private Collection $unknown; // Temporarily hold attributes we have no logic for.
|
||||
|
||||
@@ -225,11 +224,10 @@ class Message extends FTNBase
|
||||
$this->kludge = collect();
|
||||
$this->rescanned = collect();
|
||||
$this->path = collect();
|
||||
$this->rogue_seenby = collect();
|
||||
$this->seenby = collect();
|
||||
$this->seenaddress = collect();
|
||||
$this->pathaddress = collect();
|
||||
$this->rogue_seenby = collect();
|
||||
$this->rogue_path = collect();
|
||||
$this->via = collect();
|
||||
$this->unknown = collect();
|
||||
}
|
||||
@@ -367,9 +365,8 @@ class Message extends FTNBase
|
||||
case 'path':
|
||||
case 'seenby':
|
||||
case 'pathaddress':
|
||||
case 'seenaddress':
|
||||
case 'rogue_path':
|
||||
case 'rogue_seenby':
|
||||
case 'seenaddress':
|
||||
case 'unknown':
|
||||
case 'via':
|
||||
|
||||
@@ -697,46 +694,47 @@ class Message extends FTNBase
|
||||
$node = (int)$item;
|
||||
}
|
||||
|
||||
$aoid = NULL;
|
||||
|
||||
// If domain should be flattened, look for node regardless of zone (within the list of zones for the domain)
|
||||
if ($this->fdomain && $this->fdomain->flatten) {
|
||||
$ao = Address::findZone($this->fdomain,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX,0);
|
||||
$ftn = sprintf('%d:%d/%d@%s',$this->fz,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX,$this->fdomain->name);
|
||||
|
||||
$ftn = sprintf('%d:%d/%d@%s',0,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX,$this->fdomain->name);
|
||||
$aoid = $ao?->id;
|
||||
|
||||
} elseif ($this->fdomain) {
|
||||
$ftn = sprintf('%d:%d/%d@%s',$this->fz,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX,$this->fdomain->name);
|
||||
|
||||
} else {
|
||||
$ftn = sprintf('%d:%d/%d',$this->fz,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX);
|
||||
$aoid = NULL;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'path':
|
||||
if (! $aoid) {
|
||||
$ao = (Address::findFTN($ftn,TRUE));
|
||||
$aoid = $ao?->id;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'seenby':
|
||||
if (! $aoid) {
|
||||
$ao = (Address::findFTN($ftn));
|
||||
$aoid = $ao?->id;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \Exception('Unknown type: '.$type);
|
||||
}
|
||||
|
||||
if (! $aoid) {
|
||||
Log::alert(sprintf('%s:! Undefined Node [%s] in [%s].',self::LOGKEY,$ftn,$type));
|
||||
$rogue->push($ftn);
|
||||
if (! ($ao=Address::findFTN($ftn))) {
|
||||
Log::alert(sprintf('%s:! Undefined Node [%s] in [%s] - auto created.',self::LOGKEY,$ftn,$type));
|
||||
|
||||
} else {
|
||||
$nodes->push($aoid);
|
||||
$ao = Address::createFTN($ftn,System::createUnknownSystem());
|
||||
}
|
||||
|
||||
$aoid = $ao?->id;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'seenby':
|
||||
if (! $ao) {
|
||||
$rogue->push(sprintf('%d:%d/%d',$this->fz,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX));
|
||||
continue 2;
|
||||
}
|
||||
|
||||
case 'path':
|
||||
if (! $aoid)
|
||||
throw new \Exception(sprintf('Didnt get an address for [%s]',$ftn));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$nodes->push($aoid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,11 +791,10 @@ class Message extends FTNBase
|
||||
* <FTN Address> @YYYYMMDD.HHMMSS[.Precise][.Time Zone] <Program Name> <Version> [Serial Number]
|
||||
*
|
||||
* @param Collection $via
|
||||
* @param Collection $rogue
|
||||
* @return Collection
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function parseVia(Collection $via,Collection &$rogue): Collection
|
||||
private function parseVia(Collection $via): Collection
|
||||
{
|
||||
$nodes = collect();
|
||||
|
||||
@@ -1017,13 +1014,14 @@ class Message extends FTNBase
|
||||
if ($this->seenby->count())
|
||||
$this->seenaddress = $this->parseAddresses('seenby',$this->seenby,$this->rogue_seenby);
|
||||
|
||||
$dummy = collect();
|
||||
// Parse PATH
|
||||
if ($this->path->count())
|
||||
$this->pathaddress = $this->parseAddresses('path',$this->path,$this->rogue_path);
|
||||
$this->pathaddress = $this->parseAddresses('path',$this->path,$dummy);
|
||||
|
||||
// Parse VIA
|
||||
if ($this->via->count())
|
||||
$this->pathaddress = $this->parseVia($this->via,$this->rogue_path);
|
||||
$this->pathaddress = $this->parseVia($this->via);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user