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->got_001 = FALSE; $this->joined = FALSE; $this->authed = FALSE; } /** * Does all the hard work. * @param string $data * @return string */ public function processContentObject($contentObject) { $data = $contentObject->rawData; echo "[RECV] ".$data; $this->clientManager->sendToGroup("srv", "[#".$this->ID."] ".$data."\r\n\r\n"); $return = ""; if(strpos($data, "PING :") !== FALSE) $return .= str_replace("PING", "PONG", $data); if(preg_match("/001/", $data)) $this->got_001 = TRUE; $this->lines++; if(!$this->authed && $this->lines > 1) { $return .= "USER as as as :Asdfg\r\nNICK :" . $this->nick . "\r\n"; $this->authed = TRUE; } if($this->got_001 && !$this->joined) { $this->joined = TRUE; foreach($this->channels AS $channel) $return .= "JOIN " . $channel . "\r\n"; } if(strpos($data, "hau ab") !== FALSE) { $return .= "PRIVMSG ".$this->channels[0]." :roger that :D\r\n"; $return .= "QUIT :lol\r\n"; } //if($return !== "") echo "[SEND] ".$return; return $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"]; } } ?>