Fix path on rejected echomails, change layout of message_path quoting original message and control lines
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m42s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-26 12:35:13 +10:00
parent 77b9bb30c4
commit 03bfc9dbfc
2 changed files with 11 additions and 6 deletions

View File

@ -44,6 +44,7 @@ class EchoareaNotExist extends Netmails
Log::info(sprintf('%s:+ Creating ECHOAREA NOT EXIST netmail to [%s]',self::LOGKEY,$ao->ftn)); Log::info(sprintf('%s:+ Creating ECHOAREA NOT EXIST netmail to [%s]',self::LOGKEY,$ao->ftn));
$o->to = $this->mo->from;
$o->subject = 'Echoarea doesnt exist - '.$this->mo->set->get('set_echoarea'); $o->subject = 'Echoarea doesnt exist - '.$this->mo->set->get('set_echoarea');
// Message // Message

View File

@ -13,12 +13,12 @@ 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,22 +28,26 @@ 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) {
foreach ($mo->path as $o) foreach ($mo->path as $o)
$reply .= sprintf("VIA: %s\r",$mo->via($o)); $reply .= sprintf("VIA: %s\r",$mo->via($o));
} else { } elseif ($mo instanceof Echomail) {
// 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",$o->ftn); $reply .= sprintf("VIA: %s\r",(is_string($o) ? $o : $o->ftn));
} else {
throw new \Exception('Message object is not an Netmail or Echomail?');
} }
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 .= "+--------------------------------------[ END MESSAGE ]-+\r\r";
return $reply; return $reply;
} }