Etienne Kneuss

home » repository » php » ircbot » libraries » class.Link_IRC.php
Tree:
school
mp3
php
sample
publications
Math_Derivative
Math_Expression
ircbot
libraries
class.Link_IRC.php
class.DB_mySQL.php
class.Link.php
expt.DB_Exception.php
class.DB_mySQL_Results.php
class.DB_Common_Results.php
class.DB.php
class.DB_Common.php
iface.Observed.php
iface.Observer.php
class.BaseArray.php
class.Bot.php
modules
exceptions
bot.php
plopbot.sql
php.net
images
dump

Source code raw phps

    <?php require_once 'libraries/class.Link.php'; class Link_IRC extends Link {          protected $_stream = null;     public    $error   = '';     static public $status = parent::S_NOT_CONNECTED;          public function connect ($host, $port)      {         if ($this->_stream = fsockopen($host, $port, $errno, $errstr)) {                          self::$status = parent::S_CONNECTED;                          return true;                      } else {             $this->error = $errstr;             self::$status = parent::S_NOT_CONNECTED;             return false;         }     }          public function read ($length = 2048)     {         if (is_resource($this->_stream) && ($input = fread($this->_stream, $length)) !== false) {                      $input = trim($input);             if (!empty($input)) {                 return $input;             } else {                 return false;             }         } else {                      // make the bot reconnect             Bot::$status = Bot::S_RECONNECT;             return false;         }     }     public function write ($content)      {         if (is_resource($this->_stream)) {                          return fwrite($this->_stream, $content."\n");         } else {             // make the bot reconnect             Bot::$status = Bot::S_RECONNECT;             return false;         }     }     public function isValid()     {         return (self::$status == parent::S_CONNECTED);     }     public function eof()     {         return false;     } } ?>

Comments

There is currently no comment here.

Add a comment

Username:

Spam Challenge: 2+13=?

Comment: