Sending Mail now dynamically creates packet name, size and mtime

This commit is contained in:
2023-07-14 20:03:09 +10:00
parent 28101237e8
commit 7bf957df3a
5 changed files with 35 additions and 13 deletions

View File

@@ -70,12 +70,18 @@ final class Send extends Item
+ $this->packets->sum(function($item) { return $item->size; });
case 'sendas':
return $this->sending ? $this->sending->{$key} : NULL;
return $this->sending?->{$key};
case 'name':
// The mtime is the time of the youngest message in the packet for the sending packet
case 'mtime':
return $this->sending?->youngest()->timestamp;
// The name is derived from the youngest message in the packet
case 'name':
return sprintf('%08x',timew($this->sending?->youngest()));
case 'size':
return $this->sending ? $this->sending->{'file_'.$key} : NULL;
return strlen($this->sending?->file);
case 'total_sent':
return $this->list
@@ -297,7 +303,7 @@ final class Send extends Item
* @throws Exception
* @todo We need to make this into a transaction, incase the transfer fails.
*/
public function mail(Address $ao): bool
public function mail(Address $ao,bool $update=TRUE): bool
{
$mail = FALSE;
@@ -309,7 +315,7 @@ final class Send extends Item
}
// Netmail
if ($x=$ao->getNetmail()) {
if ($x=$ao->getNetmail($update)) {
Log::debug(sprintf('%s: - Netmail(s) added for sending to [%s]',self::LOGKEY,$ao->ftn));
$this->packets->push(new Mail($x,self::I_SEND));
@@ -317,7 +323,7 @@ final class Send extends Item
}
// Echomail
if ($x=$ao->getEchomail()) {
if ($x=$ao->getEchomail($update)) {
Log::debug(sprintf('%s: - Echomail(s) added for sending to [%s]',self::LOGKEY,$ao->ftn));
$this->packets->push(new Mail($x,self::I_SEND));