Implemented file sending during BINKP and EMSI sessions
This commit is contained in:
@@ -572,6 +572,32 @@ class Address extends Model
|
||||
return $pkt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files for this node (including it's children)
|
||||
*
|
||||
* @param bool $update
|
||||
* @return Collection
|
||||
*/
|
||||
public function getFiles(bool $update=TRUE): Collection
|
||||
{
|
||||
if (($files=$this->filesWaiting())
|
||||
->count())
|
||||
{
|
||||
Log::debug(sprintf('%s:= Got [%d] files for [%s] for sending',self::LOGKEY,$files->count(),$this->ftn));
|
||||
|
||||
// @todo This should be transactional, incase the transfer fails
|
||||
if ($files->count() && $update)
|
||||
DB::table('file_seenby')
|
||||
->whereIn('file_id',$files->pluck('id'))
|
||||
->where('address_id',$this->id)
|
||||
->whereNull('sent_at')
|
||||
->whereNotNull('export_at')
|
||||
->update(['sent_at'=>Carbon::now()]);
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get netmail for this node (including it's children)
|
||||
*
|
||||
|
Reference in New Issue
Block a user