Fix echoarea name is converted to UC, add netmail VIA lines for outgoing netmail

This commit is contained in:
Deon George 2022-02-16 23:01:55 +11:00
parent 12a40a79fb
commit daba4a78d3
4 changed files with 24 additions and 17 deletions

View File

@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Validator as ValidatorResult;
use App\Classes\FTN as FTNBase;
use App\Models\{Address,Domain,Zone};
use App\Models\{Address,Domain,Setup,Zone};
use App\Rules\{TwoByteInteger,TwoByteIntegerWithZero};
use App\Traits\EncodeUTF8;
@ -412,7 +412,7 @@ class Message extends FTNBase
$return .= sprintf("\01%s%s\r",$v,$x);
}
$return .= $this->message."\r";
$return .= $this->message;
if ($this->tagline)
$return .= sprintf("... %s\r",$this->tagline);
if ($this->tearline)
@ -421,12 +421,12 @@ class Message extends FTNBase
$return .= sprintf(" * Origin: %s\r",$this->origin);
} else {
$return .= $this->message."\r";
$return .= $this->message;
}
if ($this->isNetmail()) {
foreach ($this->via as $v)
$return .= sprintf("\01Via %s\r",$v);
foreach ($this->via as $via)
$return .= sprintf("\01Via %s\r",$via);
} else {
// Seenby & PATH - FSC-0068

View File

@ -94,9 +94,9 @@ class MessageProcess implements ShouldQueue
$reply .= sprintf("MSGID: %s\r",$this->msg->msgid);
foreach ($this->msg->kludge as $k=>$v)
$reply .= sprintf("@%s: %s\n",strtoupper($k),$v);
$reply .= sprintf("@%s: %s\r",strtoupper($k),$v);
foreach ($this->msg->via as $via)
$reply .= sprintf("VIA: %s\n",$via);
$reply .= sprintf("VIA: %s\r",$via);
$reply .= "------------------------------ END MESSAGE ------------------------------\r";
@ -138,12 +138,12 @@ class MessageProcess implements ShouldQueue
// Else we are echomail
} else {
$ea = Echoarea::where('name',$this->msg->echoarea)
$ea = Echoarea::where('name',strtoupper($this->msg->echoarea))
->where('domain_id',$this->msg->fboss_o->zone->domain_id)
->single();
if (! $ea) {
Log::alert(sprintf('%s:! Echo area [%s] doesnt exist for zone [%s]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->domain_id));
Log::alert(sprintf('%s:! Echo area [%s] doesnt exist for zone [%d]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->zone_id));
return;
}
@ -215,7 +215,7 @@ class MessageProcess implements ShouldQueue
$o->echoarea_id = $ea->id;
$o->msgid = $this->msg->msgid;
$o->msg = $this->msg->message_src;
$o->msg = $this->msg->message_src."\r";
$o->msg_crc = md5($this->msg->message);
$o->rogue_seenby = $this->msg->rogue_seenby;
$o->rogue_path = $this->msg->rogue_path;
@ -260,7 +260,13 @@ class MessageProcess implements ShouldQueue
$o->msgid = $msg->msgid;
$o->subject = $msg->subject;
$o->msg = $msg->message_src;
$o->msg = $msg->message;
foreach ($msg->via as $v)
$o->msg .= sprintf("\01Via %s\r",$v);
$o->msg_src = $msg->message_src;
$o->msg_crc = md5($msg->message); // @todo DB schema needs to handle this
return $o;
}

View File

@ -34,7 +34,6 @@ final class Netmail extends Model implements Packet
public function fftn()
{
return $this
->setConnection('pgsql')
->belongsTo(Address::class)
->withTrashed();
}
@ -42,7 +41,6 @@ final class Netmail extends Model implements Packet
public function tftn()
{
return $this
->setConnection('pgsql')
->belongsTo(Address::class);
}
@ -83,17 +81,20 @@ final class Netmail extends Model implements Packet
if ($this->replyid)
$o->replyid = $this->replyid;
$o->kludge->put('dbid',$this->id);
$o->message = $this->msg;
$o->tagline = $this->tagline;
$o->tearline = $this->tearline;
// VIA kludge
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$via = $this->via ?: collect();
$via->push(
sprintf('%s @%s.UTC %s %d.%d/%s %s',
$this->fftn->ftn3d,
$sysaddress->ftn3d,
Carbon::now()->utc()->format('Ymd.His'),
Setup::PRODUCT_NAME,
str_replace(' ','_',Setup::PRODUCT_NAME),
Setup::PRODUCT_VERSION_MAJ,
Setup::PRODUCT_VERSION_MIN,
(new Setup)->version,

View File

@ -29,7 +29,7 @@ class CreateMail extends Migration
$table->string('replyid')->nullable();
$table->text('msg');
$table->string('msg_src')->nullable();
$table->text('msg_src')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();
@ -96,7 +96,7 @@ class CreateMail extends Migration
$table->text('msg');
$table->text('msg_src')->nullable();
$table->integer('msg_crc')->nullable();
$table->string('msg_crc')->nullable();
$table->string('tagline')->nullable();
$table->string('tearline')->nullable();