Change our mail packet name to be the youngest ID in the packet, not the youngest date
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 44s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m53s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
Deon George 2024-09-09 11:50:41 +10:00
parent e6c0511b33
commit 4bc754d69e
3 changed files with 17 additions and 6 deletions

View File

@ -362,7 +362,7 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
$this->content .= "\00\00"; $this->content .= "\00\00";
$this->messages = $msgs->map(fn($item)=>$item->only(['id','date'])); $this->messages = $msgs->map(fn($item)=>$item->only(['id','datetime']));
return $this; return $this;
} }

View File

@ -11,7 +11,7 @@ use Illuminate\Support\Collection;
* When sending, we can queue up a list of items, and mark one active (the one being sent) at a time. * When sending, we can queue up a list of items, and mark one active (the one being sent) at a time.
* *
* + Netmail/Echomail/TIC * + Netmail/Echomail/TIC
* + name is dynamically calculated, based on timew() of the youngest item in the mail bundle * + name is the hex ID of the youngest item in the mail bundle
* + size is dynamically calculated based on the size of the bundle * + size is dynamically calculated based on the size of the bundle
* + mtime is dynamically calculated, based on the age of the youngest item * + mtime is dynamically calculated, based on the age of the youngest item
* + sendas (nameas) is name + [.pkt|.tic] * + sendas (nameas) is name + [.pkt|.tic]

View File

@ -4,6 +4,7 @@ namespace App\Classes\File;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -36,13 +37,13 @@ final class Mail extends Send
return $this->f->messages->pluck('id'); return $this->f->messages->pluck('id');
case 'name': case 'name':
return sprintf('%08x',timew($this->youngest())); return sprintf('%08x',$this->youngest_id());
case 'nameas': case 'nameas':
return sprintf('%s.pkt',$this->name); return sprintf('%s.pkt',$this->name);
case 'mtime': case 'mtime':
return $this->youngest()->timestamp; return $this->youngest_date()->timestamp;
case 'type': case 'type':
return ($this->ftype&0xff00)>>8; return ($this->ftype&0xff00)>>8;
@ -114,8 +115,18 @@ final class Mail extends Send
return TRUE; return TRUE;
} }
private function youngest(): Carbon private function youngest(): array
{ {
return $this->f->messages->pluck('date')->sort()->last(); return $this->f->messages->sortBy(fn($item)=>$item->datetime)->first();
}
private function youngest_id(): int
{
return Arr::get($this->youngest(),'id',0);
}
private function youngest_date(): Carbon
{
return Arr::get($this->youngest(),'datetime',Carbon::now());
} }
} }