Check for duplicate echomails, validate system password

This commit is contained in:
Deon George
2021-08-19 00:20:34 +10:00
parent 6af466605a
commit bcf3297fdb
5 changed files with 47 additions and 9 deletions

View File

@@ -10,10 +10,12 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Process};
use App\Models\{Echoarea,Echomail,Netmail,Setup};
use App\Models\{Echoarea,Echomail,Netmail,Setup,System};
class ProcessPacket implements ShouldQueue
{
private const LOGKEY = 'PP-';
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private Message $msg;
@@ -159,7 +161,8 @@ class ProcessPacket implements ShouldQueue
// Else we are echomail
} else {
Log::info(sprintf('Echomail [%s] in [%s] from (%s) [%s] to (%s).',
Log::info(sprintf('%s: - Echomail [%s] in [%s] from (%s) [%s] to (%s).',
self::LOGKEY,
$this->msg->msgid,
$this->msg->echoarea,
$this->msg->user_to,$this->msg->tftn,
@@ -170,6 +173,23 @@ class ProcessPacket implements ShouldQueue
->where('domain_id',$this->msg->fftn_o->zone->domain_id)
->single();
// Check for duplicate messages
if ($this->msg->msgid) {
$o = Echomail::where('msgid',$this->msg->msgid)->single();
if ($o) {
Log::alert(sprintf('%s:! Ignoring duplicate echomail [%s] in [%s] from (%s) [%s] to (%s).',
self::LOGKEY,
$this->msg->msgid,
$this->msg->echoarea,
$this->msg->user_to,$this->msg->tftn,
$this->msg->user_from,
));
return;
}
}
// @todo Can the sender create it if it doesnt exist?
// - Create it, or
// - Else record in bad area