Some message optimisation, added Echomail processing

This commit is contained in:
Deon George
2021-07-31 00:35:52 +10:00
parent 6f26bc4c71
commit d937547599
15 changed files with 476 additions and 134 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use App\Classes\FTN\InvalidPacketException;
use App\Classes\FTN\Packet;
use App\Jobs\ProcessPacket;
use App\Models\Address;
@@ -83,7 +84,7 @@ final class Receive extends Item
if (! $this->f)
throw new Exception('No file to close');
if (! $this->file_pos != $this->receiving->file_size)
if ($this->file_pos != $this->receiving->file_size)
Log::warning(sprintf('%s: - Closing [%s], but missing [%d] bytes',__METHOD__,$this->receiving->file_name,$this->receiving->file_size-$this->file_pos));
$this->receiving->received = TRUE;
@@ -100,7 +101,15 @@ final class Receive extends Item
case self::IS_PKT:
Log::info(sprintf('%s: - Processing mail packet [%s]',__METHOD__,$this->file));
$po = Packet::open(new File($this->file),$this->ao->zone->domain);
try {
$po = Packet::open(new File($this->file),$this->ao->zone->domain);
} catch (InvalidPacketException $e) {
Log::error(sprintf('%s: - Not deleting packet [%s], as it generated an exception',__METHOD__,$this->file));
break;
}
foreach ($po->messages as $msg) {
Log::info(sprintf('%s: - Mail from [%s] to [%s]',__METHOD__,$msg->fftn,$msg->tftn));