Fixes to message processing, now that we are using cockroachdb

This commit is contained in:
Deon George
2022-01-15 13:06:15 +11:00
parent e78e79a8f5
commit 6f1d47a6ab
8 changed files with 119 additions and 82 deletions

View File

@@ -11,7 +11,7 @@ use Illuminate\Validation\Validator as ValidatorResult;
use App\Classes\FTN as FTNBase;
use App\Models\{Address,Domain,Zone};
use App\Rules\TwoByteInteger;
use App\Rules\{TwoByteInteger,TwoByteIntegerWithZero};
use App\Traits\EncodeUTF8;
/**
@@ -117,7 +117,7 @@ class Message extends FTNBase
private Collection $rogue_path; // Collection of FTNs in the Seen-by that are not defined
private Collection $seenby; // FTS-0004.001 The message SEEN-BY lines
private Collection $seenaddress; // Collection of Addresses after parsing seenby
private Collection $rogue_seen; // Collection of FTNs in the Seen-by that are not defined
private Collection $rogue_seenby; // Collection of FTNs in the Seen-by that are not defined
private Collection $via; // The path the message has gone using Via lines (Netmail)
private Collection $unknown; // Temporarily hold attributes we have no logic for.
@@ -203,7 +203,7 @@ class Message extends FTNBase
$this->seenby = collect();
$this->seenaddress = collect();
$this->pathaddress = collect();
$this->rogue_seen = collect();
$this->rogue_seenby = collect();
$this->rogue_path = collect();
$this->via = collect();
$this->unknown = collect();
@@ -262,7 +262,7 @@ class Message extends FTNBase
$o->unpackMessage(substr($msg,self::HEADER_LEN+$ptr));
if (($x=$o->validate())->fails()) {
Log::debug('Message fails validation',['result'=>$x->errors()]);
Log::debug(sprintf('%s:Message fails validation (%s@%s->%s@%s)',self::LOGKEY,$o->user_from,$o->fftn,$o->user_to,$o->tftn),['result'=>$x->errors()]);
//throw new \Exception('Message validation fails:'.join(' ',$x->errors()->all()));
}
@@ -388,7 +388,7 @@ class Message extends FTNBase
case 'pathaddress':
case 'seenaddress':
case 'rogue_path':
case 'rogue_seen':
case 'rogue_seenby':
case 'unknown':
case 'via':
@@ -842,7 +842,7 @@ class Message extends FTNBase
}
// Parse SEEN-BY
if ($this->seenby->count())
$this->seenaddress = $this->parseAddresses('seenby',$this->seenby,$this->rogue_seen);
$this->seenaddress = $this->parseAddresses('seenby',$this->seenby,$this->rogue_seenby);
// Parse PATH
if ($this->path->count())
@@ -861,10 +861,10 @@ class Message extends FTNBase
'user_from' => $this->user_from,
'user_to' => $this->user_to,
'subject' => $this->subject,
'onode' => $this->fn,
'dnode' => $this->ff,
'onet' => $this->tn,
'dnet' => $this->tf,
'onode' => $this->ff,
'dnode' => $this->tf,
'onet' => $this->fn,
'dnet' => $this->tn,
'flags' => $this->flags,
'cost' => $this->cost,
'echoarea' => $this->echoarea,
@@ -874,8 +874,8 @@ class Message extends FTNBase
'user_from' => 'required|min:1|max:'.self::USER_FROM_LEN,
'user_to' => 'required|min:1|max:'.self::USER_TO_LEN,
'subject' => 'present|max:'.self::SUBJECT_LEN,
'onode' => ['required',new TwoByteInteger],
'dnode' => ['required',new TwoByteInteger],
'onode' => ['required',new TwoByteIntegerWithZero],
'dnode' => ['required',new TwoByteIntegerWithZero],
'onet' => ['required',new TwoByteInteger],
'dnet' => ['required',new TwoByteInteger],
'flags' => 'required|numeric',