|
|
|
@ -1052,7 +1052,7 @@ class Address extends Model
|
|
|
|
|
if ($num->count() > $this->system->pkt_msgs)
|
|
|
|
|
Log::notice(sprintf('%s:= Only sending [%d] echomails for [%s]',self::LOGKEY,$this->system->pkt_msgs,$this->ftn));
|
|
|
|
|
|
|
|
|
|
return $this->system->packet($this)->mail($num->take($this->system->pkt_msgs));
|
|
|
|
|
return $this->system->packet($this)->mail($num->take($this->system->pkt_msgs)->get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
@ -1081,11 +1081,13 @@ class Address extends Model
|
|
|
|
|
if (($num=$this->netmailAlertWaiting())->count()) {
|
|
|
|
|
Log::debug(sprintf('%s:= Packaging [%d] netmail alerts to [%s]',self::LOGKEY,$num->count(),$this->ftn));
|
|
|
|
|
|
|
|
|
|
$msgs = $num->get();
|
|
|
|
|
|
|
|
|
|
// Find any message that defines a packet password
|
|
|
|
|
$pass = $num
|
|
|
|
|
$pass = $msgs
|
|
|
|
|
->map(function($item) {
|
|
|
|
|
$passpos = strpos($item->subject,':');
|
|
|
|
|
return (($passpos > 0) && ($passpos < 8)) ? substr($item->subject,0,$passpos) : NULL;
|
|
|
|
|
return (($passpos > 0) && ($passpos <= 8)) ? substr($item->subject,0,$passpos) : NULL;
|
|
|
|
|
})
|
|
|
|
|
->filter()
|
|
|
|
|
->pop();
|
|
|
|
@ -1093,7 +1095,7 @@ class Address extends Model
|
|
|
|
|
Log::debug(sprintf('%s:= Overwriting system packet password with [%s] for [%s]',self::LOGKEY,$pass,$this->ftn));
|
|
|
|
|
|
|
|
|
|
return $this->system->packet($this,$pass)->mail(
|
|
|
|
|
$num->filter(fn($item)=>preg_match("/^{$pass}:/",$item->subject))
|
|
|
|
|
$msgs->filter(fn($item)=>preg_match("/^{$pass}:/",$item->subject))
|
|
|
|
|
->transform(function($item) use ($pass) {
|
|
|
|
|
$item->subject = preg_replace("/^{$pass}:/",'',$item->subject);
|
|
|
|
|
return $item;
|
|
|
|
@ -1108,7 +1110,7 @@ class Address extends Model
|
|
|
|
|
if ($num->count() > $this->system->pkt_msgs)
|
|
|
|
|
Log::alert(sprintf('%s:= Only sending [%d] netmails for [%s]',self::LOGKEY,$this->system->pkt_msgs,$this->ftn));
|
|
|
|
|
|
|
|
|
|
return $this->system->packet($this)->mail($num->take($this->system->pkt_msgs));
|
|
|
|
|
return $this->system->packet($this)->mail($num->take($this->system->pkt_msgs)->get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
@ -1180,11 +1182,11 @@ class Address extends Model
|
|
|
|
|
/**
|
|
|
|
|
* Netmail alerts waiting to be sent to this system
|
|
|
|
|
*
|
|
|
|
|
* @return Collection
|
|
|
|
|
* @return Builder
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
* @note The packet password to use is on the subject line for these alerts
|
|
|
|
|
*/
|
|
|
|
|
public function netmailAlertWaiting(): Collection
|
|
|
|
|
public function netmailAlertWaiting(): Builder
|
|
|
|
|
{
|
|
|
|
|
$netmails = $this
|
|
|
|
|
->UncollectedNetmail()
|
|
|
|
@ -1196,7 +1198,7 @@ class Address extends Model
|
|
|
|
|
->groupBy(['netmails.id'])
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
return Netmail::whereIn('id',$netmails->pluck('id'))->get();
|
|
|
|
|
return Netmail::whereIn('id',$netmails->pluck('id'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function nodes(): Collection
|
|
|
|
|