session = $session = new irc\client\Session( $url["user"], $url["user"], $url["user"] ); @list($this->channel, $this->keyword) = explode(" ", $url["fragment"]); $session->onConnect = $session->onPart = function($origin, array $args) { $this->joined = false; $this->session->doJoin("#".$this->channel, $this->keyword); }; $session->onJoin = function($origin, array $args) use ($onJoin) { $this->joined = true; $onJoin($this, $origin, $args); }; $session->doConnect(false, $url["host"], @$url["port"]?:6667, @$url["pass"]); } function send($message = null) { if (isset($message)) { $this->queue[] = $message; } if ($this->joined) { while ($this->queue) { $this->session->doMsg("#".$this->channel, array_shift($this->queue)); } } } function getSession() { return $this->session; } } if (!extension_loaded("ircclient")) { fatal("ext/ircclient not loaded"); } # vim: noet