Complete of logging received and sent packet names, and display them in the web ui for each node

This commit is contained in:
Deon George 2023-07-15 22:10:05 +10:00
parent 61ab0614b6
commit a3302b4012
14 changed files with 257 additions and 121 deletions

View File

@ -357,6 +357,9 @@ class Message extends FTNBase
case 'errors': case 'errors':
return $this->{$key}; return $this->{$key};
case 'dbid':
return $this->kludge->get($key);
default: default:
throw new \Exception('Unknown key: '.$key); throw new \Exception('Unknown key: '.$key);
} }

View File

@ -36,9 +36,9 @@ class Item
protected const I_RECV = (1<<0); protected const I_RECV = (1<<0);
protected const I_SEND = (1<<1); protected const I_SEND = (1<<1);
protected string $file_name = ''; protected string $file_name;
protected int $file_size = 0; protected int $file_size;
protected int $file_mtime = 0; protected int $file_mtime;
/** Current read/write pointer */ /** Current read/write pointer */
protected int $file_pos = 0; protected int $file_pos = 0;
/** File descriptor */ /** File descriptor */
@ -113,8 +113,27 @@ class Item
{ {
switch($key) { switch($key) {
case 'mtime': case 'mtime':
if ($this instanceof Mail)
$this->youngest()->timestamp;
if ($this->action & self::I_RECV|self::I_SEND)
return $this->{'file_'.$key};
throw new \Exception('Invalid request for key: '.$key);
case 'name': case 'name':
if ($this instanceof Mail)
return sprintf('%08x',timew($this->youngest()));
if ($this->action & self::I_RECV|self::I_SEND)
return $this->{'file_'.$key};
throw new \Exception('Invalid request for key: '.$key);
case 'size': case 'size':
if ($this instanceof Mail)
return strlen($this->file);
if ($this->action & self::I_RECV|self::I_SEND) if ($this->action & self::I_RECV|self::I_SEND)
return $this->{'file_'.$key}; return $this->{'file_'.$key};
@ -124,6 +143,9 @@ class Item
return $this->file_name; return $this->file_name;
case 'sendas': case 'sendas':
if ($this instanceof Mail)
return sprintf('%s.pkt',$this->name);
return $this->file_name ? basename($this->file_name) : $this->filemodel->name; return $this->file_name ? basename($this->file_name) : $this->filemodel->name;
default: default:

View File

@ -31,6 +31,7 @@ class Mail extends Item
public function __get($key) { public function __get($key) {
switch ($key) { switch ($key) {
case 'file': return $this->file; case 'file': return $this->file;
case 'messages': return $this->file->messages;
default: default:
return parent::__get($key); return parent::__get($key);
} }

View File

@ -41,6 +41,9 @@ final class Send extends Item
public function __get($key) public function __get($key)
{ {
switch ($key) { switch ($key) {
case 'dbids':
return $this->sending->messages->pluck('echoarea','dbid');
case 'fd': case 'fd':
return is_resource($this->f) ?: $this->f; return is_resource($this->f) ?: $this->f;
@ -242,13 +245,15 @@ final class Send extends Item
*/ */
public function open(string $compress=''): bool public function open(string $compress=''): bool
{ {
Log::debug(sprintf('%s:+ open',self::LOGKEY)); Log::debug(sprintf('%s:+ Opening file to send',self::LOGKEY));
// If we have mail, we'll send that first // If we have mail, we'll send that first
if ($this->sending = $this->packets if ($this->sending = $this->packets
->filter(function($item) { return ($item->action & self::I_SEND) && $item->sent === FALSE; }) ->filter(function($item) { return ($item->action & self::I_SEND) && $item->sent === FALSE; })
->first()) ->first())
{ {
Log::debug(sprintf('%s:- Sending [%s]',self::LOGKEY,$this->sending->name));
$this->file_pos = 0; $this->file_pos = 0;
$this->start = time(); $this->start = time();
$this->f = TRUE; $this->f = TRUE;

View File

@ -5,11 +5,13 @@ namespace App\Classes\Protocol;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use League\Flysystem\UnreadableFileEncountered; use League\Flysystem\UnreadableFileEncountered;
use App\Classes\Crypt; use App\Classes\Crypt;
use App\Classes\Protocol as BaseProtocol; use App\Classes\Protocol as BaseProtocol;
use App\Classes\FTN\Message;
use App\Classes\Sock\SocketClient; use App\Classes\Sock\SocketClient;
use App\Classes\Sock\SocketException; use App\Classes\Sock\SocketException;
use App\Exceptions\FileGrewException; use App\Exceptions\FileGrewException;
@ -991,8 +993,30 @@ final class Binkp extends BaseProtocol
Log::error(sprintf('%s:! M_got[skip] for unknown file [%s]',self::LOGKEY,$buf)); Log::error(sprintf('%s:! M_got[skip] for unknown file [%s]',self::LOGKEY,$buf));
} else { } else {
Log::info(sprintf('%s:= Packet/File [%s] sent.',self::LOGKEY,$this->send->name)); Log::info(sprintf('%s:= Packet/File [%s] sent with [%s].',self::LOGKEY,$this->send->name,$this->send->dbids->join(',')));
$this->sessionClear(self::SE_WAITGOT|self::SE_SENDFILE); $this->sessionClear(self::SE_WAITGOT|self::SE_SENDFILE);
// Update netmail table
if ($x=$this->send->dbids->filter(function($item) { return (! $item); })->keys()->filter())
DB::table('netmails')
->whereIn('id',$x)
->update([
'sent_at'=>Carbon::now(),
'sent_pkt'=>$this->send->name,
'sent_id'=>$this->node->address->id,
'flags'=>DB::raw('flags | '.Message::FLAG_SENT),
]);
// Update echomails table
if ($x=$this->send->dbids->filter(function($item) { return $item; })->keys()->filter())
DB::table('echomail_seenby')
->whereIn('echomail_id',$x)
->where('address_id',$this->node->address->id)
->update([
'sent_at'=>Carbon::now(),
'sent_pkt'=>$this->send->name,
]);
$this->send->close(TRUE); $this->send->close(TRUE);
} }
} }

View File

@ -103,6 +103,13 @@ class MessageProcess implements ShouldQueue
$o->flags |= Message::FLAG_RECD; $o->flags |= Message::FLAG_RECD;
$o->save(); $o->save();
Log::info(sprintf('%s:! Netmail [%s] from (%s:%s) - was processed by us [%d]',
self::LOGKEY,
$this->msg->msgid,
$this->msg->user_from,
$this->msg->fftn,
$o->id,
));
break; break;
} }
} }
@ -112,7 +119,7 @@ class MessageProcess implements ShouldQueue
$o->flags |= Message::FLAG_RECD; $o->flags |= Message::FLAG_RECD;
$o->save(); $o->save();
Log::alert(sprintf('%s:! Ignoring Netmail [%s] to the Hub from (%s:%s) - its from a bot [%d].', Log::alert(sprintf('%s:! Ignoring Netmail [%s] to the Hub from (%s:%s) - its from a bot [%d]',
self::LOGKEY, self::LOGKEY,
$this->msg->msgid, $this->msg->msgid,
$this->msg->user_from, $this->msg->user_from,
@ -289,6 +296,7 @@ class MessageProcess implements ShouldQueue
$o->set_path = $this->msg->pathaddress; $o->set_path = $this->msg->pathaddress;
$o->set_seenby = $this->msg->seenaddress; $o->set_seenby = $this->msg->seenaddress;
// Record receiving packet and sender // Record receiving packet and sender
$o->set_pkt = $this->packet;
$o->save(); $o->save();

View File

@ -6,7 +6,6 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -598,9 +597,9 @@ class Address extends Model
->whereIn('echomail_id',$x->pluck('id')) ->whereIn('echomail_id',$x->pluck('id'))
->where('address_id',$this->id) ->where('address_id',$this->id)
->whereNull('sent_at') ->whereNull('sent_at')
->whereNull('packet') ->whereNull('sent_pkt')
->whereNotNull('echomail_seenby.export_at') ->whereNotNull('echomail_seenby.export_at')
->update(['sent_at'=>Carbon::now(),'packet'=>$pkt->name]); ->update(['sent_pkt'=>$pkt->name]);
} }
return $pkt; return $pkt;
@ -638,21 +637,28 @@ class Address extends Model
* @param bool $update * @param bool $update
* @return Packet|null * @return Packet|null
*/ */
public function getNetmail(bool $update=TRUE): ?Packet public function getNetmail(bool $update=FALSE): ?Packet
{ {
$pkt = NULL; $pkt = NULL;
$s = Setup::findOrFail(config('app.id'));
if (($x=$this->netmailWaiting()) if (($x=$this->netmailWaiting())
->count()) ->count())
{ {
Log::debug(sprintf('%s:= Got [%d] netmails for [%s] for sending',self::LOGKEY,$x->count(),$this->ftn)); Log::debug(sprintf('%s:= Got [%d] netmails for [%s] for sending',self::LOGKEY,$x->count(),$this->ftn));
if ($x->count() > $s->msgs_pkt) {
$x = $x->take($s->msgs_pkt);
Log::alert(sprintf('%s:= Only sending [%d] netmails for [%s]',self::LOGKEY,$x->count(),$this->ftn));
}
$pkt = $this->getPacket($x); $pkt = $this->getPacket($x);
if ($pkt && $pkt->count() && $update) if ($pkt && $pkt->count() && $update)
DB::table('netmails') DB::table('netmails')
->whereIn('id',$x->pluck('id')) ->whereIn('id',$x->pluck('id'))
->update(['sent_at'=>Carbon::now(),'sent_pkt'=>$pkt->name]); ->update(['sent_pkt'=>$pkt->name]);
} }
return $pkt; return $pkt;

View File

@ -22,7 +22,7 @@ final class Echomail extends Model implements Packet
private const LOGKEY = 'ME-'; private const LOGKEY = 'ME-';
private Collection $set_seenby; private Collection $set_seenby;
private Collection $set_path; private Collection $set_path;
private ?string $set_packet = NULL; private string $set_pkt;
private bool $no_export = FALSE; private bool $no_export = FALSE;
protected $casts = [ protected $casts = [
@ -50,7 +50,7 @@ final class Echomail extends Model implements Packet
switch ($key) { switch ($key) {
case 'no_export': case 'no_export':
case 'set_path': case 'set_path':
case 'set_packet': case 'set_pkt':
case 'set_seenby': case 'set_seenby':
$this->{$key} = $value; $this->{$key} = $value;
break; break;
@ -71,17 +71,8 @@ final class Echomail extends Model implements Packet
return; return;
} }
// Our address
$ftns = Setup::findOrFail(config('app.id'))
->system
->match($model->fftn->zone);
// Add our address to the seenby;
$model->set_seenby = $model->set_seenby->merge($ftns->pluck('id'))->unique();
$model->set_path = $model->set_path->merge($ftns->pluck('id'));
// Save the seenby // Save the seenby
$model->seenby()->syncWithPivotValues($model->set_seenby,['packet'=>$model->set_packet]); $model->seenby()->sync($model->set_seenby);
// Save the Path // Save the Path
$ppoid = NULL; $ppoid = NULL;
@ -95,6 +86,15 @@ final class Echomail extends Model implements Packet
$ppoid = $po[0]->id; $ppoid = $po[0]->id;
} }
// Our last node in the path is our sender
if (isset($model->set_pkt)) {
DB::update('UPDATE echomail_path set recv_pkt=? where address_id=? and echomail_id=?',[
$model->set_pkt,
$model->set_path->last(),
$model->id,
]);
}
// See if we need to export this message. // See if we need to export this message.
$exportto = $model->echoarea->addresses->pluck('id')->diff($model->set_seenby); $exportto = $model->echoarea->addresses->pluck('id')->diff($model->set_seenby);
@ -143,7 +143,6 @@ final class Echomail extends Model implements Packet
{ {
$this->set_path = collect(); $this->set_path = collect();
$this->set_seenby = collect(); $this->set_seenby = collect();
$this->set_packet = NULL;
} }
public function jsonSerialize(): array public function jsonSerialize(): array
@ -156,7 +155,7 @@ final class Echomail 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)); 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;
@ -166,7 +165,7 @@ final class Echomail extends Model implements Packet
'dnode' => $ao->node_id, 'dnode' => $ao->node_id,
'onet' => $this->fftn->host_id, 'onet' => $this->fftn->host_id,
'dnet' => $ao->host_id, 'dnet' => $ao->host_id,
'flags' => 0, // @todo? 'flags' => 0,
'cost' => 0, 'cost' => 0,
'date'=>$this->datetime->format('d M y H:i:s'), 'date'=>$this->datetime->format('d M y H:i:s'),
]; ];
@ -198,8 +197,11 @@ final class Echomail extends Model implements Packet
if ($this->origin) if ($this->origin)
$o->origin = $this->origin; $o->origin = $this->origin;
$o->seenby = $this->seenby->pluck('ftn2d'); $sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$o->path = $this->pathorder(); $o->seenby = $this->seenby->push($sysaddress)->unique()->pluck('ftn2d');
// Add our address to the path and seenby
$o->path = $this->pathorder()->merge($sysaddress->ftn2d);
$o->packed = TRUE; $o->packed = TRUE;

View File

@ -42,7 +42,6 @@ class File extends Model
case 'replaces': case 'replaces':
case 'no_export': case 'no_export':
case 'set_path': case 'set_path':
case 'set_packet':
case 'set_seenby': case 'set_seenby':
$this->{$key} = $value; $this->{$key} = $value;
break; break;

View File

@ -85,11 +85,13 @@ final class Netmail extends Model implements Packet
$ppoid = $po[0]->id; $ppoid = $po[0]->id;
} }
// Our last node in the path is our sender
if (isset($model->set_pkt) && isset($model->set_sender)) { if (isset($model->set_pkt) && isset($model->set_sender)) {
DB::update('UPDATE netmail_path set recv_pkt=?,recv_id=? where address_id=?',[ DB::update('UPDATE netmail_path set recv_pkt=?,recv_id=? where address_id=? and netmail_id=?',[
$model->set_pkt, $model->set_pkt,
$model->set_sender->id, $model->set_sender->id,
Arr::get($model->set_path->last(),'node')->id, Arr::get($model->set_path->last(),'node')->id,
$model->id,
]); ]);
} }
} }
@ -130,7 +132,7 @@ final 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)); 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;
@ -169,6 +171,7 @@ final class Netmail extends Model implements Packet
// VIA kludge // VIA kludge
$sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first(); $sysaddress = Setup::findOrFail(config('app.id'))->system->match($this->fftn->zone)->first();
$via = $this->via ?: collect(); $via = $this->via ?: collect();
// Add our address to the VIA line
$via->push( $via->push(
sprintf('%s @%s.UTC %s %d.%d/%s %s', sprintf('%s @%s.UTC %s %d.%d/%s %s',
$sysaddress->ftn3d, $sysaddress->ftn3d,
@ -185,7 +188,7 @@ final class Netmail extends Model implements Packet
$o->packed = TRUE; $o->packed = TRUE;
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error(sprintf('%s:Error converting netmail [%s] to a message (%d:%s)',self::LOGKEY,$this->id,$e->getLine(),$e->getMessage())); Log::error(sprintf('%s:! Error converting netmail [%s] to a message (%d:%s)',self::LOGKEY,$this->id,$e->getLine(),$e->getMessage()));
dump($this); dump($this);
} }

View File

@ -192,7 +192,7 @@ class System extends Model
*/ */
public function match(Zone $o,int $type=(Address::NODE_NC|Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT)): Collection public function match(Zone $o,int $type=(Address::NODE_NC|Address::NODE_HC|Address::NODE_ACTIVE|Address::NODE_PVT|Address::NODE_POINT)): Collection
{ {
return $this->addresses return $this->akas
->where('zone_id',$o->id) ->where('zone_id',$o->id)
->filter(function($item) use ($type) { ->filter(function($item) use ($type) {
return $item->role & $type; return $item->role & $type;

View File

@ -11,53 +11,25 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
/*
Schema::create('system_transfers',function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('packet')->nullable();
$table->bigInteger('file_id')->nullable();
$table->foreign('file_id')->references('id')->on('files');
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['address_id','packet']);
$table->unique(['address_id','file_id']);
});
*/
Schema::table('netmails',function (Blueprint $table) { Schema::table('netmails',function (Blueprint $table) {
$table->bigInteger('send_id')->nullable()->after('send_pkt'); $table->bigInteger('sent_id')->nullable()->after('sent_pkt');
$table->foreign('send_id')->references('id')->on('addresses'); $table->foreign('sent_id')->references('id')->on('addresses');
}); });
Schema::table('netmail_path',function (Blueprint $table) { Schema::table('netmail_path',function (Blueprint $table) {
$table->string('recv_pkt')->nullable(); $table->string('recv_pkt')->nullable();
$table->bigInteger('recv_id')->nullable()->after('recv_pkt');
$table->bigInteger('recv_id')->nullable();
$table->foreign('recv_id')->references('id')->on('addresses'); $table->foreign('recv_id')->references('id')->on('addresses');
$table->unique(['recv_id','netmail_id']);
}); });
DB::statement('ALTER TABLE echomail_seenby RENAME COLUMN packet TO sent_pkt'); DB::statement('ALTER TABLE echomail_seenby RENAME COLUMN packet TO sent_pkt');
Schema::table('echomail_seenby',function (Blueprint $table) { Schema::table('echomail_seenby',function (Blueprint $table) {
$table->bigInteger('sent_id')->nullable(); $table->dropColumn('mid');
$table->foreign('sent_id')->references('id')->on('addresses');
$table->unique(['sent_id','echomail_id']);
}); });
Schema::table('echomail_path',function (Blueprint $table) { Schema::table('echomail_path',function (Blueprint $table) {
$table->string('recv_pkt')->nullable(); $table->string('recv_pkt')->nullable();
$table->bigInteger('recv_id')->nullable();
$table->foreign('recv_id')->references('id')->on('addresses');
$table->unique(['recv_id','echomail_id']);
}); });
} }
@ -66,6 +38,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
//Schema::dropIfExists('system_transfers'); abort(500,'Cant go back');
} }
}; };

View File

@ -415,57 +415,141 @@
<div class="accordion-body"> <div class="accordion-body">
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
The last Netmails sent: The last Netmails sent (to you):
<table class="table monotable">
<thead>
<tr>
<th>FTN</th>
<th>Packet</th>
<th>Sent</th>
</tr>
</thead>
<tbody> @if(($x=\App\Models\Netmail::whereIn('sent_id',$o->addresses->pluck('id'))
@dump($o->addresses->sortBy('zone.zone_id')->pluck('ftn')) ->whereNotNull('sent_at')
@foreach (\App\Models\Netmail::where('tftn_id',$o->addresses->pluck('id'))->whereNotNull('sent_at')->orderBy('sent_at')->limit(10) as $no) ->orderBy('sent_at','DESC')
->limit(10)
->get())->count())
<table class="table monotable">
<thead>
<tr> <tr>
<td>{{ $no->tftn->ftn }}</td> <th>Packet</th>
<td></td> <th>Count</th>
<td></td> <th>Sent</th>
</tr> </tr>
@endforeach </thead>
</tbody>
</table> <tbody>
@foreach ($x->groupBy('sent_pkt') as $oo)
<tr>
<td>{{ $oo->first()->sent_pkt }}</td>
<td>{{ $oo->count() }}</td>
<td>{{ $oo->first()->sent_at }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
<strong class="highlight">None</strong>
@endif
</div> </div>
<div class="col-4"> <div class="col-4">
The last Echomails sent: The last Echomails sent (to you):
<table class="table monotable">
<thead>
<tr>
<th>FTN</th>
<th>Packet</th>
<th>Sent</th>
</tr>
</thead>
<tbody> @if(($x=\App\Models\Echomail::select(['echomails.id','echomail_seenby.sent_pkt','echomail_seenby.sent_at'])
@foreach (\App\Models\Echomail::join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) ->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id'])
->whereNotNull('echomail_seenby.sent_at') ->whereNotNull('echomail_seenby.sent_at')
->whereIn('address_id',$o->addresses->pluck('id')) ->whereIn('address_id',$o->addresses->pluck('id'))
->orderBy('sent_at','DESC') ->orderBy('sent_at','DESC')
->orderBy('packet') ->orderBy('sent_pkt')
->limit(10) ->limit(10)
->get() ->get())->count())
->groupBy('packet') as $oo) <table class="table monotable">
<thead>
<tr> <tr>
<td>{{ \App\Models\Address::where('id',$oo->first()->address_id)->single()->ftn }}</td> <th>Packet</th>
<td>{{ $oo->first()->packet }}</td> <th>Count</th>
<td>{{ $oo->first()->sent_at }}</td> <th>Sent</th>
</tr> </tr>
@endforeach </thead>
</tbody>
</table> <tbody>
@foreach ($x->groupBy('sent_pkt') as $oo)
<tr>
<td>{{ $oo->first()->sent_pkt }}</td>
<td>{{ $oo->count() }}</td>
<td>{{ $oo->first()->sent_at }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
<strong class="highlight">None</strong>
@endif
</div>
</div>
<div class="row pt-2">
<div class="col-4">
The last Netmails received (you sent):
@if(($x=\App\Models\Netmail::select(['netmails.*','netmail_path.recv_pkt'])
->join('netmail_path',['netmail_path.netmail_id'=>'netmails.id'])
->whereIn('address_id',$o->addresses->pluck('id'))
->orderBy('created_at','DESC')
->limit(10)
->get())->count())
<table class="table monotable">
<thead>
<tr>
<th>Packet</th>
<th>Count</th>
<th>Received</th>
</tr>
</thead>
<tbody>
@foreach ($x->groupBy('recv_pkt') as $oo)
<tr>
<td>{{ $oo->first()->recv_pkt }}</td>
<td>{{ $oo->count() }}</td>
<td>{{ $oo->first()->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
<strong class="highlight">None</strong>
@endif
</div>
<div class="col-4">
The last Echomails received (you sent):
@if(($x=\App\Models\Echomail::select(['echomails.created_at','echomail_path.recv_pkt'])
->join('echomail_path',['echomail_path.echomail_id'=>'echomails.id'])
->whereNotNull('echomail_path.recv_pkt')
->whereIn('address_id',$o->addresses->pluck('id'))
->orderBy('created_at','DESC')
->orderBy('recv_pkt')
->limit(10)
->get())->count())
<table class="table monotable">
<thead>
<tr>
<th>Packet</th>
<th>Count</th>
<th>Received</th>
</tr>
</thead>
<tbody>
@foreach ($x->groupBy('recv_pkt') as $oo)
<tr>
<td>{{ $oo->first()->recv_pkt }}</td>
<td>{{ $oo->count() }}</td>
<td>{{ $oo->first()->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
@else
<strong class="highlight">None</strong>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,10 @@
@php
use App\Classes\FTN\Message;
@endphp
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
TO: <strong class="highlight">{!! \App\Classes\FTN\Message::tr($msg->to) !!}</strong> @if ($msg instanceof \App\Models\Netmail)(<strong class="highlight">{{ $msg->tftn->ftn }}</strong>)@endif TO: <strong class="highlight">{!! Message::tr($msg->to) !!}</strong> @if ($msg instanceof \App\Models\Netmail)(<strong class="highlight">{{ $msg->tftn->ftn }}</strong>)@endif
</div> </div>
<div class="col-4"> <div class="col-4">
DATE: <strong class="highlight">{{ $msg->datetime->format('Y-m-d H:i:s') }}</strong> DATE: <strong class="highlight">{{ $msg->datetime->format('Y-m-d H:i:s') }}</strong>
@ -9,7 +13,7 @@
<div class="row pt-1"> <div class="row pt-1">
<div class="col-4"> <div class="col-4">
FROM: <strong class="highlight">{!! \App\Classes\FTN\Message::tr($msg->from) !!}</strong> (<strong class="highlight">{{ $msg->fftn->ftn }}</strong>) FROM: <strong class="highlight">{!! Message::tr($msg->from) !!}</strong> (<strong class="highlight">{{ $msg->fftn->ftn }}</strong>)
</div> </div>
<div class="col-4"> <div class="col-4">
MSGID: <strong class="highlight">{{ $msg->msgid }}</strong>@if($x=\App\Models\Echomail::where('replyid',$msg->msgid)->count()) (<strong class="highlight">{{$x}}</strong> replies)@endif @if($msg->replyid)<br>REPLY: <strong class="highlight">{{ $msg->replyid }}</strong>@endif MSGID: <strong class="highlight">{{ $msg->msgid }}</strong>@if($x=\App\Models\Echomail::where('replyid',$msg->msgid)->count()) (<strong class="highlight">{{$x}}</strong> replies)@endif @if($msg->replyid)<br>REPLY: <strong class="highlight">{{ $msg->replyid }}</strong>@endif
@ -18,7 +22,7 @@
<div class="row pt-1 pb-2"> <div class="row pt-1 pb-2">
<div class="col-4"> <div class="col-4">
SUBJECT: <strong class="highlight">{!! \App\Classes\FTN\Message::tr($msg->subject) !!}</strong> SUBJECT: <strong class="highlight">{!! Message::tr($msg->subject) !!}</strong>
</div> </div>
@if ($msg instanceof \App\Models\Echomail) @if ($msg instanceof \App\Models\Echomail)
<div class="col-4"> <div class="col-4">
@ -30,7 +34,7 @@
<div class="row pb-2"> <div class="row pb-2">
<div class="col-8"> <div class="col-8">
<div class="pad pb-0"> <div class="pad pb-0">
<pre class="highlight">{!! \App\Classes\FTN\Message::tr($msg->msg).($msg->origin ? sprintf("\r * Origin: %s",$msg->origin) : '') !!}</pre> <pre class="highlight">{!! Message::tr($msg->msg).($msg->origin ? sprintf("\r * Origin: %s",$msg->origin) : '') !!}</pre>
</div> </div>
</div> </div>
</div> </div>
@ -43,26 +47,29 @@
</div> </div>
@endif @endif
@if ($msg->flags & \App\Classes\FTN\Message::FLAG_LOCAL) @if ($msg->flags & Message::FLAG_LOCAL)
<div class="row pb-2"> <div class="row pb-2">
<div class="col-8"> <div class="col-8">
<strong class="highlight">Local message</strong> <strong class="highlight">Local message</strong>
</div> </div>
</div> </div>
@elseif ($msg->flags & (\App\Classes\FTN\Message::FLAG_INTRANSIT|\App\Classes\FTN\Message::FLAG_RECD)) @elseif ((! $msg->flags) || ($msg->flags & (Message::FLAG_INTRANSIT|Message::FLAG_RECD)))
<!-- @todo for the nodes we export to, highlight those that we have actually sent it, vs those that havent received it yet -->
<div class="row pb-2"> <div class="row pb-2">
<div class="col-8"> <div class="col-8">
PATH: <br><strong class="highlight">{!! optimize_path($msg->pathorder())->join('</strong> -> <strong class="highlight">') !!}</strong> PATH: <br><strong class="highlight">{!! optimize_path($msg->pathorder())->join('</strong> -> <strong class="highlight">') !!}</strong>
</div> </div>
</div> </div>
<div class="row pb-2"> @if ($msg->flags)
<div class="col-8"> <div class="row pb-2">
RECEIVED: <div class="col-8">
@foreach ($msg->received as $path) RECEIVED:
<strong class="highlight">{{ $path->pivot->recv_pkt }}</strong> by <strong class="highlight">{{ $path->ftn }}</strong> {{ $msg->created_at }} @foreach ($msg->received as $path)
@endforeach <strong class="highlight">{{ $path->pivot->recv_pkt }}</strong> by <strong class="highlight">{{ $path->ftn }}</strong> {{ $msg->created_at }}
@endforeach
</div>
</div> </div>
</div> @endif
@endif @endif