Change our mail packet name to be the youngest ID in the packet, not the youngest date
This commit is contained in:
parent
e6c0511b33
commit
4bc754d69e
@ -362,7 +362,7 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
|
||||
|
||||
$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;
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
* + 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
|
||||
* + mtime is dynamically calculated, based on the age of the youngest item
|
||||
* + sendas (nameas) is name + [.pkt|.tic]
|
||||
|
@ -4,6 +4,7 @@ namespace App\Classes\File;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -36,13 +37,13 @@ final class Mail extends Send
|
||||
return $this->f->messages->pluck('id');
|
||||
|
||||
case 'name':
|
||||
return sprintf('%08x',timew($this->youngest()));
|
||||
return sprintf('%08x',$this->youngest_id());
|
||||
|
||||
case 'nameas':
|
||||
return sprintf('%s.pkt',$this->name);
|
||||
|
||||
case 'mtime':
|
||||
return $this->youngest()->timestamp;
|
||||
return $this->youngest_date()->timestamp;
|
||||
|
||||
case 'type':
|
||||
return ($this->ftype&0xff00)>>8;
|
||||
@ -114,8 +115,18 @@ final class Mail extends Send
|
||||
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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user