public function Ping() { if (!$this->iHasBeenReply) { $this->iNoReply++; $this->iHasBeenReply = false; } if ($this->iNoReply >= 5) { $this->destructBot(); Timers::Create(array($this, "constructBot"), $this->aConfig['timewait'], 0); $this->isWaiting = true; $this->iNoReply = 0; } $this->Output("PING " . time()); $this->iHasBeenReply = false; }
/** * Creates a timer, note that arguments to be passed to $cCallback to after $iRepeat. * * <code>$this->timerCreate( array($this, 'Message'), '0.5000', '10' );</code> * * @param callback $cCallback Timer callback * @param float $fInterval <b>Seconds</b> (decimals can be used) between timer calls. * @param integer $iRepeat How many times the timer should call before it is destroyed. -1 implies infinite. * @param mixed $... Arguments to pass to timer. * @return string Timer reference ID. */ public function timerCreate($cCallback, $iInterval, $iRepeat) { $aArguments = func_get_args(); array_shift($aArguments); array_shift($aArguments); array_shift($aArguments); return Timers::Create($cCallback, $iInterval, $iRepeat, (array) $aArguments); }