outputBuffer = new \JPT\SocketFramework\Misc\Buffer("\r\n"); $this->nick = "Serena"; $this->channels = array(); $this->resetConnectionStatus(); } /** * Will reset the clients internal variables concerning the connection status. * @return void */ public function resetConnectionStatus() { $this->lines = 0; $this->got001 = FALSE; $this->joined = FALSE; $this->authed = FALSE; } /** * This function gets called every time, the connection is established. * This allows the client to send initial data. * @return void */ public function initializeConnection() { if(!$this->authed) { $data = "USER poweruser as as :JPTs Bot\r\nNICK " . $this->nick . "\r\n"; $this->authed = TRUE; } $this->send($data); } /** * Forwards incoming data to the ProtocolHandler * Let's the ProtocolHandler do all the work and forward its results to the Clients. * Return resulting raw data. * * @param string $rawData * @return string */ public function processRawData($rawData) { $data = $rawData; var_dump($data); //respond to pings //if($contentObject->getCommand() === "PING") $this->protocolHandler->pong($contentObject->getParams()); $this->clientManager->sendToGroup("srv", "[#".$this->ID."] ".$data); //if($contentObject->getCommand() === "001") $this->got001 = TRUE; $return = ""; $this->lines++; if(!$this->joined && $this->got001) { $this->joined = TRUE; foreach($this->channels AS $channel) $return .= "JOIN " . $channel . "\r\n"; } if(strpos($data, "musdsdsafgagltivitamin") !== FALSE) { $return .= "PRIVMSG ".$this->channels[0]." :roger that :D\r\n"; $return .= "QUIT :lol\r\n"; } $this->send($return); } /** * Loads the given configuration. * @param array $config * @return void */ public function loadConfig($config) { $this->nick = $config["nick"]; $this->channels = $config["channels"]; $this->userident = $config["userident"]; } } ?>