EMSI Continue sending mail until no more mail to send
This commit is contained in:
parent
e78b5975b0
commit
09fe65a8db
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1177,13 +1177,13 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
// Add our mail to the queue if we have authenticated
|
||||
if ($this->node->aka_authed)
|
||||
foreach ($this->node->aka_remote_authed as $ao) {
|
||||
$this->send->mail($ao);
|
||||
}
|
||||
|
||||
while ($this->send->mail($ao)) {
|
||||
$z = new Zmodem;
|
||||
|
||||
if (! $z->zmodem_sendinit($this->client,$zap) && $this->send->total_count)
|
||||
$z->zmodem_sendfile($this->send);
|
||||
}
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s:- Finished sending',self::LOGKEY));
|
||||
return ($z->zmodem_senddone()<0);
|
||||
|
Loading…
Reference in New Issue
Block a user