From 29cbc80982f1fe4138dfc14cdafa5e1b9ec86d3a Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 7 Jan 2025 18:15:36 +1100 Subject: [PATCH] Fix adding FMPT/TOPT kludges for outgoing netmail --- app/Classes/FTN/Message.php | 41 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index 4e75745..9e8d219 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -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: (z:f/n.p) + * b MSGID Kludge "MSGID: z:f/n.p<@domain> + * 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);