EMSI Continue sending mail until no more mail to send

This commit is contained in:
Deon George
2022-12-03 01:09:41 +11:00
parent e78b5975b0
commit 09fe65a8db
2 changed files with 16 additions and 8 deletions

View File

@@ -226,15 +226,19 @@ final class Send extends Item
* Add our mail to the send queue
*
* @param Address $ao
* @return bool
* @throws Exception
* @todo We need to make this into a transaction, incase the transfer fails.
*/
public function mail(Address $ao): void
public function mail(Address $ao): bool
{
$mail = FALSE;
// If the node is marked as hold - dont send any mail.
if ($ao->system->hold) {
Log::info(sprintf('%s: - System [%d] mail is marked as hold - not checking for mail.',self::LOGKEY,$ao->system_id));
return;
return FALSE;
}
// Netmail
@@ -242,6 +246,7 @@ final class Send extends Item
Log::debug(sprintf('%s: - Netmail(s) added for sending to [%s]',self::LOGKEY,$ao->ftn));
$this->packets->push(new Mail($x,self::I_SEND));
$mail = TRUE;
}
// Echomail
@@ -249,7 +254,10 @@ final class Send extends Item
Log::debug(sprintf('%s: - Echomail(s) added for sending to [%s]',self::LOGKEY,$ao->ftn));
$this->packets->push(new Mail($x,self::I_SEND));
$mail = TRUE;
}
return $mail;
}
/**