Enable duplicates to update seen-by's before being discarded
This commit is contained in:
@@ -142,16 +142,20 @@ class MessageProcess implements ShouldQueue
|
||||
->where('domain_id',$this->msg->fboss_o->zone->domain_id)
|
||||
->single();
|
||||
|
||||
Log::debug(sprintf('%s: - Processing echomail [%s].',self::LOGKEY,$this->msg->msgid));
|
||||
|
||||
// Check for duplicate messages
|
||||
// FTS-0009.001
|
||||
if ($this->msg->msgid) {
|
||||
$o = Echomail::where('msgid',$this->msg->msgid)
|
||||
->where('fftn_id',($x=$this->msg->fboss_o) ? $x->id : NULL)
|
||||
->where('datetime',Carbon::now()->subYears(3))
|
||||
->where('datetime','>',Carbon::now()->subYears(3))
|
||||
->single();
|
||||
|
||||
Log::debug(sprintf('%s: - Checking for duplicate from host id [%d].',self::LOGKEY,($x=$this->msg->fboss_o) ? $x->id : NULL));
|
||||
|
||||
if ($o) {
|
||||
Log::alert(sprintf('%s:! Ignoring duplicate echomail [%s] in [%s] from (%s) [%s] to (%s).',
|
||||
Log::alert(sprintf('%s:! Duplicate echomail [%s] in [%s] from (%s) [%s] to (%s) - updating seenby.',
|
||||
self::LOGKEY,
|
||||
$this->msg->msgid,
|
||||
$this->msg->echoarea,
|
||||
@@ -159,10 +163,31 @@ class MessageProcess implements ShouldQueue
|
||||
$this->msg->user_from,
|
||||
));
|
||||
|
||||
if (! $o->msg_crc)
|
||||
$o->msg_crc = md5($this->msg->message);
|
||||
|
||||
$o->seenby = collect($o->getRawOriginal('seenby'))->merge($this->msg->seenaddress)->filter()->toArray();
|
||||
$o->save();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Find another message with the same msg_crc
|
||||
if ($this->msg->message) {
|
||||
$o = Echomail::where('msg_crc',$xx=md5($this->msg->message))
|
||||
->where('fftn_id',($x=$this->msg->fboss_o) ? $x->id : NULL)
|
||||
->where('datetime','>',Carbon::now()->subWeek())
|
||||
->get();
|
||||
|
||||
if ($o->count())
|
||||
Log::alert(sprintf('%s:! Duplicate message CRC [%s] in [%s].',
|
||||
self::LOGKEY,
|
||||
$xx,
|
||||
$o->pluck('id')->join('|')
|
||||
));
|
||||
}
|
||||
|
||||
// @todo Can the sender create it if it doesnt exist?
|
||||
// @todo Can the sender send messages to this area?
|
||||
// - Create it, or
|
||||
|
Reference in New Issue
Block a user