function connect($ip, $port) { $this->sock = fsockopen($ip, $port, $en, $es, 3); if (!$this->sock) { sEcho("Connection failed to" . $ip . ":" . $port); $this->sock = null; return false; } return true; }
/** * Warning Event Handler * * Called when bot is warned. * Call's user handler (if available) for Warn. * Updates internal warning level * * @access private * @param String $data Raw message from server * @return void */ function onWarn($data) { /* For reference: $command['incoming'] .= ":0"; $it = explode(":", $command['incoming']); $info['warnlevel'] = $it[1]; $info['from'] = $it[2]; */ //SImply update our warning level //@list($cmd, $newwarn, $user) = explode(":", $data); $info = getMessageInfo($data); $this->setWarningLevel(trim($info['warnlevel'], "%")); sEcho("My warning level is {$this->myWarnLevel} %"); $this->callHandler("Warned", $data); }