Fix sorting of seenby/path items in echomail/netmail. Add rogue_seenby to seenby in echomail

This commit is contained in:
2024-05-23 15:16:47 +10:00
parent dc212d35fb
commit 5fc69067fb
4 changed files with 40 additions and 6 deletions

View File

@@ -571,11 +571,27 @@ class Message extends FTNBase
} else {
// FTS-0004.001/FSC-0068.001 The message SEEN-BY 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
// @todo automatically include our address in the seenby/path
$return .= $this->aka_trim($this->mo->seenby,'SEEN-BY:')."\r";
$return .= "\x01".$this->aka_trim($this->mo->path,'PATH:')."\r";
$path = $this->mo->path->push($this->us)->filter(fn($item)=>($item->point_id === 0));
// Create our rogue seenby objects
$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";