From 06c29d875074007fe57e4f2dd8fee93ed7ab3554 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 7 Jun 2024 08:42:10 +1000 Subject: [PATCH] Updates to Message, Remove updated_at/mid from echomails/netmails, not used --- app/Classes/FTN/Message.php | 17 +++++++--- app/Models/Echomail.php | 1 + app/Models/Netmail.php | 1 + app/Traits/MessageAttributes.php | 2 +- .../2024_06_06_212553_remove_updated_at.php | 31 +++++++++++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2024_06_06_212553_remove_updated_at.php diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index f06de5d..d10c2bf 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -697,9 +697,14 @@ class Message extends FTNBase } // Catch any kludges we need to process here - if (array_key_exists($m[1],self::kludges)) + if (array_key_exists($m[1],self::kludges)) { + // Some earlier mystic message had a blank value for TZUTC + if ((($m[1]) === 'TZUTC:') && (! $m[2])) + $m[2] = '0000'; + $this->{self::kludges[$m[1]]} = $m[2]; - else + + } else $o->kludges = [$m[1],$m[2]]; } @@ -714,7 +719,7 @@ class Message extends FTNBase throw new InvalidPacketException('Couldnt find the end of the origin'); } elseif (! $ptr_end=strpos($message,"\r\x01",$ptr_start)) { - throw new InvalidPacketException('Couldnt parse the end of the content'); + $ptr_end = strlen($message); } $remaining = substr($message,$ptr_end+1); @@ -800,8 +805,10 @@ class Message extends FTNBase $o->msg = rtrim($o->msg,"\r"); // Quick validation that we are done - if ($ptr_content_start !== strlen($content)) - throw new InvalidPacketException('There is more data in the message content?'); + if ($ptr_content_start !== strlen($content)) { + Log::alert(sprintf('%s:! We failed parsing the message.',self::LOGKEY)); + $o->msg = substr($message,0,$ptr_end); + } } $ptr_start = $ptr_end+1; diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index ee50351..7764d45 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -19,6 +19,7 @@ final class Echomail extends Model implements Packet use SoftDeletes,MessageAttributes,MsgID,ParseAddresses,QueryCacheableConfig; private const LOGKEY = 'ME-'; + public const UPDATED_AT = NULL; private bool $no_export = FALSE; private const kludges = [ diff --git a/app/Models/Netmail.php b/app/Models/Netmail.php index 06ee9a0..a929b9f 100644 --- a/app/Models/Netmail.php +++ b/app/Models/Netmail.php @@ -20,6 +20,7 @@ final class Netmail extends Model implements Packet use SoftDeletes,MsgID,MessageAttributes; private const LOGKEY = 'MN-'; + public const UPDATED_AT = NULL; private const PATH_REGEX = '/^([0-9]+:[0-9]+\/[0-9]+(\..*)?)\s+@([0-9.a-zA-Z]+)\s+(.*)$/'; /** diff --git a/app/Traits/MessageAttributes.php b/app/Traits/MessageAttributes.php index 7d90971..94deb69 100644 --- a/app/Traits/MessageAttributes.php +++ b/app/Traits/MessageAttributes.php @@ -173,7 +173,7 @@ trait MessageAttributes public function rebuildMessage(): string { // If we have a msg_src attribute, we'll use that - $result = $this->msg."\r"; + $result = $this->msg."\r\r"; if ($x=$this->tagline) $result .= sprintf("%s\r",$x); diff --git a/database/migrations/2024_06_06_212553_remove_updated_at.php b/database/migrations/2024_06_06_212553_remove_updated_at.php new file mode 100644 index 0000000..a048c40 --- /dev/null +++ b/database/migrations/2024_06_06_212553_remove_updated_at.php @@ -0,0 +1,31 @@ +dropColumn(['updated_at','mid']); + $table->dropColumn(['origin','tagline','tearline']); + }); + Schema::table('netmails', function (Blueprint $table) { + $table->dropColumn(['updated_at','mid']); + $table->dropColumn(['origin','tagline','tearline']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +};