Catch Netmails that dont generate an exception when converting to a packed message. Make sure we present unique addresses
This commit is contained in:
parent
0789ee9042
commit
b8478adecb
@ -150,6 +150,8 @@ final class Binkp extends BaseProtocol
|
|||||||
foreach ($this->node->aka_remote_authed as $ao)
|
foreach ($this->node->aka_remote_authed as $ao)
|
||||||
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
||||||
|
|
||||||
|
$addresses = $addresses->unique();
|
||||||
|
|
||||||
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -687,6 +689,8 @@ final class Binkp extends BaseProtocol
|
|||||||
foreach ($this->node->aka_remote as $ao)
|
foreach ($this->node->aka_remote as $ao)
|
||||||
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
||||||
|
|
||||||
|
$addresses = $addresses->unique();
|
||||||
|
|
||||||
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,6 +188,8 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
|||||||
foreach ($this->node->aka_remote as $ao)
|
foreach ($this->node->aka_remote as $ao)
|
||||||
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
$addresses = $addresses->merge($this->setup->system->match($ao->zone));
|
||||||
|
|
||||||
|
$addresses = $addresses->unique();
|
||||||
|
|
||||||
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
Log::debug(sprintf('%s: - Presenting limited AKAs [%s]',__METHOD__,$addresses->pluck('ftn')->join(',')));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Jenssegers\Mongodb\Eloquent\Model;
|
use Jenssegers\Mongodb\Eloquent\Model;
|
||||||
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
|
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
@ -10,8 +11,10 @@ use App\Classes\FTN\Message;
|
|||||||
use App\Interfaces\Packet;
|
use App\Interfaces\Packet;
|
||||||
use App\Traits\UseMongo;
|
use App\Traits\UseMongo;
|
||||||
|
|
||||||
class Netmail extends Model implements Packet
|
final class Netmail extends Model implements Packet
|
||||||
{
|
{
|
||||||
|
private const LOGKEY = 'MN-';
|
||||||
|
|
||||||
use SoftDeletes,UseMongo;
|
use SoftDeletes,UseMongo;
|
||||||
|
|
||||||
protected $dates = ['datetime','sent_at'];
|
protected $dates = ['datetime','sent_at'];
|
||||||
@ -40,55 +43,63 @@ class Netmail extends Model implements Packet
|
|||||||
*/
|
*/
|
||||||
public function packet(Address $ao): Message
|
public function packet(Address $ao): Message
|
||||||
{
|
{
|
||||||
|
Log::debug(sprintf('%s:Bundling [%s]',self::LOGKEY,$this->id));
|
||||||
|
|
||||||
// @todo Dont bundle mail to nodes that have been disabled, or addresses that have been deleted
|
// @todo Dont bundle mail to nodes that have been disabled, or addresses that have been deleted
|
||||||
$o = new Message;
|
$o = new Message;
|
||||||
|
|
||||||
$o->header = [
|
try {
|
||||||
'onode' => $this->fftn->node_id,
|
$o->header = [
|
||||||
'dnode' => $ao->node_id,
|
'onode' => $this->fftn->node_id,
|
||||||
'onet' => $this->fftn->host_id,
|
'dnode' => $ao->node_id,
|
||||||
'dnet' => $ao->host_id,
|
'onet' => $this->fftn->host_id,
|
||||||
'flags' => 0, // @todo?
|
'dnet' => $ao->host_id,
|
||||||
'cost' => 0,
|
'flags' => 0, // @todo?
|
||||||
'date'=>$this->datetime->format('d M y H:i:s'),
|
'cost' => 0,
|
||||||
];
|
'date'=>$this->datetime->format('d M y H:i:s'),
|
||||||
|
];
|
||||||
|
|
||||||
$o->tzutc = $this->datetime->utcOffset($this->tzoffset)->getOffsetString('');
|
$o->tzutc = $this->datetime->utcOffset($this->tzoffset)->getOffsetString('');
|
||||||
$o->user_to = $this->to;
|
$o->user_to = $this->to;
|
||||||
$o->user_from = $this->from;
|
$o->user_from = $this->from;
|
||||||
$o->subject = $this->subject;
|
$o->subject = $this->subject;
|
||||||
|
|
||||||
// INTL kludge
|
// INTL kludge
|
||||||
// @todo Point handling FMPT/TOPT
|
// @todo Point handling FMPT/TOPT
|
||||||
$o->intl = sprintf('%s %s',$this->tftn->ftn3d,$this->fftn->ftn3d);
|
$o->intl = sprintf('%s %s',$this->tftn->ftn3d,$this->fftn->ftn3d);
|
||||||
$o->flags = $this->flags;
|
$o->flags = $this->flags;
|
||||||
|
|
||||||
$o->msgid = sprintf('%s %08x',$this->fftn->ftn3d,crc32($this->id));
|
$o->msgid = sprintf('%s %08x',$this->fftn->ftn3d,crc32($this->id));
|
||||||
if ($this->reply)
|
if ($this->reply)
|
||||||
$o->reply = $this->reply;
|
$o->reply = $this->reply;
|
||||||
|
|
||||||
$o->message = $this->msg;
|
$o->message = $this->msg;
|
||||||
|
|
||||||
if ($this->tagline)
|
if ($this->tagline)
|
||||||
$o->message .= $this->tagline;
|
$o->message .= $this->tagline;
|
||||||
|
|
||||||
if ($this->tearline)
|
if ($this->tearline)
|
||||||
$o->tearline .= $this->tearline;
|
$o->tearline .= $this->tearline;
|
||||||
|
|
||||||
// VIA kludge
|
// VIA kludge
|
||||||
$via = $this->via ?: collect();
|
$via = $this->via ?: collect();
|
||||||
$via->push(
|
$via->push(
|
||||||
sprintf('%s @%s.UTC %s %d.%d/%s %s',
|
sprintf('%s @%s.UTC %s %d.%d/%s %s',
|
||||||
$this->fftn->ftn3d,
|
$this->fftn->ftn3d,
|
||||||
Carbon::now()->utc()->format('Ymd.His'),
|
Carbon::now()->utc()->format('Ymd.His'),
|
||||||
Setup::PRODUCT_NAME,
|
Setup::PRODUCT_NAME,
|
||||||
Setup::PRODUCT_VERSION_MAJ,
|
Setup::PRODUCT_VERSION_MAJ,
|
||||||
Setup::PRODUCT_VERSION_MIN,
|
Setup::PRODUCT_VERSION_MIN,
|
||||||
(new Setup)->version,
|
(new Setup)->version,
|
||||||
Carbon::now()->format('Y-m-d'),
|
Carbon::now()->format('Y-m-d'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$o->via = $via;
|
$o->via = $via;
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error(sprintf('%s:Error converting netmail [%s] to a message (%d:%s)',self::LOGKEY,$this->id,$e->getLine(),$e->getMessage()));
|
||||||
|
dump($this);
|
||||||
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user