Compare commits

..

1 Commits

Author SHA1 Message Date
394144d263 More removed references to deprecated getDateAttribute()
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 37s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m44s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
2024-06-28 15:36:48 +10:00
21 changed files with 69 additions and 60 deletions

View File

@ -233,7 +233,7 @@ class Message extends FTNBase
$o->mo->from = $o->header['user_from'];
$o->mo->subject = $o->header['subject'];
$o->mo->datetime = $o->datetime->clone()->utc();
$o->mo->datetime = $o->datetime;
$o->mo->tzoffset = $o->datetime->utcOffset();
$o->mo->flags = $o->header['flags'];
$o->mo->cost = $o->header['cost'];
@ -497,7 +497,7 @@ class Message extends FTNBase
$this->mo->tftn->host_id, // Destination Net
$this->mo->flags&~(self::FLAG_INTRANSIT|self::FLAG_LOCAL), // Turn off our local/intransit bits
$this->mo->cost,
$this->mo->date->format('d M y H:i:s'),
$this->mo->datetime->format('d M y H:i:s'),
);
$return .= $this->mo->to."\00";
@ -523,7 +523,7 @@ class Message extends FTNBase
$return .= sprintf("AREA:%s\r",strtoupper($this->mo->echoarea->name));
// Add some kludges
$return .= sprintf("\01TZUTC: %s\r",str_replace('+','',$this->mo->date->getOffsetString('')));
$return .= sprintf("\01TZUTC: %s\r",str_replace('+','',$this->mo->datetime->getOffsetString('')));
if ($this->mo->msgid)
$return .= sprintf("\01MSGID: %s\r",$this->mo->msgid);

View File

@ -361,7 +361,7 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
$this->content .= "\00\00";
$this->messages = $msgs->map(fn($item)=>$item->only(['id','date']));
$this->messages = $msgs->map(fn($item)=>$item->only(['id','datetime']));
return $this;
}

View File

@ -65,7 +65,7 @@ final class FSC39 extends Packet
*/
protected function header(Collection $msgs): string
{
$oldest = $this->messages->sortBy('date')->last();
$oldest = $this->messages->sortBy('datetime')->last();
return pack(collect(self::HEADER)->pluck(1)->join(''),
$this->fftn_p->node_id, // Orig Node

View File

@ -65,7 +65,7 @@ final class FSC48 extends Packet
*/
protected function header(Collection $msgs): string
{
$oldest = $msgs->sortBy('date')->last();
$oldest = $msgs->sortBy('datetime')->last();
return pack(collect(self::HEADER)->pluck(1)->join(''),
$this->fftn_p->node_id, // Orig Node

View File

@ -116,6 +116,6 @@ final class Mail extends Send
private function youngest(): Carbon
{
return $this->f->messages->pluck('date')->sort()->last();
return $this->f->messages->pluck('datetime')->sort()->last();
}
}

View File

@ -68,7 +68,7 @@ class PacketInfo extends Command
echo "\n";
try {
$this->warn(sprintf('- Date : %s (%s)',$msg->date,$msg->date->tz->toOffsetName()));
$this->warn(sprintf('- Date : %s (%s)',$msg->datetime,$msg->datetime->tz->toOffsetName()));
$this->warn(sprintf(' - Errors : %s',$msg->errors->count() ? 'YES' : 'No'));
$this->warn(sprintf(' - Flags : %s',$msg->flags()->keys()->join(', ')));
$this->warn(sprintf(' - Cost : %d',$msg->cost));
@ -112,4 +112,4 @@ class PacketInfo extends Command
return self::SUCCESS;
}
}
}

View File

@ -66,7 +66,7 @@ class SystemController extends Controller
->with('saved',TRUE);
}
$o->load(['addresses.zone.domain','addresses.system','sessions.domain','sessions.systems']);
$o->load(['addresses.zone.domain','addresses.nodes_hub','addresses.system','sessions.domain','sessions.systems']);
return view('system.addedit')
->with('action',$o->exists ? 'update_nn' : 'create')

View File

@ -228,18 +228,16 @@ class MessageProcess implements ShouldQueue
if ($this->mo->msgid) {
$o = Echomail::where('msgid',$this->mo->msgid)
->where('fftn_id',$this->mo->fftn->id)
->where('datetime','>=',$this->mo->date->clone()->subYears(3))
->where('datetime','<=',$this->mo->date)
->dontCache()
->where('datetime','>=',$this->mo->datetime->subYears(3))
->where('datetime','<=',$this->mo->datetime)
->single();
Log::debug(sprintf('%s:- Checking for duplicate from host id [%d].',self::LOGKEY,$this->mo->fftn->id));
if ($o) {
// @todo Actually update seenby
Log::alert(sprintf('%s:! Duplicate echomail [%d] (%s) in [%s] from (%s) [%s] to (%s) - updating seenby.',
Log::alert(sprintf('%s:! Duplicate echomail [%s] in [%s] from (%s) [%s] to (%s) - updating seenby.',
self::LOGKEY,
$o->id,
$this->mo->msgid,
$this->mo->echoarea->name,
$this->mo->from,$this->mo->fftn->ftn,
@ -286,7 +284,6 @@ class MessageProcess implements ShouldQueue
$o = Echomail::where('msg_crc',$xx=md5($this->mo->msg_crc))
->where('fftn_id',$this->mo->fftn->id)
->where('datetime','>',Carbon::now()->subWeek())
->dontCache()
->get();
if ($o->count())

View File

@ -269,8 +269,7 @@ class System extends Model
*/
public function packet(Address $ao,string $password=NULL): Packet
{
if ($ao->system_id !== $this->id)
throw new \Exception('Packet for [%s] is not for system [%d]',$ao->ftn,$this->id);
// @todo Check that the address is one of the system's addresses
return
(new (collect(Packet::PACKET_TYPES)

View File

@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Echoarea,Echomail,Netmail,Setup};
use App\Models\{Echoarea,Echomail,Setup};
abstract class Echomails extends Notification //implements ShouldQueue
{
@ -53,8 +53,8 @@ abstract class Echomails extends Notification //implements ShouldQueue
$o->echoarea_id = $eo->id;
$o->datetime = Carbon::now()->utc();
$o->tzoffset = Carbon::now()->utcOffset();
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->flags = (Message::FLAG_LOCAL);
@ -62,13 +62,4 @@ abstract class Echomails extends Notification //implements ShouldQueue
return $o;
}
protected function sourceSummary(Echomail|Netmail $o,string $item=NULL): string
{
return sprintf("Your %s was received here on [%s] and it looks like you sent it on [%s].",
$item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to),
Carbon::now()->utc()->toDateTimeString(),
$o->date->utc()->toDateTimeString(),
);
}
}

View File

@ -62,8 +62,8 @@ class Test extends Echomails
$msg->addText(
sprintf("Your test was received here on %s and it looks like you sent it on %s. If that is correct, then it took %s to get here.\r\r",
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
$this->mo->date->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
$this->mo->datetime->utc()->toDateTimeString(),
$this->mo->datetime->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
)
);

View File

@ -8,7 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use App\Classes\FTN\Message;
use App\Models\{Echomail,Netmail,Setup};
use App\Models\{Netmail,Setup,System};
abstract class Netmails extends Notification //implements ShouldQueue
{
@ -57,8 +57,8 @@ abstract class Netmails extends Notification //implements ShouldQueue
$o->to = $ao->system->sysop;
$o->from = Setup::PRODUCT_NAME;
$o->datetime = Carbon::now()->utc();
$o->tzoffset = Carbon::now()->utcOffset();
$o->datetime = Carbon::now();
$o->tzoffset = $o->datetime->utcOffset();
$o->fftn_id = our_address($ao)->id;
$o->tftn_id = $ao->id;
@ -69,13 +69,4 @@ abstract class Netmails extends Notification //implements ShouldQueue
return $o;
}
protected function sourceSummary(Echomail|Netmail $o,string $item=NULL): string
{
return sprintf("Your %s was received here on [%s] and it looks like you sent it on [%s].",
$item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to),
Carbon::now()->utc()->toDateTimeString(),
$o->date->utc()->toDateTimeString(),
);
}
}

View File

@ -48,7 +48,14 @@ class EchoareaNoWrite extends Netmails
// Message
$msg = $this->page(FALSE,'nowrite');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->datetime->utc()->toDateTimeString(),
)
);
$msg->addText(sprintf("It appears that you do not have permission to post in [%s] using the address [%s], so the message from your system was rejected.\r\r",$this->mo->echoarea->name,$ao->ftn));
$msg->addText("Please contact the ZC if you think this is a mistake.\r\r");

View File

@ -50,7 +50,14 @@ class EchoareaNotExist extends Netmails
// Message
$msg = $this->page(FALSE,'nothere');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->datetime->utc()->toDateTimeString(),
)
);
$msg->addText(sprintf("It appears that the echoarea [%s] that this message is for doesnt exist, so the message from your system was rejected.\r\r",$this->mo->set->get('set_echoarea')));
$msg->addText("Please contact the ZC if you think this is a mistake.\r\r");

View File

@ -48,7 +48,14 @@ class EchoareaNotSubscribed extends Netmails
// Message
$msg = $this->page(FALSE,'nosub');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->datetime->utc()->toDateTimeString(),
)
);
$msg->addText(sprintf("It appears that you havent been previously subscribed to this echoarea using the address [%s].\r\r",$ao->ftn));

View File

@ -48,7 +48,14 @@ class EchomailBadAddress extends Netmails
// Message
$msg = $this->page(FALSE,'badmsg');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(
sprintf("Your echomail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->datetime->utc()->toDateTimeString(),
)
);
$msg->addText(sprintf("The address in this echomail [%s] is the wrong address for this domain [%s].\r\r",$this->mo->fftn,$ao->zone->domain->name));

View File

@ -50,7 +50,14 @@ class NetmailHubNoUser extends Netmails
// Message
$msg = $this->page(FALSE,'Reject');
$msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(
sprintf("Your netmail with ID [%s] to [%s] here was received here on [%s] and it looks like you sent it on [%s].\r\r",
$this->mo->msgid,
$this->mo->to,
Carbon::now()->utc()->toDateTimeString(),
$this->mo->datetime->utc()->toDateTimeString(),
)
);
$msg->addText("This hub is not attended, so no user will be able to read your message. You may like to try and contact them another way.\r\r");

View File

@ -55,8 +55,8 @@ class Ping extends Netmails
$msg->addText(
sprintf("Your ping was received here on %s and it looks like you sent it on %s. If that is correct, then it took %s to get here.\r\r",
Carbon::now()->utc()->toDateTimeString(),
$this->mo->date->utc()->toDateTimeString(),
$this->mo->date->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
$this->mo->datetime->utc()->toDateTimeString(),
$this->mo->datetime->diffForHumans(['parts'=>3,'syntax'=>CarbonInterface::DIFF_ABSOLUTE])
)
);

View File

@ -59,15 +59,11 @@ trait MessageAttributes
return ($this->msg_src) ? $this->msg_src : $this->rebuildMessage();
}
/**
* This is used to build our data in a timezone date, so that when exported, we include the right TZUTC
*
* @return Carbon
*/
/** @deprecated use datetime? */
public function getDateAttribute(): Carbon
{
// Datetime is in utc, and tzoffset describes what that local time is
return $this->datetime->clone()->utcOffset($this->tzoffset);
Log::alert(sprintf('%s:! This function is deprecated',self::LOGKEY),['class'=>get_class($this)]);
return $this->datetime;
}
public function getOriginAttribute(string $val=NULL): ?string

View File

@ -19,7 +19,7 @@ trait MessagePath
$reply .= str_replace("\r---","\r#--",$mo->msg)."\r";
$reply .= "+------------------------------------[ CONTROL LINES ]-+\r";
$reply .= sprintf("DATE: %s\r",$mo->date->format('Y-m-d H:i:s'));
$reply .= sprintf("DATE: %s\r",$mo->datetime->format('Y-m-d H:i:s'));
if ($mo->msgid)
$reply .= sprintf("MSGID: %s\r",$mo->msgid);
if ($mo->replyid)

View File

@ -8,7 +8,7 @@ use App\Models\{Echomail,Netmail};
TO: <strong class="highlight">{!! Message::tr($msg->to) !!}</strong> @if ($msg instanceof Netmail)(<strong class="highlight">{{ $msg->tftn->ftn }}</strong>)@endif
</div>
<div class="col-4">
DATE: <strong class="highlight">{{ $msg->date->format('Y-m-d H:i:s') }}</strong>
DATE: <strong class="highlight">{{ $msg->datetime->format('Y-m-d H:i:s') }}</strong>
</div>
</div>