From 8b8b513ed1815fcc25a9d83e17d8b943e5c5ad25 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 14 Sep 2021 23:14:13 +1000 Subject: [PATCH] Add kludge to Test responses --- app/Classes/FTN/Message.php | 2 ++ app/Classes/FTN/Process/Echomail/Test.php | 1 + app/Models/Echomail.php | 10 ++++++++++ config/process.php | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index c8998e3..af64b9a 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -190,6 +190,7 @@ class Message extends FTNBase $this->dst = []; $this->point = []; + $this->kludge = collect(); $this->rescanned = collect(); $this->path = collect(); $this->seenby = collect(); @@ -408,6 +409,7 @@ class Message extends FTNBase case 'message': + case 'kludge': case 'tagline': case 'tearline': case 'origin': diff --git a/app/Classes/FTN/Process/Echomail/Test.php b/app/Classes/FTN/Process/Echomail/Test.php index 078f590..9869959 100644 --- a/app/Classes/FTN/Process/Echomail/Test.php +++ b/app/Classes/FTN/Process/Echomail/Test.php @@ -74,6 +74,7 @@ final class Test extends Process $o->tagline = 'I ate a clock yesterday, it was very time-consuming.'; $o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID); $o->origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$ftns->ftn4d); + $o->kludges = collect(['chrs'=>$msg->kludge->get('chrs') ?: 'CP437 2']); $o->save(); return TRUE; diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index cd0e16d..1c1153e 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -21,6 +21,8 @@ final class Echomail extends Model implements Packet protected $collection = FALSE; + protected $casts = [ 'kludges' => 'json' ]; + private const cast_utf8 = [ 'subject', 'msg', @@ -84,6 +86,11 @@ final class Echomail extends Model implements Packet /* ATTRIBUTES */ + public function getKludgesAttribute(string $value): Collection + { + return collect($this->castAttribute('kludges',$value)); + } + public function getPathAttribute(?array $value): Collection { if (is_null($value)) @@ -136,6 +143,9 @@ final class Echomail extends Model implements Packet $o->echoarea = $this->echoarea->name; $o->flags = $this->flags; + if ($this->kludges) + $o->kludge = $this->kludges; + $o->kludge->put('mid',$this->id); $o->msgid = $this->msgid; diff --git a/config/process.php b/config/process.php index e8ac22f..37a16a7 100644 --- a/config/process.php +++ b/config/process.php @@ -1,7 +1,7 @@ [ \App\Classes\FTN\Process\Echomail\Test::class, ],