Auto create nodes that are discovered by message packets
This commit is contained in:
@@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Validator as ValidatorResult;
|
||||
|
||||
use App\Classes\FTN as FTNBase;
|
||||
use App\Models\{Address,Zone};
|
||||
use App\Models\{Address,Domain,Zone};
|
||||
use App\Rules\TwoByteInteger;
|
||||
use App\Traits\EncodeUTF8;
|
||||
|
||||
@@ -283,6 +283,35 @@ class Message extends FTNBase
|
||||
case 'fn': return $this->src ? Arr::get($this->src,'n') : Arr::get($this->header,'onet');;
|
||||
case 'ff': return $this->src ? Arr::get($this->src,'f') : Arr::get($this->header,'onode');;
|
||||
case 'fp': return Arr::get($this->src,'p');
|
||||
case 'fd': return Arr::get($this->src,'d');
|
||||
|
||||
case 'fdomain':
|
||||
// We'll use the zone's domain if this method class was called with a zone
|
||||
if ($this->zone && ($this->zone->domain->name == Arr::get($this->src,'d')))
|
||||
return $this->zone->domain;
|
||||
|
||||
// If we get the domain from the packet, we'll find it
|
||||
if ($x=Arr::get($this->src,'d')) {
|
||||
return Domain::where('name',$x)->single();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
case 'fzone':
|
||||
// Use the zone if this class was called with it.
|
||||
if ($this->zone && ($this->fz == $this->zone->zone_id))
|
||||
return $this->zone;
|
||||
|
||||
// If we have a domain, we'll use the zone from the domain
|
||||
if ($x=$this->fdomain) {
|
||||
if (($x=$this->fdomain->zones->search(function($item) { return $item->zone_id == $this->fz; })) !== FALSE)
|
||||
return $this->fdomain->zones->get($x);
|
||||
}
|
||||
|
||||
// No domain, so we'll use the default zone
|
||||
return Zone::where('zone_id',$this->fz)
|
||||
->where('default',TRUE)
|
||||
->single();
|
||||
|
||||
// To Addresses
|
||||
// Echomail doesnt have a zone, so we'll use the source zone
|
||||
@@ -485,7 +514,7 @@ class Message extends FTNBase
|
||||
/**
|
||||
* Return an array of flag descriptions
|
||||
*
|
||||
* @return array
|
||||
* @return Collection
|
||||
*
|
||||
* http://ftsc.org/docs/fsc-0001.000
|
||||
* AttributeWord bit meaning
|
||||
@@ -762,7 +791,7 @@ class Message extends FTNBase
|
||||
|
||||
// Otherwise get it from our zone object and packet header
|
||||
} elseif ($this->zone) {
|
||||
$this->src = Address::parseFTN(sprintf('%d:%d/%d.%d',$this->zone->zone_id,$this->fn,$this->ff,$this->fp));
|
||||
$this->src = Address::parseFTN(sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->fn,$this->ff,$this->fp,$this->zone->domain->name));
|
||||
}
|
||||
|
||||
// Parse SEEN-BY
|
||||
|
Reference in New Issue
Block a user