Catch Exception when interpretting date, Create MSGID if it doesnt exist, Fix when \r\n is used in messages.
This commit is contained in:
parent
ba7f9c1c99
commit
85d9dd1545
@ -307,8 +307,14 @@ class Message extends FTNBase
|
|||||||
return Address::findFTN($this->tboss);
|
return Address::findFTN($this->tboss);
|
||||||
|
|
||||||
case 'date':
|
case 'date':
|
||||||
return Carbon::createFromFormat('d M y H:i:s O',
|
try {
|
||||||
sprintf('%s %s%04d',chop(Arr::get($this->header,$key)),($this->tzutc < 0) ? '-' : '+',abs($this->tzutc)));
|
return Carbon::createFromFormat('d M y H:i:s O',
|
||||||
|
sprintf('%s %s%04d',chop(Arr::get($this->header,$key)),($this->tzutc < 0) ? '-' : '+',abs($this->tzutc)));
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error(sprintf('%s: ! Date doesnt parse [%s] (%s)',self::LOGKEY,$e->getMessage(),Arr::get($this->header,$key)));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
case 'flags':
|
case 'flags':
|
||||||
case 'cost':
|
case 'cost':
|
||||||
@ -651,6 +657,7 @@ class Message extends FTNBase
|
|||||||
{
|
{
|
||||||
// Remove DOS \n\r
|
// Remove DOS \n\r
|
||||||
$message = preg_replace("/\n\r/","\r",$message);
|
$message = preg_replace("/\n\r/","\r",$message);
|
||||||
|
$message = preg_replace("/\r\n/","\r",$message);
|
||||||
|
|
||||||
// Split out the <SOH> lines
|
// Split out the <SOH> lines
|
||||||
$result = collect(explode("\x01",$message))->filter();
|
$result = collect(explode("\x01",$message))->filter();
|
||||||
|
@ -421,13 +421,18 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
$msg = Message::parseMessage($message,$domain);
|
$msg = Message::parseMessage($message,$domain);
|
||||||
|
|
||||||
// If the message is invalid, we'll ignore it
|
// If the message is invalid, we'll ignore it
|
||||||
if ($msg->errors && $msg->errors->messages()->has('from')) {
|
if ($msg->errors && (
|
||||||
|
$msg->errors->messages()->has('from')
|
||||||
|
|| $msg->errors->messages()->has('user_from')
|
||||||
|
|| $msg->errors->messages()->has('user_to')
|
||||||
|
))
|
||||||
|
{
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
Log::error(sprintf('%s:! %s Skipping...',self::LOGKEY,join('|',$msg->errors->messages()->get('from'))));
|
Log::error(sprintf('%s:! Skipping message [%s] due to errors (%s)...',self::LOGKEY,$msg->msgid,join(',',$msg->errors->messages()->keys())));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($this->use_redis) {
|
if ($this->use_redis) {
|
||||||
Redis::set($msg->msgid,serialize($msg));
|
Redis::set($msg->msgid ?: sprintf('%s %s',$msg->fftn,Carbon::now()->timestamp),serialize($msg));
|
||||||
$this->messages->push($msg->msgid);
|
$this->messages->push($msg->msgid);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user