Fix adding FMPT/TOPT kludges for outgoing netmail
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m31s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2025-01-07 18:15:36 +11:00
parent bf446e1186
commit 29cbc80982

View File

@ -21,7 +21,31 @@ use App\Traits\ObjectIssetFix;
* Represents the structure of a message in a packet
*
* @note FTN packed echomail messages are ZONE agnostic.
* @package App\Classes
* @note FTN packed netmails may not have an INTL kludge
*
* We work out addresses using the following approach/priority:
* = By definition we should know the author node, because it's either ours or (will be) in the nodelist (but it might not be there yet)
* = The target node may not be in the nodelist (anymore)
*
* + Echomail - only has source addresses (MUST have an AREA: tag, otherwise its netmail))
* a Origin Line " * Origin: <some text> (z:f/n.p)
* b MSGID Kludge "MSGID: z:f/n.p<@domain> <sometext>
* c net/node from msg headers (dst should be to hub to be processed)
* d domain address from packet (2.2 only) (dst should be to hub to be processed)
* e point from packet (2+/2e/2.2) (dst should be to hub to be processed)
* f zone from (2/2+/2e/2.2) (dst should be to hub to be processed)
*
* RULES:
* + if a exists, c, e, f must match
* + if b exists, c, d (if present), e, f must match
*
* + Netmail
* a INTL kludge (may not exist)
* b FMPT/TOPT (points only)
* c src & dst net/node from msg headers
* d src domain address from packet (2.2 only) (dst is to next hop, not final destination)
* e src point from packet (2+/2e/2.2) (dst is to next hop, not final destination)
* f src zone from (2/2+/2e/2.2) (dst is to next hop, not final destination)
*/
class Message extends FTNBase
{
@ -141,7 +165,8 @@ class Message extends FTNBase
public static function header_len(): int
{
return collect(static::HEADER)->sum(function($item) { return Arr::get($item,2); });
return collect(static::HEADER)
->sum(fn($item)=>Arr::get($item,2));
}
/**
@ -372,12 +397,6 @@ class Message extends FTNBase
// Otherwise we'll assume the same as the source domain
return $this->fdomain ?: NULL;
case 'fftn_t':
case 'fftn':
case 'tftn_t':
case 'tftn':
return parent::__get($key);
// Convert our message (header[datetime]) with our TZUTC into a Carbon date
case 'datetime':
try {
@ -481,7 +500,7 @@ class Message extends FTNBase
return $this->kludges->get($key);
default:
throw new \Exception('Unknown key: '.$key);
return parent::__get($key);
}
}
@ -518,8 +537,8 @@ class Message extends FTNBase
$return .= $this->mo->from."\00";
$return .= $this->mo->subject."\00";
if (($this->mo instanceof Netmail) && $this->mo->isFlagSet(self::FLAG_LOCAL)) {
// Add our FMPT/TOPT kludges for netmails to a point
if ($this->mo instanceof Netmail) {
if ((! $this->mo->kludges->has('FMPT')) && $this->mo->fftn->point_id)
$this->mo->kludges->put('FMPT',$this->mo->fftn->point_id);