Integrate Mailer::class into System_Log::class, removed Zmodem Server/Client

This commit is contained in:
2023-12-10 19:07:53 +11:00
parent 8fc0336314
commit 0526500ff0
10 changed files with 71 additions and 139 deletions

View File

@@ -14,7 +14,7 @@ use App\Classes\Protocol as BaseProtocol;
use App\Classes\Sock\SocketClient;
use App\Classes\Sock\SocketException;
use App\Exceptions\{FileGrewException,InvalidFTNException};
use App\Models\Address;
use App\Models\{Address,Mailer};
final class Binkp extends BaseProtocol
{
@@ -148,7 +148,6 @@ final class Binkp extends BaseProtocol
* @param SocketClient $client
* @return int|null
* @throws SocketException
* @throws \Exception
*/
public function onConnect(SocketClient $client): ?int
{
@@ -156,8 +155,7 @@ final class Binkp extends BaseProtocol
if (! parent::onConnect($client)) {
Log::withContext(['pid'=>getmypid()]);
// @todo If we can use SESSION_EMSI set an object class value that in BINKP of SESSION_BINKP, and move this method to the parent class
$this->session(self::SESSION_BINKP,$client,(new Address));
$this->session(Mailer::where('name','BINKP')->singleOrFail(),$client,(new Address));
$this->client->close();
exit(0);
}

View File

@@ -9,7 +9,7 @@ use App\Classes\Protocol as BaseProtocol;
use App\Classes\Sock\SocketClient;
use App\Classes\Sock\SocketException;
use App\Exceptions\InvalidFTNException;
use App\Models\{Address,Setup};
use App\Models\{Address,Mailer,Setup};
use App\Interfaces\CRC as CRCInterface;
use App\Interfaces\Zmodem as ZmodemInterface;
use App\Traits\CRC as CRCTrait;
@@ -88,7 +88,6 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
* @param SocketClient $client
* @return int|null
* @throws SocketException
* @throws \Exception
*/
public function onConnect(SocketClient $client): ?int
{
@@ -96,8 +95,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if (! parent::onConnect($client)) {
Log::withContext(['pid'=>getmypid()]);
// @todo Can this be SESSION_EMSI? if so, set an object class value that in EMSI of SESSION_EMSI, and move this method to the parent class
$this->session(self::SESSION_AUTO,$client,(new Address));
$this->session(Mailer::where('name','EMSI')->singleOrFail(),$client,(new Address));
$this->client->close();
exit(0);
}

View File

@@ -10,7 +10,7 @@ use App\Classes\File\{Receive,Send};
use App\Classes\Sock\{SocketClient,SocketException};
use App\Interfaces\CRC as CRCInterface;
use App\Interfaces\Zmodem as ZmodemInterface;
use App\Models\Address;
use App\Models\{Address,Mailer};
use App\Traits\CRC as CRCTrait;
/**
@@ -213,7 +213,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
if (! parent::onConnect($client)) {
Log::withContext(['pid'=>getmypid()]);
$this->session(self::SESSION_ZMODEM,$client);
$this->session(Mailer::where('name','ZMODEM')->singleOrFail(),$client);
$this->client->close();
Log::info(sprintf('%s:= onConnect - Connection closed [%s]',self::LOGKEY,$client->address_remote));