belongsTo(System::class); } /* ATTRIBUTES */ public function getLocationAttribute() { return $this->system->location; } public function getSysopAttribute() { return $this->system->sysop; } public function getSystemNameAttribute() { return $this->system->name; } /* METHODS */ public function __construct(array $attributes = []) { parent::__construct($attributes); // @todo These option should be in setup? $this->binkp_options = ['m','d','r','b']; /* EMSI SETTINGS */ $this->do_prevent = 1; /* EMSI - send an immediate EMSI_INQ on connect */ $this->ignore_nrq = 0; $this->options = 0; /* EMSI - our capabilities */ } /** * @throws Exception */ public function __get($key) { switch ($key) { case 'binkp_options': case 'ignore_nrq': case 'opt_nr': // @todo - this keys are now in #binkp as bits case 'opt_nd': case 'opt_nda': case 'opt_md': case 'opt_cr': case 'opt_mb': case 'opt_cht': case 'opt_mpwd': case 'do_prevent': return $this->internal[$key] ?? FALSE; case 'version': return File::exists('VERSION') ? chop(File::get('VERSION')) : 'dev'; default: return parent::__get($key); } } /** * @throws Exception */ public function __set($key,$value) { switch ($key) { case 'binkp_options': case 'ignore_nrq': case 'opt_nr': case 'opt_nd': case 'opt_nda': case 'opt_md': case 'opt_cr': case 'opt_mb': case 'opt_cht': case 'opt_mpwd': case 'do_prevent': $this->internal[$key] = $value; break; default: parent::__set($key,$value); } } /* BINKP OPTIONS: BINKP_OPT_* */ public function binkpOptionClear(int $key): void { $this->binkp &= ~$key; } public function binkpOptionGet(int $key): int { return ($this->binkp & $key); } public function binkpOptionSet(int $key): void { $this->binkp |= $key; } /* GENERAL OPTIONS: O_* */ public function optionClear(int $key): void { $this->options &= ~$key; } public function optionGet(int $key): int { return ($this->options & $key); } public function optionSet(int $key): void { $this->options |= $key; } }