Fix sorting of seenby/path items in echomail/netmail. Add rogue_seenby to seenby in echomail
This commit is contained in:
parent
dc212d35fb
commit
5fc69067fb
@ -571,11 +571,27 @@ class Message extends FTNBase
|
|||||||
} else {
|
} else {
|
||||||
// FTS-0004.001/FSC-0068.001 The message SEEN-BY lines
|
// FTS-0004.001/FSC-0068.001 The message SEEN-BY lines
|
||||||
// FTS-0004.001/FSC-0068.001 The message PATH lines
|
// FTS-0004.001/FSC-0068.001 The message PATH lines
|
||||||
// @todo we need to include our rogue_seenbys
|
|
||||||
// @todo make sure a point is NOT in the seenby/path when exporting
|
$path = $this->mo->path->push($this->us)->filter(fn($item)=>($item->point_id === 0));
|
||||||
// @todo automatically include our address in the seenby/path
|
|
||||||
$return .= $this->aka_trim($this->mo->seenby,'SEEN-BY:')."\r";
|
// Create our rogue seenby objects
|
||||||
$return .= "\x01".$this->aka_trim($this->mo->path,'PATH:')."\r";
|
$seenby = $this->mo->seenby;
|
||||||
|
|
||||||
|
if ($this->mo->rogue_seenby->count()) {
|
||||||
|
$do = $this->mo->echoarea->domain;
|
||||||
|
|
||||||
|
foreach ($this->mo->rogue_seenby as $item)
|
||||||
|
$seenby->push(Address::newFTN(sprintf('%s@%s',$item,$do->name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$seenby = $seenby
|
||||||
|
->push($this->us)
|
||||||
|
->filter(fn($item)=>($item->point_id === 0))
|
||||||
|
->unique('ftn')
|
||||||
|
->sortBy(function($item) { return sprintf('%05d%05d',$item->host_id,$item->node_id);});
|
||||||
|
|
||||||
|
$return .= $this->aka_trim($seenby,'SEEN-BY:')."\r";
|
||||||
|
$return .= "\x01".$this->aka_trim($path,'PATH:')."\r";
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= "\00";
|
$return .= "\00";
|
||||||
|
@ -242,6 +242,22 @@ class Address extends Model
|
|||||||
return ($o && $o->system->active) ? $o : NULL;
|
return ($o && $o->system->active) ? $o : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function newFTN(string $address): self
|
||||||
|
{
|
||||||
|
$ftn = self::parseFTN($address);
|
||||||
|
$o = new self;
|
||||||
|
|
||||||
|
$zo = Zone::where('zone_id',$ftn['z'])->single();
|
||||||
|
|
||||||
|
$o->zone_id = $zo?->id;
|
||||||
|
$o->region_id = $ftn['r'];
|
||||||
|
$o->host_id = $ftn['n'];
|
||||||
|
$o->node_id = $ftn['f'];
|
||||||
|
$o->point_id = $ftn['p'];
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is to find an address for a domain (like fidonet), which is technically 2D even though it uses multiple zones.
|
* This is to find an address for a domain (like fidonet), which is technically 2D even though it uses multiple zones.
|
||||||
*
|
*
|
||||||
|
@ -222,7 +222,8 @@ final class Echomail extends Model implements Packet
|
|||||||
public function path()
|
public function path()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Address::class,'echomail_path')
|
return $this->belongsToMany(Address::class,'echomail_path')
|
||||||
->withPivot(['id','parent_id','recv_pkt','recv_at']);
|
->withPivot(['id','parent_id','recv_pkt','recv_at'])
|
||||||
|
->orderBy('id','DESC');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ATTRIBUTES */
|
/* ATTRIBUTES */
|
||||||
|
@ -179,6 +179,7 @@ final class Netmail extends Model implements Packet
|
|||||||
{
|
{
|
||||||
return $this->belongsToMany(Address::class,'netmail_path')
|
return $this->belongsToMany(Address::class,'netmail_path')
|
||||||
->withPivot(['id','parent_id','datetime','program','recv_pkt','recv_id'])
|
->withPivot(['id','parent_id','datetime','program','recv_pkt','recv_id'])
|
||||||
|
->orderBy('netmail_path.id')
|
||||||
->using(ViaPivot::class);
|
->using(ViaPivot::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user