function listen() { if($this->anotherlisten) { $this->listenmore->obj->{$this->listenmore->fun}(); } while ($this->state()) { if(!$this->usesockets) { $read = fread($this->socket, 10240); } else { $read = socket_read($this->socket, 2048, PHP_NORMAL_READ); } $this->sendto->object->{$this->sendto->function}($read); $lines = explode("\r\n", $read); foreach($lines as $line) { $msg = explode(" ", $line); if($msg[1] == "001") $this->_join(); $msghand = new messagehandler($line, &$this); $msghand->checkforactions(); } if(strlen($read) > 0) { $this->log("type: {$this->_gettype($read)}\n"); } $this->log("RECIVE: {$read}"); $ping = explode("PING :", $read); if(@strlen($ping[1]) > 0) { $this->send("PONG {$ping[1]}"); } $private_message = explode("PRIVMSG", $read); $private_message = explode(":", @$j[1]); $this->log(@$private_message[1]); } }