More complete rework of packet parsing and packet generation with 29710c
This commit is contained in:
@@ -89,7 +89,7 @@ trait EncodeUTF8
|
||||
return $this->attributes[$key];
|
||||
}
|
||||
|
||||
return parent::getAttribute($key);
|
||||
return Arr::get($this->_encoded,$key) ? $this->attributes[$key] : parent::getAttribute($key);
|
||||
}
|
||||
|
||||
public function setAttribute($key,$value)
|
||||
|
@@ -70,26 +70,38 @@ trait MessageAttributes
|
||||
|
||||
public function getOriginAttribute(string $val=NULL): ?string
|
||||
{
|
||||
if ($this->exists && (! $val))
|
||||
return $val;
|
||||
|
||||
// If $val is not set, then it may be an unsaved object
|
||||
return ((! $this->exists) && $this->set->has('set_origin'))
|
||||
? sprintf(' * Origin: %s',$this->set->get('set_origin'))
|
||||
: $val;
|
||||
return sprintf(' * Origin: %s',
|
||||
((! $this->exists) && $this->set->has('set_origin'))
|
||||
? $this->set->get('set_origin')
|
||||
: $val);
|
||||
}
|
||||
|
||||
public function getTaglineAttribute(string $val=NULL): ?string
|
||||
{
|
||||
if ($this->exists && (! $val))
|
||||
return $val;
|
||||
|
||||
// If $val is not set, then it may be an unsaved object
|
||||
return ((! $this->exists) && $this->set->has('set_tagline'))
|
||||
? sprintf('... %s',$this->set->get('set_tagline'))
|
||||
: $val;
|
||||
return sprintf('... %s',
|
||||
((! $this->exists) && $this->set->has('set_tagline'))
|
||||
? $this->set->get('set_tagline')
|
||||
: $val);
|
||||
}
|
||||
|
||||
public function getTearlineAttribute(string $val=NULL): ?string
|
||||
{
|
||||
if ($this->exists && (! $val))
|
||||
return $val;
|
||||
|
||||
// If $val is not set, then it may be an unsaved object
|
||||
return ((! $this->exists) && $this->set->has('set_tearline'))
|
||||
? sprintf('--- %s',$this->set->get('set_tearline'))
|
||||
: $val;
|
||||
return sprintf('--- %s',
|
||||
((! $this->exists) && $this->set->has('set_tearline'))
|
||||
? $this->set->get('set_tearline')
|
||||
: $val);
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
@@ -141,10 +153,11 @@ trait MessageAttributes
|
||||
'receipt' => $this->isFlagSet(Message::FLAG_ISRETRECEIPT),
|
||||
'audit' => $this->isFlagSet(Message::FLAG_AUDITREQ),
|
||||
'fileupdate' => $this->isFlagSet(Message::FLAG_FILEUPDATEREQ),
|
||||
'pktpasswd' => $this->isFlagSet(Message::FLAG_PKTPASSWD),
|
||||
])->filter();
|
||||
}
|
||||
|
||||
private function isFlagSet($flag): bool
|
||||
public function isFlagSet($flag): bool
|
||||
{
|
||||
return ($this->flags & $flag);
|
||||
}
|
||||
|
@@ -27,20 +27,18 @@ trait MessagePath
|
||||
|
||||
$reply .= "+--[ PATH ]-------------------------------------------+\r";
|
||||
|
||||
if ($mo instanceof Netmail) {
|
||||
if ($mo->via->count())
|
||||
foreach ($mo->via as $ao)
|
||||
$reply .= sprintf("VIA: %s\r",$mo->via($ao));
|
||||
else
|
||||
$reply .= "No path information? This would be normal if this message came directly to the hub\r";
|
||||
if ($mo->path->count())
|
||||
if ($mo instanceof Netmail) {
|
||||
foreach ($mo->path as $o)
|
||||
$reply .= sprintf("VIA: %s\r",$mo->via($o));
|
||||
|
||||
} else {
|
||||
if ($mo->path->count())
|
||||
foreach ($mo->path as $via)
|
||||
$reply .= sprintf("VIA: %s\r",$via);
|
||||
else
|
||||
$reply .= "No path information? This would be normal if this message came directly to the hub\r";
|
||||
}
|
||||
} else {
|
||||
foreach ($mo->path as $o)
|
||||
$reply .= sprintf("VIA: %s\r",$o->ftn);
|
||||
}
|
||||
|
||||
else
|
||||
$reply .= "No path information? This would be normal if this message came directly to the hub\r";
|
||||
|
||||
$reply .= "+--[ END MESSAGE ]------------------------------------+\r\r";
|
||||
|
||||
|
Reference in New Issue
Block a user