From f142284a2bc29a243595e115b7adf40c5acb9a5a Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 12 Feb 2022 10:21:46 +1100 Subject: [PATCH] Understand some gated messages, that are gated from a different zone --- app/Classes/FTN/Message.php | 17 ++++++++++++++--- app/Jobs/MessageProcess.php | 9 +++++++-- resources/views/widgets/message.blade.php | 7 ++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index a1d4fa5..8b3c0cd 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -93,7 +93,8 @@ class Message extends FTNBase private string $subject; // Message subject private string $msgid; // MSG ID - private string $replyid; // Reply ID + private string $replyid; // Reply ID + private string $gateid; // MSG ID if the message came via gate private string $echoarea; // FTS-0004.001 private string $intl; // Netmail details @@ -182,6 +183,7 @@ class Message extends FTNBase $this->message = ''; $this->msgid = ''; + $this->gateid = ''; $this->replyid = ''; $this->echoarea = ''; @@ -373,6 +375,7 @@ class Message extends FTNBase case 'msgid': case 'replyid': + case 'gateid': case 'message': case 'message_src': @@ -411,6 +414,7 @@ class Message extends FTNBase case 'user_to': case 'subject': + case 'gateid': case 'msgid': case 'replyid': @@ -491,6 +495,9 @@ class Message extends FTNBase if ($this->replyid) $return .= sprintf("\01REPLY: %s\r",$this->replyid); + if ($this->gateid) + $return .= sprintf("\01GATE: %s\r",$this->gateid); + foreach ($this->_kludge as $k=>$v) { if ($x=$this->kludge->get($k)) $return .= sprintf("\01%s%s\r",$v,$x); @@ -803,6 +810,9 @@ class Message extends FTNBase elseif ($t = $this->kludge('MSGID: ',$kl)) $this->msgid = $t; + elseif ($t = $this->kludge('GATE: ',$kl)) + $this->gateid = $t; + elseif ($t = $this->kludge('PATH: ',$kl)) $this->path->push($t); @@ -827,9 +837,10 @@ class Message extends FTNBase // Work out our zone/point // http://ftsc.org/docs/fsc-0068.001 - // MSGID should be the basis of the source, we'll overrite our src from origin if we have it + // MSGID should be the basis of the source, we'll overwrite our src from origin if we have it + // If the message was gated, we'll use the gateid $m = []; - if ($this->msgid && preg_match('#([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?(\.[0-9]+)?@?([A-Za-z-_~]+)?\ +#',$this->msgid,$m)) { + if (($this->msgid || $this->gateid) && preg_match('#([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?(\.[0-9]+)?@?([A-Za-z-_~]+)?\ +#',$this->gateid ?: $this->msgid,$m)) { try { $this->src = Address::parseFTN($m[1].((isset($m[2]) && $m[2] != '') ? '.'.$m[2] : '').(isset($m[4]) ? '@'.$m[4] : '')); } catch (\Exception $e) { diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index 77a9bc0..aa0978f 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -142,7 +142,12 @@ class MessageProcess implements ShouldQueue ->where('domain_id',$this->msg->fboss_o->zone->domain_id) ->single(); - Log::debug(sprintf('%s: - Processing echomail [%s].',self::LOGKEY,$this->msg->msgid)); + if (! $ea) { + Log::alert(sprintf('%s:! Echo area [%s] doesnt exist for zone [%s]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->domain_id)); + return; + } + + Log::debug(sprintf('%s: - Processing echomail [%s] in [%s].',self::LOGKEY,$this->msg->msgid,$this->msg->echoarea)); // Check for duplicate messages // FTS-0009.001 @@ -207,7 +212,7 @@ class MessageProcess implements ShouldQueue $o->tzoffset = $this->msg->date->utcOffset(); $o->fftn_id = ($x=$this->msg->fboss_o) ? $x->id : NULL; // @todo This should be the node that originated the message - but since that node is not in the DB it would be null - $o->echoarea_id = $ea?->id; + $o->echoarea_id = $ea->id; $o->msgid = $this->msg->msgid; $o->msg = $this->msg->message_src; diff --git a/resources/views/widgets/message.blade.php b/resources/views/widgets/message.blade.php index bb8b61b..6d989cc 100644 --- a/resources/views/widgets/message.blade.php +++ b/resources/views/widgets/message.blade.php @@ -17,9 +17,14 @@
-
+
SUBJECT: {!! \App\Classes\FTN\Message::tr($msg->subject) !!}
+ @if ($msg instanceof \App\Models\Echomail) +
+ ECHOAREA: {{ $msg->echoarea->name }} ({{ $msg->echoarea->domain->name }}) +
+ @endif