Compare commits

..

No commits in common. "ba0f643dca085ad997b2075ed90bca5545180748" and "829fe1d7a985cd592283607f2486931a184de7b8" have entirely different histories.

3 changed files with 10 additions and 13 deletions

View File

@ -405,9 +405,9 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
return (string)$this; return (string)$this;
} }
public function mail(Collection $msgs): self public function mail(Builder $msgs): self
{ {
$this->messages = $msgs; $this->messages = $msgs->get();
return $this; return $this;
} }

View File

@ -308,7 +308,6 @@ class SystemController extends Controller
if (Arr::get($validated,'remove')) { if (Arr::get($validated,'remove')) {
$so->sessions()->detach($o->zone); $so->sessions()->detach($o->zone);
$so->logs()->delete();
$so->mailers()->detach(); $so->mailers()->detach();
$so->users()->detach(); $so->users()->detach();
$so->delete(); $so->delete();

View File

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