Add kludge to Test responses

This commit is contained in:
Deon George 2021-09-14 23:14:13 +10:00
parent 2cd6db2060
commit 8b8b513ed1
4 changed files with 14 additions and 1 deletions

View File

@ -190,6 +190,7 @@ class Message extends FTNBase
$this->dst = []; $this->dst = [];
$this->point = []; $this->point = [];
$this->kludge = collect();
$this->rescanned = collect(); $this->rescanned = collect();
$this->path = collect(); $this->path = collect();
$this->seenby = collect(); $this->seenby = collect();
@ -408,6 +409,7 @@ class Message extends FTNBase
case 'message': case 'message':
case 'kludge':
case 'tagline': case 'tagline':
case 'tearline': case 'tearline':
case 'origin': case 'origin':

View File

@ -74,6 +74,7 @@ final class Test extends Process
$o->tagline = 'I ate a clock yesterday, it was very time-consuming.'; $o->tagline = 'I ate a clock yesterday, it was very time-consuming.';
$o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID); $o->tearline = sprintf('%s (%04X)',Setup::PRODUCT_NAME,Setup::PRODUCT_ID);
$o->origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$ftns->ftn4d); $o->origin = sprintf('%s (%s)',Setup::PRODUCT_NAME,$ftns->ftn4d);
$o->kludges = collect(['chrs'=>$msg->kludge->get('chrs') ?: 'CP437 2']);
$o->save(); $o->save();
return TRUE; return TRUE;

View File

@ -21,6 +21,8 @@ final class Echomail extends Model implements Packet
protected $collection = FALSE; protected $collection = FALSE;
protected $casts = [ 'kludges' => 'json' ];
private const cast_utf8 = [ private const cast_utf8 = [
'subject', 'subject',
'msg', 'msg',
@ -84,6 +86,11 @@ final class Echomail extends Model implements Packet
/* ATTRIBUTES */ /* ATTRIBUTES */
public function getKludgesAttribute(string $value): Collection
{
return collect($this->castAttribute('kludges',$value));
}
public function getPathAttribute(?array $value): Collection public function getPathAttribute(?array $value): Collection
{ {
if (is_null($value)) if (is_null($value))
@ -136,6 +143,9 @@ final class Echomail extends Model implements Packet
$o->echoarea = $this->echoarea->name; $o->echoarea = $this->echoarea->name;
$o->flags = $this->flags; $o->flags = $this->flags;
if ($this->kludges)
$o->kludge = $this->kludges;
$o->kludge->put('mid',$this->id); $o->kludge->put('mid',$this->id);
$o->msgid = $this->msgid; $o->msgid = $this->msgid;

View File

@ -1,7 +1,7 @@
<?php <?php
return [ return [
// Echmail // Echomail
'echomail' => [ 'echomail' => [
\App\Classes\FTN\Process\Echomail\Test::class, \App\Classes\FTN\Process\Echomail\Test::class,
], ],