Move mailer details into a separate table

This commit is contained in:
2023-07-07 23:59:04 +10:00
parent ad4ea699a5
commit ccdce6bb62
12 changed files with 274 additions and 112 deletions

View File

@@ -87,12 +87,12 @@ abstract class Protocol
protected const O_YES = 1<<5;
// Session Status
protected const S_OK = 0;
public const S_OK = 0;
protected const S_NODIAL = 1;
protected const S_REDIAL = 2;
protected const S_BUSY = 3;
protected const S_FAILURE = 4;
protected const S_MASK = 7;
public const S_MASK = 7;
protected const S_HOLDR = 8;
protected const S_HOLDX = 16;
protected const S_HOLDA = 32;
@@ -324,10 +324,10 @@ abstract class Protocol
* @param int $type
* @param SocketClient $client
* @param Address|null $o
* @return void
* @return int
* @throws \Exception
*/
public function session(int $type,SocketClient $client,Address $o=NULL): void
public function session(int $type,SocketClient $client,Address $o=NULL): int
{
if ($o->exists)
Log::withContext(['ftn'=>$o->ftn]);
@@ -370,7 +370,7 @@ abstract class Protocol
if ($rc < 0) {
Log::error(sprintf('%s:! Unable to start EMSI [%d]',self::LOGKEY,$rc));
return;
return self::S_FAILURE;
}
case self::SESSION_EMSI:
@@ -389,14 +389,13 @@ abstract class Protocol
Log::debug(sprintf('%s:- Starting ZMODEM',self::LOGKEY));
$this->client->speed = self::TCP_SPEED;
$this->originate = FALSE;
$this->protocol_session();
return;
return $this->protocol_session();
default:
Log::error(sprintf('%s:! Unsupported session type [%d]',self::LOGKEY,$type));
return;
return self::S_FAILURE;
}
// @todo Unlock outbounds
@@ -453,6 +452,8 @@ abstract class Protocol
// @todo Optional after session includes mail event
// if ($this->node->start_time && $this->setup->cfg('CFG_AFTERMAIL')) {}
return $rc;
}
/* SE_* flags determine our session processing status, at any point in time */

View File

@@ -194,16 +194,16 @@ final class DNS extends BaseProtocol
$ao = Address::findFTN(sprintf('%d:%d/%d.%d@%s',$z,$n,$f,$p,$d));
// Check we have the right record
if ((! $ao) || (! $ao->system->mailer_address) || (($rootdn !== self::TLD) && ((! $ao->zone->domain->dnsdomain) || ($ao->zone->domain->dnsdomain !== $d.'.'.$rootdn)))) {
if ((! $ao) || (! $ao->system->address) || (($rootdn !== self::TLD) && ((! $ao->zone->domain->dnsdomain) || ($ao->zone->domain->dnsdomain !== $d.'.'.$rootdn)))) {
Log::alert(sprintf('%s:= No DNS record for [%d:%d/%d.%d@%s]',self::LOGKEY,$z,$n,$f,$p,$d));
return $this->nameerr();
}
Log::debug(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->mailer_address,$ao->ftn));
Log::debug(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn));
return $this->reply(
self::DNS_NOERROR,
[serialize($this->domain_split($ao->system->mailer_address)) => self::DNS_TYPE_CNAME]);
[serialize($this->domain_split($ao->system->address)) => self::DNS_TYPE_CNAME]);
// Other attributes return NOTIMPL
default: