BINKP responding to incoming netmail pings

This commit is contained in:
Deon George
2021-07-18 22:10:21 +10:00
parent 7bb3e12f66
commit 9dcfe6b17d
19 changed files with 145 additions and 54 deletions

View File

@@ -256,6 +256,8 @@ class Message extends FTNBase
return Arr::get($this->header,$key);
case 'message':
case 'tearline':
case 'origin':
case 'subject':
case 'user_to':
case 'user_from':
@@ -280,6 +282,8 @@ class Message extends FTNBase
case 'header':
case 'intl':
case 'message':
case 'tearline':
case 'origin':
case 'msgid':
case 'subject':
case 'user_from':
@@ -307,6 +311,10 @@ class Message extends FTNBase
$class = get_class($this);
foreach ($properties as $property) {
// Dont serialize the validation error
if ($property->name == 'errors')
continue;
if ($property->isStatic()) {
continue;
}
@@ -672,7 +680,7 @@ 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' => 'required|max:'.self::SUBJECT_LEN,
'subject' => 'present|max:'.self::SUBJECT_LEN,
'onode' => ['required',new TwoByteInteger],
'dnode' => ['required',new TwoByteInteger],
'onet' => ['required',new TwoByteInteger],

View File

@@ -55,11 +55,13 @@ class Packet extends FTNBase
public File $file; // Packet filename
public Collection $messages; // Messages in the Packet
private string $name; // Packet name
public function __construct(Address $o=NULL)
{
$this->messages = collect();
$this->domain = NULL;
$this->name = sprintf('%08x',Carbon::now()->timestamp);
// If we are creating an outbound packet, we need to set our header
if ($o)
@@ -95,6 +97,7 @@ class Packet extends FTNBase
throw new InvalidPacketException('Not a type 2 packet: '.$version);
$o = new self;
$o->name = (string)$file;
$o->header = unpack(self::unpackheader(self::v2header),$header);
$x = fread($f,2);
@@ -217,6 +220,10 @@ class Packet extends FTNBase
else
return '2e';
// Packet name:
case 'name':
return $this->{$key};
default:
throw new \Exception('Unknown key: '.$key);
}

View File

@@ -4,6 +4,7 @@ namespace App\Classes\FTN\Process;
use Carbon\Carbon;
use Carbon\CarbonInterface;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Process};
use App\Models\{Netmail,Setup};
@@ -26,6 +27,8 @@ final class Ping extends Process
if (strtolower($msg->user_to) !== 'ping')
return FALSE;
Log::info(sprintf('Processing PING message from (%s) [%s]',$msg->user_from,$msg->fftn));
$reply = sprintf("Your ping was received here on %s and it took %s to get here.\r",
Carbon::now()->toDateTimeString(),
$msg->date->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
@@ -46,7 +49,7 @@ final class Ping extends Process
$o->msg = static::format_msg($reply);
$o->reply = $msg->msgid;
$o->tagline = '... My ping pong opponent was not happy with my serve. He kept returning it.';
$o->tagline = 'My ping pong opponent was not happy with my serve. He kept returning it.';
$o->tearline = sprintf('--- %s (%s)',Setup::PRODUCT_NAME,(new Setup)->version);
$o->save();