Add origin to replied messages, fix address in BadMessage notification
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 39s
Create Docker Image / Build Docker Image (arm64) (push) Successful in -23h34m54s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2024-07-30 20:54:47 +10:00
parent 62a9139d14
commit 616393edcc
3 changed files with 11 additions and 7 deletions

View File

@ -72,7 +72,7 @@ abstract class Netmails extends Notification //implements ShouldQueue
protected function sourceSummary(Echomail|Netmail $o,string $item=NULL): string 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].", return sprintf("The %s was received here on [%s] and it looks like your system sent it on [%s].",
$item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to), $item ?: sprintf('%s with ID [%s] to [%s]',$o instanceof Netmail ? 'Netmail' : 'Echomail',$o->msgid,$o->to),
Carbon::now()->utc()->toDateTimeString(), Carbon::now()->utc()->toDateTimeString(),
$o->date->utc()->toDateTimeString(), $o->date->utc()->toDateTimeString(),

View File

@ -49,7 +49,7 @@ class EchomailBadAddress extends Netmails
$msg->addText($this->sourceSummary($this->mo)."\r\r"); $msg->addText($this->sourceSummary($this->mo)."\r\r");
$msg->addText(sprintf("The address in this echomail [%s] is the wrong address for the domain [%s].\r\r",$this->mo->fftn,$ao->zone->domain->name)); $msg->addText(sprintf("The address in this echomail [%s] is the wrong address for the domain [%s].\r\r",$this->mo->set_fftn,$ao->zone->domain->name));
$msg->addText("This echomail has been rejected and not stored here - so no downstream nodes will receive it. If you think this is a mistake, please let me know.\r\r"); $msg->addText("This echomail has been rejected and not stored here - so no downstream nodes will receive it. If you think this is a mistake, please let me know.\r\r");

View File

@ -13,12 +13,13 @@ trait MessagePath
{ {
$reply = "This is your original message:\r\r"; $reply = "This is your original message:\r\r";
$reply .= "+------------------------------------[ BEGIN MESSAGE ]-+\r"; $reply .= "+---------------------------------------------------------[ BEGIN MESSAGE ]-+\r";
$reply .= sprintf("TO: %s\r",$mo->to); $reply .= sprintf("TO: %s\r",$mo->to);
$reply .= sprintf("SUBJECT: %s\r",$mo->subject); $reply .= sprintf("SUBJECT: %s\r",$mo->subject);
$reply .= str_replace("\r---","\r#--",$mo->msg)."\r"; $reply .= str_replace("\r---","\r#--",$mo->msg)."\r";
$reply .= "+------------------------------------[ CONTROL LINES ]-+\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->date->format('Y-m-d H:i:s'));
if ($mo->msgid) if ($mo->msgid)
$reply .= sprintf("MSGID: %s\r",$mo->msgid); $reply .= sprintf("MSGID: %s\r",$mo->msgid);
@ -28,7 +29,7 @@ trait MessagePath
foreach ($mo->kludges as $k=>$v) foreach ($mo->kludges as $k=>$v)
$reply .= sprintf("%s %s\r",$k,$v); $reply .= sprintf("%s %s\r",$k,$v);
$reply .= "+---------------------------------------------[ PATH ]-+\r"; $reply .= "+------------------------------------------------------------------[ PATH ]-+\r";
if ($mo->path->count()) if ($mo->path->count())
if ($mo instanceof Netmail) { if ($mo instanceof Netmail) {
@ -39,7 +40,7 @@ trait MessagePath
} elseif ($mo instanceof Echomail) { } elseif ($mo instanceof Echomail) {
// Rejected echomails dont have a collection of Address::class for paths // Rejected echomails dont have a collection of Address::class for paths
foreach ($mo->path as $o) foreach ($mo->path as $o)
$reply .= sprintf("VIA: %s\r",(is_string($o) ? $o : $o->ftn)); $reply .= sprintf("PATH: %s\r",(is_string($o) ? $o : $o->ftn));
} else { } else {
throw new \Exception('Message object is not an Netmail or Echomail?'); throw new \Exception('Message object is not an Netmail or Echomail?');
@ -48,7 +49,10 @@ trait MessagePath
else else
$reply .= "No path information? This would be normal if this message came directly to the hub\r"; $reply .= "No path information? This would be normal if this message came directly to the hub\r";
$reply .= "+--------------------------------------[ END MESSAGE ]-+\r\r"; $reply .= "+----------------------------------------------------------------[ ORIGIN ]-+\r";
$reply .= $mo->origin."\r";
$reply .= "+-----------------------------------------------------------[ END MESSAGE ]-+\r";
return $reply; return $reply;
} }