Optimised our sending and receiving of items

This commit is contained in:
2023-07-17 16:36:53 +10:00
parent a8f76aec31
commit c1ec4eff36
14 changed files with 634 additions and 572 deletions

View File

@@ -73,25 +73,12 @@ class Tic extends FTNBase
$this->values = collect();
}
/**
* Does this TIC file bring us a nodelist
*
* @return bool
*/
public function isNodelist(): bool
{
return (($this->fo->nodelist_filearea_id === $this->fo->filearea->domain->filearea_id)
&& (preg_match(str_replace(['.','?'],['\.','.'],'#^'.$this->fo->filearea->domain->nodelist_filename.'$#i'),$this->fo->name)));
}
/**
* Generate a TIC file for an address
*
* @param Address $ao
* @param File $fo
* @return string
*/
public function generate(Address $ao,File $fo): string
public static function generate(Address $ao,File $fo): string
{
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($ao->zone)->first();
@@ -107,7 +94,8 @@ class Tic extends FTNBase
$result->put('DESC',$fo->description);
$result->put('AREA',$fo->filearea->name);
$result->put('AREADESC',$fo->filearea->description);
$result->put('PW',$ao->session('ticpass'));
if ($x=$ao->session('ticpass'))
$result->put('PW',$x);
$result->put('CRC',sprintf("%X",$fo->crc));
$out = '';
@@ -123,6 +111,17 @@ class Tic extends FTNBase
return $out;
}
/**
* Does this TIC file bring us a nodelist
*
* @return bool
*/
public function isNodelist(): bool
{
return (($this->fo->nodelist_filearea_id === $this->fo->filearea->domain->filearea_id)
&& (preg_match(str_replace(['.','?'],['\.','.'],'#^'.$this->fo->filearea->domain->nodelist_filename.'$#i'),$this->fo->name)));
}
/**
* Load a TIC file from an existing filename
*