Use FTN from origin as our primary address, and msgid if the origin line doesnt have one
This commit is contained in:
parent
673c444acd
commit
ab7f661800
@ -786,6 +786,7 @@ class Message extends FTNBase
|
|||||||
* @param Collection $via
|
* @param Collection $via
|
||||||
* @param Collection $rogue
|
* @param Collection $rogue
|
||||||
* @return Collection
|
* @return Collection
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function parseVia(Collection $via,Collection &$rogue): Collection
|
private function parseVia(Collection $via,Collection &$rogue): Collection
|
||||||
{
|
{
|
||||||
@ -891,34 +892,9 @@ class Message extends FTNBase
|
|||||||
$this->message_src = substr($message, 0, $msgpos - (1+strlen($kl)) + $originpos + 12 + strlen($this->origin) + 1);
|
$this->message_src = substr($message, 0, $msgpos - (1+strlen($kl)) + $originpos + 12 + strlen($this->origin) + 1);
|
||||||
$kl = substr($kl,0,$retpos);
|
$kl = substr($kl,0,$retpos);
|
||||||
|
|
||||||
// If this is netmail, the FQFA will have been set by the INTL line, we can skip the rest of this
|
|
||||||
$matches = [];
|
|
||||||
|
|
||||||
// Capture the fully qualified 4D name from the Origin Line - it tells us the ZONE.
|
|
||||||
preg_match('/^.*\((.*)\)$/',$this->origin,$matches);
|
|
||||||
|
|
||||||
// Double check we have an address in the origin line
|
|
||||||
if (! Arr::get($matches,1)) {
|
|
||||||
Log::error(sprintf('%s:! Origin line doesnt have an address',self::LOGKEY));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Double check, our src and origin match
|
|
||||||
try {
|
|
||||||
$this->src = Address::parseFTN($matches[1]);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Log::error(sprintf('%s:! Origin line address [%s] is invalid [%s]',self::LOGKEY,$this->origin,$e->getMessage()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll double check our FTN
|
|
||||||
if ($this->isNetmail() && (($this->src['n'] !== $this->fn) || ($this->src['f'] !== $this->ff))) {
|
|
||||||
Log::error(sprintf('%s:! FTN [%s] doesnt match message header',self::LOGKEY,$matches[1]),['ftn'=>$this->src,'fn'=>$this->fn,'ff'=>$this->ff]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The message is the rest?
|
// The message is the rest?
|
||||||
// Netmails dont generally have an origin line
|
// Netmails dont generally have an origin line
|
||||||
} elseif (strlen($kl) > $retpos+1) {
|
} elseif (strlen($kl) > $retpos+1) {
|
||||||
|
|
||||||
// We still have some text to process, add it to the list
|
// We still have some text to process, add it to the list
|
||||||
if ($haveOrigin && ($retpos+1 < strlen($kl))) {
|
if ($haveOrigin && ($retpos+1 < strlen($kl))) {
|
||||||
$result->push(substr($kl,$retpos+1));
|
$result->push(substr($kl,$retpos+1));
|
||||||
@ -936,12 +912,11 @@ class Message extends FTNBase
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->_kludge as $a => $b) {
|
foreach ($this->_kludge as $a => $b)
|
||||||
if ($t = $this->kludge($b,$kl)) {
|
if ($t = $this->kludge($b,$kl)) {
|
||||||
$this->kludge->put($a,$t);
|
$this->kludge->put($a,$t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// There is more text.
|
// There is more text.
|
||||||
if ($t)
|
if ($t)
|
||||||
@ -1011,20 +986,19 @@ class Message extends FTNBase
|
|||||||
|
|
||||||
// Work out our zone/point
|
// Work out our zone/point
|
||||||
// http://ftsc.org/docs/fsc-0068.001
|
// http://ftsc.org/docs/fsc-0068.001
|
||||||
// MSGID should be the basis of the source, we'll overwrite our src from origin if we have it
|
// MSGID should be the basis of the source, if it cannot be obtained from the origin
|
||||||
// If the message was gated, we'll use the gateid
|
// If the message was gated, we'll use the gateid
|
||||||
$m = [];
|
$m = [];
|
||||||
if (($this->msgid || $this->gateid) && preg_match('#([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?(\.[0-9]+)?@?([A-Za-z-_~]+)?\ +#',$this->gateid ?: $this->msgid,$m)) {
|
if ($this->origin && preg_match('#\(([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?@?([A-Za-z-_~]+)?\)$#',$this->origin,$m)) {
|
||||||
|
$this->src = Address::parseFTN($m[1].((isset($m[2]) && $m[2] != '') ? '.'.$m[2] : '').(isset($m[3]) ? '@'.$m[3] : ''));
|
||||||
|
|
||||||
|
} elseif (($this->msgid || $this->gateid) && preg_match('#([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?(\.[0-9]+)?@?([A-Za-z-_~]+)?\ +#',$this->gateid ?: $this->msgid,$m)) {
|
||||||
try {
|
try {
|
||||||
$this->src = Address::parseFTN($m[1].((isset($m[2]) && $m[2] != '') ? '.'.$m[2] : '').(isset($m[4]) ? '@'.$m[4] : ''));
|
$this->src = Address::parseFTN($m[1].((isset($m[2]) && $m[2] != '') ? '.'.$m[2] : '').(isset($m[4]) ? '@'.$m[4] : ''));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error(sprintf('%s:! MSGID [%s] address is invalid [%s]',self::LOGKEY,$this->msgid,$e->getMessage()));
|
Log::error(sprintf('%s:! MSGID [%s] address is invalid [%s]',self::LOGKEY,$this->msgid,$e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without a MSGID, get our domain from the origin
|
|
||||||
} elseif ($this->origin && preg_match('#\(([0-9]+:[0-9]+/[0-9]+)?\.?([0-9]+)?@?([A-Za-z-_~]+)?\)$#',$this->origin,$m)) {
|
|
||||||
$this->src = Address::parseFTN($m[1].((isset($m[2]) && $m[2] != '') ? '.'.$m[2] : '').(isset($m[3]) ? '@'.$m[3] : ''));
|
|
||||||
|
|
||||||
// Otherwise get it from our zone object and packet header
|
// Otherwise get it from our zone object and packet header
|
||||||
} elseif ($this->zone) {
|
} elseif ($this->zone) {
|
||||||
$this->src = Address::parseFTN(sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->fn,$this->ff,$this->fp,$this->zone->domain->name));
|
$this->src = Address::parseFTN(sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->fn,$this->ff,$this->fp,$this->zone->domain->name));
|
||||||
|
Loading…
Reference in New Issue
Block a user