Further enhancement with #9063a2a - to ensure our message addressing and content picks the right address

This commit is contained in:
2023-12-18 15:13:16 +11:00
parent 1ded66990c
commit 13e51724c0
34 changed files with 68 additions and 93 deletions

View File

@@ -846,6 +846,7 @@ class Address extends Model
* Netmail alerts waiting to be sent to this system
*
* @return Collection
* @throws \Exception
*/
public function netmailAlertWaiting(): Collection
{

View File

@@ -146,16 +146,6 @@ class Domain extends Model
*/
public function managed(): bool
{
static $so = NULL;
if (is_null($so))
$so = Setup::findOrFail(config('app.id'));
return $so
->system
->addresses
->where('zone.domain.active',TRUE)
->pluck('zone.domain_id')
->contains($this->id);
return our_address($this)->count() > 0;
}
}

View File

@@ -214,7 +214,7 @@ final class Echomail extends Model implements Packet
{
Log::info(sprintf('%s:+ Bundling [%s]',self::LOGKEY,$this->id));
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$sysaddress = our_address($this->fftn->zone->domain,$this->fftn);
if (! $sysaddress)
throw new \Exception(sprintf('%s:! We dont have an address in this network? (%s)',self::LOGKEY,$this->fftn->zone->domain->name));

View File

@@ -206,12 +206,11 @@ final class Netmail extends Model implements Packet
$o->tearline = $this->tearline;
// VIA kludge
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$via = $this->via ?: collect();
// Add our address to the VIA line
$via->push(
sprintf('%s @%s.UTC %s %d.%d/%s %s',
$sysaddress->ftn3d,
our_address($this->fftn->zone->domain,$this->fftn)->ftn3d,
Carbon::now()->utc()->format('Ymd.His'),
str_replace(' ','_',Setup::PRODUCT_NAME),
Setup::PRODUCT_VERSION_MAJ,

View File

@@ -65,7 +65,12 @@ class System extends Model
public function akas()
{
return $this->hasMany(Address::class)
->active()
->select('addresses.*')
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->where('addresses.active',TRUE)
->where('zones.active',TRUE)
->where('domains.active',TRUE)
->FTNorder()
->orderBy('role','ASC');
}