Allow for origin/tagline/tearline can have UTF8 chars, show # messages in packets

This commit is contained in:
Deon George 2021-09-12 23:06:17 +10:00
parent 5e8b590f17
commit 79e613a811
7 changed files with 19 additions and 5 deletions

View File

@ -22,14 +22,17 @@ use App\Traits\EncodeUTF8;
*/
class Message extends FTNBase
{
private const LOGKEY = 'FM-';
use EncodeUTF8;
private const LOGKEY = 'FM-';
private const cast_utf8 = [
'subject',
'message',
'message_src',
'origin',
'tearline',
'tagline',
];
// Single value kludge items

View File

@ -445,7 +445,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
// This shouldnt happen
if ($e || $ao->exists) {
Log::error(sprintf('%s:! Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss));
Log::error(sprintf('%s:! Unexpected error attempting to create address [%s]',self::LOGKEY,$msg->fboss));
$this->errors->push($msg);
return;
}

View File

@ -133,8 +133,10 @@ final class Receive extends Item
break;
}
Log::info(sprintf('%s: - Packet has [%d] messages',self::LOGKEY,$po->count()));
// Queue messages if there are too many in the packet.
if ($queue = ($po->count() > config('app.queue_msgs')))
$queue = ($po->count() > config('app.queue_msgs'));
Log::info(sprintf('%s: - Messages will be sent to the queue for processing',self::LOGKEY));
foreach ($po as $msg) {

View File

@ -45,6 +45,7 @@ class PacketInfo extends Command
$this->info(sprintf('Tosser %d (%s) version %s',$pkt->software->code,$pkt->software->name,$pkt->software_ver));
$this->info(sprintf('Capabilities: %x',$pkt->capability));
$this->info(sprintf('Has Errors: %s',$pkt->errors->count() ? 'YES' : 'No'));
$this->info(sprintf('Messages: %d',$pkt->count()));
foreach ($pkt as $msg) {
$this->warn(sprintf('- Date: %s',$msg->date));

View File

@ -43,8 +43,10 @@ class PacketProcess extends Command
// @todo Quick check that the packet should be processed by us.
// @todo validate that the packet's zone is in the domain.
$this->info(sprintf('Processing message from [%s] with msgid [%s]',$msg->fboss,$msg->msgid));
// Dispatch job.
Job::dispatchSync($msg,$this->option('nobot'));
Job::dispatch($msg,$this->option('nobot'));
}
}
}

View File

@ -24,6 +24,9 @@ final class Echomail extends Model implements Packet
private const cast_utf8 = [
'subject',
'msg',
'origin',
'tearline',
'tagline',
];
protected $dates = ['datetime'];

View File

@ -20,6 +20,9 @@ final class Netmail extends Model implements Packet
private const cast_utf8 = [
'subject',
'msg',
'origin',
'tearline',
'tagline',
];
protected $dates = ['datetime','sent_at'];