Implemented file sending during BINKP and EMSI sessions

This commit is contained in:
2023-06-22 17:36:22 +10:00
parent 58341db0fb
commit b1b86ca04a
14 changed files with 308 additions and 82 deletions

View File

@@ -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)
*